From patchwork Fri Mar 23 08:12:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 10302897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 331B5605F7 for ; Fri, 23 Mar 2018 08:12:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 262A528C84 for ; Fri, 23 Mar 2018 08:12:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1ACC128C88; Fri, 23 Mar 2018 08:12:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E1DA328C84 for ; Fri, 23 Mar 2018 08:12:25 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D98AF21E49029; Fri, 23 Mar 2018 01:05:52 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c01::242; helo=mail-pl0-x242.google.com; envelope-from=oohall@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pl0-x242.google.com (mail-pl0-x242.google.com [IPv6:2607:f8b0:400e:c01::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1DE7C21E49029 for ; Fri, 23 Mar 2018 01:05:52 -0700 (PDT) Received: by mail-pl0-x242.google.com with SMTP id c11-v6so7013208plo.0 for ; Fri, 23 Mar 2018 01:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pZCWi94tFBMlcsfsvdVxdI5gRTtgRYBtxNz9YTem+qc=; b=YjFBcRJsIx7LnAxVP5zyZ8pW9jY/zzq6Y799cPduS0NHXRFG2Rk2UudRDrJm1TJ1md QO1FTbbVJaaCHCNC8Sa/5RTCbmnXt6vNoRztx1hhknxavl0riADxTVzHQluSlIh+27yf GBShR4rElLn1DtzSD9ozwE+gRiBtyMBkjDNu/jpzCVqsOMAqFfJRTcndMhbE/lFAvUd/ c3wK/eSswLruq71XHlVNWBc3poykajs8MH1GhaHdidqcIvz0OhXFvQI/rqn0ous8cDm7 RINXjUknLi/z4reZJKe+HHeJCxR4x0Umm9YsVu9sP8OF5Oej+dDJDAJo0u3m78euYsJz SOQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pZCWi94tFBMlcsfsvdVxdI5gRTtgRYBtxNz9YTem+qc=; b=hIZ4QyjOPMpx0E/gGd4TtfjsL23Een9eEIcwXTXPRQdM7Y70PGuw0mWnj19+aaji2N ZGL6Nxm8Lxyd2MRIpGdfiiA7QCUntjZFXh5nqeszKVXG2IelB3m+hntG8iyCKVCH6Jro vKWehWIAVSpTBY1A2zQQLhhN74RQlS+zaTxrej9KXwL9GyOXlDps6b8Izhpq1FPsbXgQ /YooyWtlrFMjyYXhOAd9IXp8ZH2fZmAGPS4kuouPFUneeK6edZKQKfqEc+wv2UMOiJ32 pyN4TXLmJdU0wCZ/91oapsKcFMZtlO3TZPklTOC/jQ4xs3PAdkIvfKoR2bdoVcSJoH16 URqQ== X-Gm-Message-State: AElRT7EX0Epi+g/h0ffjNSO5PnzHLE8W5t3ez6aEM6GbaoyxntvZoY6r tTIZLOf78eTxP3oVLWmAj4QmYw== X-Google-Smtp-Source: AG47ELu7KlEMSFo3iaapzHqvTjDK030X1vT+9qJiohxy69/7Aab5Qqs1swx/OWeMbzdon5dan9rZrA== X-Received: by 2002:a17:902:a5c5:: with SMTP id t5-v6mr28794326plq.244.1521792744471; Fri, 23 Mar 2018 01:12:24 -0700 (PDT) Received: from localhost.localdomain ([203.220.205.233]) by smtp.gmail.com with ESMTPSA id q67sm7474808pfg.39.2018.03.23.01.12.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 01:12:23 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH 2/6] libnvdimm: Add nd_region_destroy() Date: Fri, 23 Mar 2018 19:12:05 +1100 Message-Id: <20180323081209.31387-2-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180323081209.31387-1-oohall@gmail.com> References: <20180323081209.31387-1-oohall@gmail.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Currently there's no way to remove a region from and nvdimm_bus without tearing down the whole bus. This patch adds an API for removing a single region from the bus so that we can implement a sensible unbind operation for the of_nd_region platform driver. Signed-off-by: Oliver O'Halloran --- drivers/nvdimm/region_devs.c | 6 ++++++ include/linux/libnvdimm.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index 2f1d5771100e..76f46fd1fae0 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -1039,6 +1039,12 @@ struct nd_region *nvdimm_blk_region_create(struct nvdimm_bus *nvdimm_bus, } EXPORT_SYMBOL_GPL(nvdimm_blk_region_create); +void nd_region_destroy(struct nd_region *region) +{ + nd_device_unregister(®ion->dev, ND_SYNC); +} +EXPORT_SYMBOL_GPL(nd_region_destroy); + struct nd_region *nvdimm_volatile_region_create(struct nvdimm_bus *nvdimm_bus, struct nd_region_desc *ndr_desc) { diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index f61cb5050297..df21ca176e98 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -192,6 +192,7 @@ struct nd_region *nvdimm_blk_region_create(struct nvdimm_bus *nvdimm_bus, struct nd_region_desc *ndr_desc); struct nd_region *nvdimm_volatile_region_create(struct nvdimm_bus *nvdimm_bus, struct nd_region_desc *ndr_desc); +void nd_region_destroy(struct nd_region *region); void *nd_region_provider_data(struct nd_region *nd_region); void *nd_blk_region_provider_data(struct nd_blk_region *ndbr); void nd_blk_region_set_provider_data(struct nd_blk_region *ndbr, void *data);