Skip to content

Commit fc7a620

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
bus: Make remove callback return void
The driver core ignores the return value of this callback because there is only little it can do when a device disappears. This is the final bit of a long lasting cleanup quest where several buses were converted to also return void from their remove callback. Additionally some resource leaks were fixed that were caused by drivers returning an error code in the expectation that the driver won't go away. With struct bus_type::remove returning void it's prevented that newly implemented buses return an ignored error code and so don't anticipate wrong expectations for driver authors. Reviewed-by: Tom Rix <[email protected]> (For fpga) Reviewed-by: Mathieu Poirier <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> (For drivers/s390 and drivers/vfio) Acked-by: Russell King (Oracle) <[email protected]> (For ARM, Amba and related parts) Acked-by: Mark Brown <[email protected]> Acked-by: Chen-Yu Tsai <[email protected]> (for sunxi-rsb) Acked-by: Pali Rohár <[email protected]> Acked-by: Mauro Carvalho Chehab <[email protected]> (for media) Acked-by: Hans de Goede <[email protected]> (For drivers/platform) Acked-by: Alexandre Belloni <[email protected]> Acked-By: Vinod Koul <[email protected]> Acked-by: Juergen Gross <[email protected]> (For xen) Acked-by: Lee Jones <[email protected]> (For mfd) Acked-by: Johannes Thumshirn <[email protected]> (For mcb) Acked-by: Johan Hovold <[email protected]> Acked-by: Srinivas Kandagatla <[email protected]> (For slimbus) Acked-by: Kirti Wankhede <[email protected]> (For vfio) Acked-by: Maximilian Luz <[email protected]> Acked-by: Heikki Krogerus <[email protected]> (For ulpi and typec) Acked-by: Samuel Iglesias Gonsálvez <[email protected]> (For ipack) Acked-by: Geoff Levand <[email protected]> (For ps3) Acked-by: Yehezkel Bernat <[email protected]> (For thunderbolt) Acked-by: Alexander Shishkin <[email protected]> (For intel_th) Acked-by: Dominik Brodowski <[email protected]> (For pcmcia) Acked-by: Rafael J. Wysocki <[email protected]> (For ACPI) Acked-by: Bjorn Andersson <[email protected]> (rpmsg and apr) Acked-by: Srinivas Pandruvada <[email protected]> (For intel-ish-hid) Acked-by: Dan Williams <[email protected]> (For CXL, DAX, and NVDIMM) Acked-by: William Breathitt Gray <[email protected]> (For isa) Acked-by: Stefan Richter <[email protected]> (For firewire) Acked-by: Benjamin Tissoires <[email protected]> (For hid) Acked-by: Thorsten Scherer <[email protected]> (For siox) Acked-by: Sven Van Asbroeck <[email protected]> (For anybuss) Acked-by: Ulf Hansson <[email protected]> (For MMC) Acked-by: Wolfram Sang <[email protected]> # for I2C Acked-by: Sudeep Holla <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Finn Thain <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 15f83bb commit fc7a620

File tree

86 files changed

+93
-243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+93
-243
lines changed

arch/arm/common/locomo.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,14 +834,13 @@ static int locomo_bus_probe(struct device *dev)
834834
return ret;
835835
}
836836

837-
static int locomo_bus_remove(struct device *dev)
837+
static void locomo_bus_remove(struct device *dev)
838838
{
839839
struct locomo_dev *ldev = LOCOMO_DEV(dev);
840840
struct locomo_driver *drv = LOCOMO_DRV(dev->driver);
841841

842842
if (drv->remove)
843843
drv->remove(ldev);
844-
return 0;
845844
}
846845

847846
struct bus_type locomo_bus_type = {

arch/arm/common/sa1111.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,15 +1364,13 @@ static int sa1111_bus_probe(struct device *dev)
13641364
return ret;
13651365
}
13661366

1367-
static int sa1111_bus_remove(struct device *dev)
1367+
static void sa1111_bus_remove(struct device *dev)
13681368
{
13691369
struct sa1111_dev *sadev = to_sa1111_device(dev);
13701370
struct sa1111_driver *drv = SA1111_DRV(dev->driver);
13711371

13721372
if (drv->remove)
13731373
drv->remove(sadev);
1374-
1375-
return 0;
13761374
}
13771375

13781376
struct bus_type sa1111_bus_type = {

arch/arm/mach-rpc/ecard.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ static int ecard_drv_probe(struct device *dev)
10521052
return ret;
10531053
}
10541054

1055-
static int ecard_drv_remove(struct device *dev)
1055+
static void ecard_drv_remove(struct device *dev)
10561056
{
10571057
struct expansion_card *ec = ECARD_DEV(dev);
10581058
struct ecard_driver *drv = ECARD_DRV(dev->driver);
@@ -1067,8 +1067,6 @@ static int ecard_drv_remove(struct device *dev)
10671067
ec->ops = &ecard_default_ops;
10681068
barrier();
10691069
ec->irq_data = NULL;
1070-
1071-
return 0;
10721070
}
10731071

