aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/power/main.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index c4568b82875b..7b76fd3b93a4 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -62,7 +62,7 @@ static bool all_sleeping;
62 */ 62 */
63int device_pm_add(struct device *dev) 63int device_pm_add(struct device *dev)
64{ 64{
65 int error = 0; 65 int error;
66 66
67 pr_debug("PM: Adding info for %s:%s\n", 67 pr_debug("PM: Adding info for %s:%s\n",
68 dev->bus ? dev->bus->name : "No Bus", 68 dev->bus ? dev->bus->name : "No Bus",
@@ -70,18 +70,15 @@ int device_pm_add(struct device *dev)
70 mutex_lock(&dpm_list_mtx); 70 mutex_lock(&dpm_list_mtx);
71 if ((dev->parent && dev->parent->power.sleeping) || all_sleeping) { 71 if ((dev->parent && dev->parent->power.sleeping) || all_sleeping) {
72 if (dev->parent->power.sleeping) 72 if (dev->parent->power.sleeping)
73 dev_warn(dev, 73 dev_warn(dev, "parent %s is sleeping\n",
74 "parent %s is sleeping, will not add\n",
75 dev->parent->bus_id); 74 dev->parent->bus_id);
76 else 75 else
77 dev_warn(dev, "devices are sleeping, will not add\n"); 76 dev_warn(dev, "all devices are sleeping\n");
78 WARN_ON(true); 77 WARN_ON(true);
79 error = -EBUSY;
80 } else {
81 error = dpm_sysfs_add(dev);
82 if (!error)
83 list_add_tail(&dev->power.entry, &dpm_active);
84 } 78 }
79 error = dpm_sysfs_add(dev);
80 if (!error)
81 list_add_tail(&dev->power.entry, &dpm_active);
85 mutex_unlock(&dpm_list_mtx); 82 mutex_unlock(&dpm_list_mtx);
86 return error; 83 return error;
87} 84}