Skip to content

Commit 1f97507

Browse files
Uwe Kleine-Königdjbw
Uwe Kleine-König
authored andcommitted
libnvdimm: Make remove callback return void
All drivers return 0 in their remove callback and the driver core ignores the return value of nvdimm_bus_remove() anyhow. So simplify by changing the driver remove callback to return void and return 0 unconditionally to the upper layer. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20210212171043.2136580-2-u.kleine-koenig@pengutronix.de Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 8409f94 commit 1f97507

File tree

7 files changed

+11
-22
lines changed

7 files changed

+11
-22
lines changed

drivers/dax/pmem/compat.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ static int dax_pmem_compat_release(struct device *dev, void *data)
4141
return 0;
4242
}
4343

44-
static int dax_pmem_compat_remove(struct device *dev)
44+
static void dax_pmem_compat_remove(struct device *dev)
4545
{
4646
device_for_each_child(dev, NULL, dax_pmem_compat_release);
47-
return 0;
4847
}
4948

5049
static struct nd_device_driver dax_pmem_compat_driver = {

drivers/nvdimm/blk.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,10 @@ static int nd_blk_probe(struct device *dev)
310310
return nsblk_attach_disk(nsblk);
311311
}
312312

313-
static int nd_blk_remove(struct device *dev)
313+
static void nd_blk_remove(struct device *dev)
314314
{
315315
if (is_nd_btt(dev))
316316
nvdimm_namespace_detach_btt(to_nd_btt(dev));
317-
return 0;
318317
}
319318

320319
static struct nd_device_driver nd_blk_driver = {

drivers/nvdimm/bus.c

+5-8
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,17 @@ static int nvdimm_bus_remove(struct device *dev)
113113
struct nd_device_driver *nd_drv = to_nd_device_driver(dev->driver);
114114
struct module *provider = to_bus_provider(dev);
115115
struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
116-
int rc = 0;
117116

118117
if (nd_drv->remove) {
119118
debug_nvdimm_lock(dev);
120-
rc = nd_drv->remove(dev);
119+
nd_drv->remove(dev);
121120
debug_nvdimm_unlock(dev);
122121
}
123122

124-
dev_dbg(&nvdimm_bus->dev, "%s.remove(%s) = %d\n", dev->driver->name,
125-
dev_name(dev), rc);
123+
dev_dbg(&nvdimm_bus->dev, "%s.remove(%s)\n", dev->driver->name,
124+
dev_name(dev));
126125
module_put(provider);
127-
return rc;
126+
return 0;
128127
}
129128

130129
static void nvdimm_bus_shutdown(struct device *dev)
@@ -427,7 +426,7 @@ static void free_badrange_list(struct list_head *badrange_list)
427426
list_del_init(badrange_list);
428427
}
429428

430-
static int nd_bus_remove(struct device *dev)
429+
static void nd_bus_remove(struct device *dev)
431430
{
432431
struct nvdimm_bus *nvdimm_bus = to_nvdimm_bus(dev);
433432

@@ -446,8 +445,6 @@ static int nd_bus_remove(struct device *dev)
446445
spin_unlock(&nvdimm_bus->badrange.lock);
447446

448447
nvdimm_bus_destroy_ndctl(nvdimm_bus);
449-
450-
return 0;
451448
}
452449

453450
static int nd_bus_probe(struct device *dev)

drivers/nvdimm/dimm.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,14 @@ static int nvdimm_probe(struct device *dev)
113113
return rc;
114114
}
115115

116-
static int nvdimm_remove(struct device *dev)
116+
static void nvdimm_remove(struct device *dev)
117117
{
118118
struct nvdimm_drvdata *ndd = dev_get_drvdata(dev);
119119

120120
nvdimm_bus_lock(dev);
121121
dev_set_drvdata(dev, NULL);
122122
nvdimm_bus_unlock(dev);
123123
put_ndd(ndd);
124-
125-
return 0;
126124
}
127125

128126
static struct nd_device_driver nvdimm_driver = {

drivers/nvdimm/pmem.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ static int nd_pmem_probe(struct device *dev)
564564
return pmem_attach_disk(dev, ndns);
565565
}
566566

567-
static int nd_pmem_remove(struct device *dev)
567+
static void nd_pmem_remove(struct device *dev)
568568
{
569569
struct pmem_device *pmem = dev_get_drvdata(dev);
570570

@@ -579,8 +579,6 @@ static int nd_pmem_remove(struct device *dev)
579579
pmem->bb_state = NULL;
580580
}
581581
nvdimm_flush(to_nd_region(dev->parent), NULL);
582-
583-
return 0;
584582
}
585583

586584
static void nd_pmem_shutdown(struct device *dev)

drivers/nvdimm/region.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static int child_unregister(struct device *dev, void *data)
8787
return 0;
8888
}
8989

90-
static int nd_region_remove(struct device *dev)
90+
static void nd_region_remove(struct device *dev)
9191
{
9292
struct nd_region *nd_region = to_nd_region(dev);
9393

@@ -108,8 +108,6 @@ static int nd_region_remove(struct device *dev)
108108
*/
109109
sysfs_put(nd_region->bb_state);
110110
nd_region->bb_state = NULL;
111-
112-
return 0;
113111
}
114112

115113
static int child_notify(struct device *dev, void *data)

include/linux/nd.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct nd_device_driver {
2626
struct device_driver drv;
2727
unsigned long type;
2828
int (*probe)(struct device *dev);
29-
int (*remove)(struct device *dev);
29+
void (*remove)(struct device *dev);
3030
void (*shutdown)(struct device *dev);
3131
void (*notify)(struct device *dev, enum nvdimm_event event);
3232
};

0 commit comments

Comments
 (0)