10741072
/*

arch/mips/sgi-ip22/ip22-gio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,13 @@ static int gio_device_probe(struct device *dev)
143143
return error;
144144
}
145145

146-
static int gio_device_remove(struct device *dev)
146+
static void gio_device_remove(struct device *dev)
147147
{
148148
struct gio_device *gio_dev = to_gio_device(dev);
149149
struct gio_driver *drv = to_gio_driver(dev->driver);
150150

151151
if (dev->driver && drv->remove)
152152
drv->remove(gio_dev);
153-
return 0;
154153
}
155154

156155
static void gio_device_shutdown(struct device *dev)

arch/parisc/kernel/drivers.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,13 @@ static int parisc_driver_probe(struct device *dev)
133133
return rc;
134134
}
135135

136-
static int __exit parisc_driver_remove(struct device *dev)
136+
static void __exit parisc_driver_remove(struct device *dev)
137137
{
138138
struct parisc_device *pa_dev = to_parisc_device(dev);
139139
struct parisc_driver *pa_drv = to_parisc_driver(dev->driver);
140+
140141
if (pa_drv->remove)
141142
pa_drv->remove(pa_dev);
142-
143-
return 0;
144143
}
145144

146145

arch/powerpc/platforms/ps3/system-bus.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ static int ps3_system_bus_probe(struct device *_dev)
381381
return result;
382382
}
383383

384-
static int ps3_system_bus_remove(struct device *_dev)
384+
static void ps3_system_bus_remove(struct device *_dev)
385385
{
386386
struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
387387
struct ps3_system_bus_driver *drv;
@@ -399,7 +399,6 @@ static int ps3_system_bus_remove(struct device *_dev)
399399
__func__, __LINE__, drv->core.name);
400400

401401
pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev_name(&dev->core));
402-
return 0;
403402
}
404403

405404
static void ps3_system_bus_shutdown(struct device *_dev)

arch/powerpc/platforms/pseries/ibmebus.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,13 @@ static int ibmebus_bus_device_probe(struct device *dev)
366366
return error;
367367
}
368368

369-
static int ibmebus_bus_device_remove(struct device *dev)
369+
static void ibmebus_bus_device_remove(struct device *dev)
370370
{
371371
struct platform_device *of_dev = to_platform_device(dev);
372372
struct platform_driver *drv = to_platform_driver(dev->driver);
373373

374374
if (dev->driver && drv->remove)
375375
drv->remove(of_dev);
376-
return 0;
377376
}
378377

379378
static void ibmebus_bus_device_shutdown(struct device *dev)

arch/powerpc/platforms/pseries/vio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ static int vio_bus_probe(struct device *dev)
12571257
}
12581258

12591259
/* convert from struct device to struct vio_dev and pass to driver. */
1260-
static int vio_bus_remove(struct device *dev)
1260+
static void vio_bus_remove(struct device *dev)
12611261
{
12621262
struct vio_dev *viodev = to_vio_dev(dev);
12631263
struct vio_driver *viodrv = to_vio_driver(dev->driver);
@@ -1276,7 +1276,6 @@ static int vio_bus_remove(struct device *dev)
12761276
vio_cmo_bus_remove(viodev);
12771277

12781278
put_device(devptr);
1279-
return 0;
12801279
}
12811280

12821281
static void vio_bus_shutdown(struct device *dev)

arch/sparc/kernel/vio.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static int vio_device_probe(struct device *dev)
9393
return drv->probe(vdev, id);
9494
}
9595

96-
static int vio_device_remove(struct device *dev)
96+
static void vio_device_remove(struct device *dev)
9797
{
9898
struct vio_dev *vdev = to_vio_dev(dev);
9999
struct vio_driver *drv = to_vio_driver(dev->driver);
@@ -107,8 +107,6 @@ static int vio_device_remove(struct device *dev)
107107

108108
drv->remove(vdev);
109109
}
110-
111-
return 0;
112110
}
113111

114112
static ssize_t devspec_show(struct device *dev,

drivers/acpi/bus.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ static int acpi_device_probe(struct device *dev)
10191019
return 0;
10201020
}
10211021

1022-
static int acpi_device_remove(struct device *dev)
1022+
static void acpi_device_remove(struct device *dev)
10231023
{
10241024
struct acpi_device *acpi_dev = to_acpi_device(dev);
10251025
struct acpi_driver *acpi_drv = acpi_dev->driver;
@@ -1034,7 +1034,6 @@ static int acpi_device_remove(struct device *dev)
10341034
acpi_dev->driver_data = NULL;
10351035

10361036
put_device(dev);
1037-
return 0;
10381037
}
10391038

10401039
struct bus_type acpi_bus_type = {

0 commit comments

Comments
 (0)