aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2016-05-18 12:13:13 -0400
committerDan Williams <dan.j.williams@intel.com>2016-05-18 12:13:13 -0400
commit6cf9c5babd980ec1959e0dd45e3036474c6a294f (patch)
treee8a059c5a7d85ab61d918725aae3c5c487762fe2 /drivers/nvdimm
parent45a0dac0451136fa7ae34a6fea53ef6a136287ce (diff)
libnvdimm: stop requiring a driver ->remove() method
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> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r--drivers/nvdimm/bus.c9
1 files 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)
124 struct nd_device_driver *nd_drv = to_nd_device_driver(dev->driver); 124 struct nd_device_driver *nd_drv = to_nd_device_driver(dev->driver);
125 struct module *provider = to_bus_provider(dev); 125 struct module *provider = to_bus_provider(dev);
126 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); 126 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
127 int rc; 127 int rc = 0;
128 128
129 rc = nd_drv->remove(dev); 129 if (nd_drv->remove)
130 rc = nd_drv->remove(dev);
130 nd_region_disable(nvdimm_bus, dev); 131 nd_region_disable(nvdimm_bus, dev);
131 132
132 dev_dbg(&nvdimm_bus->dev, "%s.remove(%s) = %d\n", dev->driver->name, 133 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,
296 return -EINVAL; 297 return -EINVAL;
297 } 298 }
298 299
299 if (!nd_drv->probe || !nd_drv->remove) { 300 if (!nd_drv->probe) {
300 pr_debug("->probe() and ->remove() must be specified\n"); 301 pr_debug("%s ->probe() must be specified\n", mod_name);
301 return -EINVAL; 302 return -EINVAL;
302 } 303 }
303 304