diff options
-rw-r--r-- | drivers/base/power/resume.c | 11 | ||||
-rw-r--r-- | drivers/base/power/shutdown.c | 13 | ||||
-rw-r--r-- | drivers/base/power/suspend.c | 17 | ||||
-rw-r--r-- | kernel/power/main.c | 6 |
4 files changed, 35 insertions, 12 deletions
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c index f8f5055754d6..26468971ef5a 100644 --- a/drivers/base/power/resume.c +++ b/drivers/base/power/resume.c | |||
@@ -22,8 +22,17 @@ extern int sysdev_resume(void); | |||
22 | 22 | ||
23 | int resume_device(struct device * dev) | 23 | int resume_device(struct device * dev) |
24 | { | 24 | { |
25 | if (dev->bus && dev->bus->resume) | 25 | if (dev->power.pm_parent |
26 | && dev->power.pm_parent->power.power_state) { | ||
27 | dev_err(dev, "PM: resume from %d, parent %s still %d\n", | ||
28 | dev->power.power_state, | ||
29 | dev->power.pm_parent->bus_id, | ||
30 | dev->power.pm_parent->power.power_state); | ||
31 | } | ||
32 | if (dev->bus && dev->bus->resume) { | ||
33 | dev_dbg(dev,"resuming\n"); | ||
26 | return dev->bus->resume(dev); | 34 | return dev->bus->resume(dev); |
35 | } | ||
27 | return 0; | 36 | return 0; |
28 | } | 37 | } |
29 | 38 | ||
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c index d1e023fbe169..97979901c149 100644 --- a/drivers/base/power/shutdown.c +++ b/drivers/base/power/shutdown.c | |||
@@ -25,8 +25,10 @@ int device_detach_shutdown(struct device * dev) | |||
25 | return 0; | 25 | return 0; |
26 | 26 | ||
27 | if (dev->detach_state == DEVICE_PM_OFF) { | 27 | if (dev->detach_state == DEVICE_PM_OFF) { |
28 | if (dev->driver && dev->driver->shutdown) | 28 | if (dev->driver && dev->driver->shutdown) { |
29 | dev_dbg(dev, "shutdown\n"); | ||
29 | dev->driver->shutdown(dev); | 30 | dev->driver->shutdown(dev); |
31 | } | ||
30 | return 0; | 32 | return 0; |
31 | } | 33 | } |
32 | return dpm_runtime_suspend(dev, dev->detach_state); | 34 | return dpm_runtime_suspend(dev, dev->detach_state); |
@@ -52,13 +54,12 @@ void device_shutdown(void) | |||
52 | struct device * dev; | 54 | struct device * dev; |
53 | 55 | ||
54 | down_write(&devices_subsys.rwsem); | 56 | down_write(&devices_subsys.rwsem); |
55 | list_for_each_entry_reverse(dev, &devices_subsys.kset.list, kobj.entry) { | 57 | list_for_each_entry_reverse(dev, &devices_subsys.kset.list, |
56 | pr_debug("shutting down %s: ", dev->bus_id); | 58 | kobj.entry) { |
57 | if (dev->driver && dev->driver->shutdown) { | 59 | if (dev->driver && dev->driver->shutdown) { |
58 | pr_debug("Ok\n"); | 60 | dev_dbg(dev, "shutdown\n"); |
59 | dev->driver->shutdown(dev); | 61 | dev->driver->shutdown(dev); |
60 | } else | 62 | } |
61 | pr_debug("Ignored.\n"); | ||
62 | } | 63 | } |
63 | up_write(&devices_subsys.rwsem); | 64 | up_write(&devices_subsys.rwsem); |
64 | 65 | ||
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c index a0b5cf689e63..0ec44ef840be 100644 --- a/drivers/base/power/suspend.c +++ b/drivers/base/power/suspend.c | |||
@@ -39,12 +39,25 @@ int suspend_device(struct device * dev, pm_message_t state) | |||
39 | { | 39 | { |
40 | int error = 0; | 40 | int error = 0; |
41 | 41 | ||
42 | dev_dbg(dev, "suspending\n"); | 42 | if (dev->power.power_state) { |
43 | dev_dbg(dev, "PM: suspend %d-->%d\n", | ||
44 | dev->power.power_state, state); | ||
45 | } | ||
46 | if (dev->power.pm_parent | ||
47 | && dev->power.pm_parent->power.power_state) { | ||
48 | dev_err(dev, | ||
49 | "PM: suspend %d->%d, parent %s already %d\n", | ||
50 | dev->power.power_state, state, | ||
51 | dev->power.pm_parent->bus_id, | ||
52 | dev->power.pm_parent->power.power_state); | ||
53 | } | ||
43 | 54 | ||
44 | dev->power.prev_state = dev->power.power_state; | 55 | dev->power.prev_state = dev->power.power_state; |
45 | 56 | ||
46 | if (dev->bus && dev->bus->suspend && !dev->power.power_state) | 57 | if (dev->bus && dev->bus->suspend && !dev->power.power_state) { |
58 | dev_dbg(dev, "suspending\n"); | ||
47 | error = dev->bus->suspend(dev, state); | 59 | error = dev->bus->suspend(dev, state); |
60 | } | ||
48 | 61 | ||
49 | return error; | 62 | return error; |
50 | } | 63 | } |
diff --git a/kernel/power/main.c b/kernel/power/main.c index 7960ddf04a57..4cdebc972ff2 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -156,14 +156,14 @@ static int enter_state(suspend_state_t state) | |||
156 | goto Unlock; | 156 | goto Unlock; |
157 | } | 157 | } |
158 | 158 | ||
159 | pr_debug("PM: Preparing system for suspend\n"); | 159 | pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]); |
160 | if ((error = suspend_prepare(state))) | 160 | if ((error = suspend_prepare(state))) |
161 | goto Unlock; | 161 | goto Unlock; |
162 | 162 | ||
163 | pr_debug("PM: Entering state.\n"); | 163 | pr_debug("PM: Entering %s sleep\n", pm_states[state]); |
164 | error = suspend_enter(state); | 164 | error = suspend_enter(state); |
165 | 165 | ||
166 | pr_debug("PM: Finishing up.\n"); | 166 | pr_debug("PM: Finishing wakeup.\n"); |
167 | suspend_finish(state); | 167 | suspend_finish(state); |
168 | Unlock: | 168 | Unlock: |
169 | up(&pm_sem); | 169 | up(&pm_sem); |