lkml.org 
[lkml]   [2021]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/4] nubus: Simplify check in remove callback
On Fri, 30 Jul 2021, Uwe Kleine-König wrote:

> The driver core only calls a remove callback when the device was
> successfully bound (aka probed) before. So dev->driver is never NULL and
> the respective check can just be dropped.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Finn Thain <fthain@linux-m68k.org>

BTW, aside from nubus, zorro and superhyway you can find the same pattern
in many other busses. You may want to patch the following methods too.

acpi_device_remove
apr_device_remove
ccwgroup_remove
gio_device_remove
hid_device_remove
ibmebus_bus_device_remove
macio_device_remove
memstick_device_remove
ntb_remove
pci_device_remove
pnp_device_remove
ps3_system_bus_remove
rio_device_remove
slim_device_remove
soundbus_device_remove
ssb_device_remove
tifm_device_remove
vdpa_dev_remove
vmbus_remove

> ---
> drivers/nubus/bus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c
> index d9d04f27f89b..17fad660032c 100644
> --- a/drivers/nubus/bus.c
> +++ b/drivers/nubus/bus.c
> @@ -33,7 +33,7 @@ static void nubus_device_remove(struct device *dev)
> {
> struct nubus_driver *ndrv = to_nubus_driver(dev->driver);
>
> - if (dev->driver && ndrv->remove)
> + if (ndrv->remove)
> ndrv->remove(to_nubus_board(dev));
> }
>
>
\
 
 \ /
  Last update: 2021-08-01 07:04    [W:0.137 / U:1.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site