On Mon, Oct 9, 2023, at 14:46, Miquel Raynal wrote: >> On Mon, Oct 09, 2023 at 10:43:46AM +0200, Arnd Bergmann wrote: >> > On Mon, Oct 9, 2023, at 09:22, Masahiro Yamada wrote: >> > > On Mon, Oct 9, 2023 at 5:02 AM Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> > Can we instead question the use of module_platform_driver_probe()? > I don't have the history in mind, but why not just switch to regular > module_platform_driver() registration instead? It seems like the > original authors just did not care about the remove path and were > happy to skip its implementation. > > On mtd devices one can argue that the flash underlying stores the > rootfs and thus cannot be removed, but I believe today this is a > questionable (software) design. It was changed to module_platform_driver_probe() in commit 3a2a13fa902d2 ("mtd: txx9ndfmc: use module_platform_driver_probe()") with a short changelog text: commit 3a2a13fa902d232a1e56582647aed6cb2591349b Author: Jingoo Han <jg1.han@xxxxxxxxxxx> Date: Tue Mar 5 13:31:24 2013 +0900 mtd: txx9ndfmc: use module_platform_driver_probe() This patch uses module_platform_driver_probe() macro which makes the code smaller and simpler. Signed-off-by: Jingoo Han <jg1.han@xxxxxxxxxxx> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx> Signed-off-by: David Woodhouse <David.Woodhouse@xxxxxxxxx> Instead of just simplifying the code, I think that was actually a bugfix because it prevented both the probe and remove callbacks from getting called after getting dropped (deferred probe or unbind/rebind). Using module_platform_driver() is probably even better here, but then we need to remove both the __init and __exit annotations. Arnd