aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/dd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/dd.c')
-rw-r--r--drivers/base/dd.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index dcb8a6e48692..9b0aca479580 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -85,8 +85,20 @@ static void deferred_probe_work_func(struct work_struct *work)
85 * manipulate the deferred list 85 * manipulate the deferred list
86 */ 86 */
87 mutex_unlock(&deferred_probe_mutex); 87 mutex_unlock(&deferred_probe_mutex);
88
89 /*
90 * Force the device to the end of the dpm_list since
91 * the PM code assumes that the order we add things to
92 * the list is a good order for suspend but deferred
93 * probe makes that very unsafe.
94 */
95 device_pm_lock();
96 device_pm_move_last(dev);
97 device_pm_unlock();
98
88 dev_dbg(dev, "Retrying from deferred list\n"); 99 dev_dbg(dev, "Retrying from deferred list\n");
89 bus_probe_device(dev); 100 bus_probe_device(dev);
101
90 mutex_lock(&deferred_probe_mutex); 102 mutex_lock(&deferred_probe_mutex);
91 103
92 put_device(dev); 104 put_device(dev);
@@ -283,6 +295,7 @@ probe_failed:
283 devres_release_all(dev); 295 devres_release_all(dev);
284 driver_sysfs_remove(dev); 296 driver_sysfs_remove(dev);
285 dev->driver = NULL; 297 dev->driver = NULL;
298 dev_set_drvdata(dev, NULL);
286 299
287 if (ret == -EPROBE_DEFER) { 300 if (ret == -EPROBE_DEFER) {
288 /* Driver requested deferred probing */ 301 /* Driver requested deferred probing */
@@ -487,6 +500,7 @@ static void __device_release_driver(struct device *dev)
487 drv->remove(dev); 500 drv->remove(dev);
488 devres_release_all(dev); 501 devres_release_all(dev);
489 dev->driver = NULL; 502 dev->driver = NULL;
503 dev_set_drvdata(dev, NULL);
490 klist_remove(&dev->p->knode_driver); 504 klist_remove(&dev->p->knode_driver);
491 if (dev->bus) 505 if (dev->bus)
492 blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 506 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,