Re: [PATCH v2 1/4] nubus: Simplify check in remove callback

From: Finn Thain
Date: Mon Aug 02 2021 - 22:14:21 EST


On Mon, 2 Aug 2021, Uwe Kleine-König wrote:

> >
> > 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
>
> Did you find these by hand? Or using a coccinelle match?
>

I used grep and visual inspection.

> Anyhow, thanks for the list, I'll add it to my todo list but if you're
> motivated don't consider these cleanups as my property. (Please Cc: me
> though to prevent duplicated effort.)
>

I went looking for the other examples of this pattern because I wanted to
understand it better. Then I realized that I might as well make a list
since I was searching anyway.

When skimming that code, I took the impression that the dev->driver ==
NULL test probably comes from old code written before the 'remove'
functions became bus methods. See also commit 594c8281f905 ("[PATCH] Add
bus_type probe, remove, shutdown methods.")

Back when I wrote drivers/nubus/bus.c, apparently I copied-and-pasted the
old pattern from drivers/pci/pci-driver.c, even though that pattern was
already obsolete.

So I do see the value in this cleanup but I'm afraid I'm too busy to help
further. If you don't want to finish it perhaps you can get the janitors
to do so.