different approach.
If we add this requirement then yes, it would make sense to remove the
get_noresume and put_sync calls from __device_release_driver(). We
probably want to keep the barrier, though.
> I'm a bit worried about the driver_sysfs_remove() and the bus notifier that
> in theory may affect the runtime PM callbacks potentially executed before
> ->remove() is called.
The driver_sysfs_remove() call merely gets rid of a couple of symlinks
in sysfs. I don't think that will impact runtime PM.
The bus notifier might, however. Perhaps the barrier should be moved
down, after the notifier call. How does this patch look?
Alan Stern
drivers/base/dd.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
===================================================================
@@ -316,15 +316,13 @@ static void __device_release_driver(stru
drv = dev->driver;
if (drv) {
- pm_runtime_get_noresume(dev);
- pm_runtime_barrier(dev);
-
driver_sysfs_remove(dev);
if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_UNBIND_DRIVER,
dev);
+ pm_runtime_barrier(dev);
if (dev->bus && dev->bus->remove)
dev->bus->remove(dev);
@@ -337,8 +335,6 @@ static void __device_release_driver(stru
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_UNBOUND_DRIVER,
dev);
-
- pm_runtime_put_sync(dev);
}
}