Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1403284

[PATCH v3 1/5] libnvdimm: stop requiring a driver ->remove() method

From Dan Williams <dan.j.williams@intel.com>
Newsgroups linux.kernel
Subject [PATCH v3 1/5] libnvdimm: stop requiring a driver ->remove() method
Date 2016-05-18 23:00 +0200
Message-ID <rAgJs-6ZU-27@gated-at.bofh.it> (permalink)
References <rAgJs-6ZU-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The dax_pmem driver was implementing an empty ->remove() method to
satisfy the nvdimm bus driver that unconditionally calls ->remove().
Teach the core bus driver to check if ->remove() is NULL to remove that
requirement.

Reported-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/nvdimm/bus.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 97589e3cb852..7cbc3d58d176 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -124,9 +124,10 @@ static int nvdimm_bus_remove(struct device *dev)
 	struct nd_device_driver *nd_drv = to_nd_device_driver(dev->driver);
 	struct module *provider = to_bus_provider(dev);
 	struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
-	int rc;
+	int rc = 0;
 
-	rc = nd_drv->remove(dev);
+	if (nd_drv->remove)
+		rc = nd_drv->remove(dev);
 	nd_region_disable(nvdimm_bus, dev);
 
 	dev_dbg(&nvdimm_bus->dev, "%s.remove(%s) = %d\n", dev->driver->name,
@@ -296,8 +297,8 @@ int __nd_driver_register(struct nd_device_driver *nd_drv, struct module *owner,
 		return -EINVAL;
 	}
 
-	if (!nd_drv->probe || !nd_drv->remove) {
-		pr_debug("->probe() and ->remove() must be specified\n");
+	if (!nd_drv->probe) {
+		pr_debug("%s ->probe() must be specified\n", mod_name);
 		return -EINVAL;
 	}
 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/5] "Device DAX" for persistent memory Dan Williams <dan.j.williams@intel.com> - 2016-05-18 23:00 +0200
  [PATCH v3 3/5] /dev/dax, core: file operations and dax-mmap Dan Williams <dan.j.williams@intel.com> - 2016-05-18 23:00 +0200
    Re: [PATCH v3 3/5] /dev/dax, core: file operations and dax-mmap Johannes Thumshirn <jthumshirn@suse.de> - 2016-05-20 10:00 +0200
  [PATCH v3 5/5] libnvdimm: release ida resources Dan Williams <dan.j.williams@intel.com> - 2016-05-18 23:00 +0200
    Re: [PATCH v3 5/5] libnvdimm: release ida resources Johannes Thumshirn <jthumshirn@suse.de> - 2016-05-20 09:40 +0200
  [PATCH v3 4/5] Revert "block: enable dax for raw block devices" Dan Williams <dan.j.williams@intel.com> - 2016-05-18 23:00 +0200
  [PATCH v3 1/5] libnvdimm: stop requiring a driver ->remove() method Dan Williams <dan.j.williams@intel.com> - 2016-05-18 23:00 +0200
    Re: [PATCH v3 1/5] libnvdimm: stop requiring a driver ->remove()  method Johannes Thumshirn <jthumshirn@suse.de> - 2016-05-20 09:40 +0200
  [PATCH v3 2/5] /dev/dax, pmem: direct access to persistent memory Dan Williams <dan.j.williams@intel.com> - 2016-05-18 23:00 +0200
    Re: [PATCH v3 2/5] /dev/dax, pmem: direct access to persistent memory Johannes Thumshirn <jthumshirn@suse.de> - 2016-05-20 10:10 +0200
    Re: [PATCH v3 2/5] /dev/dax, pmem: direct access to persistent memory Xiong Zhou <xzhou@redhat.com> - 2016-05-20 11:50 +0200

csiph-web