diff options
-rw-r--r-- | drivers/base/dd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 85463c4f7653..32823f36cffd 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -1105,6 +1105,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) drv = dev->driver; if (drv) { + pm_runtime_get_sync(dev); + while (device_links_busy(dev)) { __device_driver_unlock(dev, parent); @@ -1116,12 +1118,12 @@ static void __device_release_driver(struct device *dev, struct device *parent) * have released the driver successfully while this one * was waiting, so check for that. */ - if (dev->driver != drv) + if (dev->driver != drv) { + pm_runtime_put(dev); return; + } } - pm_runtime_get_sync(dev); - driver_sysfs_remove(dev); if (dev->bus) |