summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-12-18 11:33:37 +0100
committerThierry Reding <treding@nvidia.com>2014-12-19 12:17:46 +0100
commit9a7792e2c01b706bef64667f1f39feae70f99730 (patch)
treebba32cf61a8ce12d9dc6d963caef7ba0df586a21
parent987e7afa59fda3f0b9fb5264c6f5e4dc9f3c0ffb (diff)
Revert "WIP: core: Add probed devices to dpm_list"
-rw-r--r--drivers/base/core.c3
-rw-r--r--drivers/base/dd.c13
2 files changed, 14 insertions, 2 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 39d05dbf61a..97e2baf6e5d 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1033,6 +1033,7 @@ int device_add(struct device *dev)
error = dpm_sysfs_add(dev);
if (error)
goto DPMError;
+ device_pm_add(dev);
if (MAJOR(dev->devt)) {
error = device_create_file(dev, &dev_attr_dev);
@@ -1079,6 +1080,7 @@ done:
if (MAJOR(dev->devt))
device_remove_file(dev, &dev_attr_dev);
DevAttrError:
+ device_pm_remove(dev);
dpm_sysfs_remove(dev);
DPMError:
bus_remove_device(dev);
@@ -1201,6 +1203,7 @@ void device_del(struct device *dev)
device_remove_file(dev, &dev_attr_uevent);
device_remove_attrs(dev);
bus_remove_device(dev);
+ device_pm_remove(dev);
driver_deferred_probe_del(dev);
/* Notify the platform of the removal, in case they
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 72839267a0b..cdc779cf79a 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -88,6 +88,16 @@ static void deferred_probe_work_func(struct work_struct *work)
*/
mutex_unlock(&deferred_probe_mutex);
+ /*
+ * Force the device to the end of the dpm_list since
+ * the PM code assumes that the order we add things to
+ * the list is a good order for suspend but deferred
+ * probe makes that very unsafe.
+ */
+ device_pm_lock();
+ device_pm_move_last(dev);
+ device_pm_unlock();
+
dev_dbg(dev, "Retrying from deferred list\n");
bus_probe_device(dev);
@@ -298,7 +308,6 @@ static int really_probe(struct device *dev, struct device_driver *drv)
goto probe_failed;
}
- device_pm_add(dev);
driver_bound(dev);
ret = 1;
pr_debug("bus: '%s': %s: bound device %s to driver %s\n",
@@ -521,7 +530,7 @@ static void __device_release_driver(struct device *dev)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_UNBOUND_DRIVER,
dev);
- device_pm_remove(dev);
+
}
}