aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power/main.c')
-rw-r--r--drivers/base/power/main.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index a90480baa850..11fe6ed75278 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -49,12 +49,6 @@ LIST_HEAD(dpm_noirq_list);
49static DEFINE_MUTEX(dpm_list_mtx); 49static DEFINE_MUTEX(dpm_list_mtx);
50static pm_message_t pm_transition; 50static pm_message_t pm_transition;
51 51
52/*
53 * Set once the preparation of devices for a PM transition has started, reset
54 * before starting to resume devices. Protected by dpm_list_mtx.
55 */
56static bool transition_started;
57
58static int async_error; 52static int async_error;
59 53
60/** 54/**
@@ -97,19 +91,9 @@ void device_pm_add(struct device *dev)
97 dev->bus ? dev->bus->name : "No Bus", 91 dev->bus ? dev->bus->name : "No Bus",
98 kobject_name(&dev->kobj)); 92 kobject_name(&dev->kobj));
99 mutex_lock(&dpm_list_mtx); 93 mutex_lock(&dpm_list_mtx);
100 if (dev->parent) { 94 if (dev->parent && dev->parent->power.in_suspend)
101 if (dev->parent->power.in_suspend) 95 dev_warn(dev, "parent %s should not be sleeping\n",
102 dev_warn(dev, "parent %s should not be sleeping\n", 96 dev_name(dev->parent));
103 dev_name(dev->parent));
104 } else if (transition_started) {
105 /*
106 * We refuse to register parentless devices while a PM
107 * transition is in progress in order to avoid leaving them
108 * unhandled down the road
109 */
110 dev_WARN(dev, "Parentless device registered during a PM transaction\n");
111 }
112
113 list_add_tail(&dev->power.entry, &dpm_list); 97 list_add_tail(&dev->power.entry, &dpm_list);
114 mutex_unlock(&dpm_list_mtx); 98 mutex_unlock(&dpm_list_mtx);
115} 99}
@@ -482,7 +466,6 @@ void dpm_resume_noirq(pm_message_t state)
482 ktime_t starttime = ktime_get(); 466 ktime_t starttime = ktime_get();
483 467
484 mutex_lock(&dpm_list_mtx); 468 mutex_lock(&dpm_list_mtx);
485 transition_started = false;
486 while (!list_empty(&dpm_noirq_list)) { 469 while (!list_empty(&dpm_noirq_list)) {
487 struct device *dev = to_device(dpm_noirq_list.next); 470 struct device *dev = to_device(dpm_noirq_list.next);
488 int error; 471 int error;
@@ -684,7 +667,6 @@ static void dpm_complete(pm_message_t state)
684 667
685 INIT_LIST_HEAD(&list); 668 INIT_LIST_HEAD(&list);
686 mutex_lock(&dpm_list_mtx); 669 mutex_lock(&dpm_list_mtx);
687 transition_started = false;
688 while (!list_empty(&dpm_prepared_list)) { 670 while (!list_empty(&dpm_prepared_list)) {
689 struct device *dev = to_device(dpm_prepared_list.prev); 671 struct device *dev = to_device(dpm_prepared_list.prev);
690 672
@@ -1020,7 +1002,6 @@ static int dpm_prepare(pm_message_t state)
1020 int error = 0; 1002 int error = 0;
1021 1003
1022 mutex_lock(&dpm_list_mtx); 1004 mutex_lock(&dpm_list_mtx);
1023 transition_started = true;
1024 while (!list_empty(&dpm_list)) { 1005 while (!list_empty(&dpm_list)) {
1025 struct device *dev = to_device(dpm_list.next); 1006 struct device *dev = to_device(dpm_list.next);
1026 1007