diff options
-rw-r--r-- | include/linux/suspend.h | 10 | ||||
-rw-r--r-- | kernel/power/suspend.c | 9 |
2 files changed, 10 insertions, 9 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index bf1bab7b059c..4af270ec2204 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -61,14 +61,15 @@ typedef int __bitwise suspend_state_t; | |||
61 | * before device drivers' late suspend callbacks are executed. It returns | 61 | * before device drivers' late suspend callbacks are executed. It returns |
62 | * 0 on success or a negative error code otherwise, in which case the | 62 | * 0 on success or a negative error code otherwise, in which case the |
63 | * system cannot enter the desired sleep state (@prepare_late(), @enter(), | 63 | * system cannot enter the desired sleep state (@prepare_late(), @enter(), |
64 | * @wake(), and @finish() will not be called in that case). | 64 | * and @wake() will not be called in that case). |
65 | * | 65 | * |
66 | * @prepare_late: Finish preparing the platform for entering the system sleep | 66 | * @prepare_late: Finish preparing the platform for entering the system sleep |
67 | * state indicated by @begin(). | 67 | * state indicated by @begin(). |
68 | * @prepare_late is called before disabling nonboot CPUs and after | 68 | * @prepare_late is called before disabling nonboot CPUs and after |
69 | * device drivers' late suspend callbacks have been executed. It returns | 69 | * device drivers' late suspend callbacks have been executed. It returns |
70 | * 0 on success or a negative error code otherwise, in which case the | 70 | * 0 on success or a negative error code otherwise, in which case the |
71 | * system cannot enter the desired sleep state (@enter() and @wake()). | 71 | * system cannot enter the desired sleep state (@enter() will not be |
72 | * executed). | ||
72 | * | 73 | * |
73 | * @enter: Enter the system sleep state indicated by @begin() or represented by | 74 | * @enter: Enter the system sleep state indicated by @begin() or represented by |
74 | * the argument if @begin() is not implemented. | 75 | * the argument if @begin() is not implemented. |
@@ -81,14 +82,15 @@ typedef int __bitwise suspend_state_t; | |||
81 | * resume callbacks are executed. | 82 | * resume callbacks are executed. |
82 | * This callback is optional, but should be implemented by the platforms | 83 | * This callback is optional, but should be implemented by the platforms |
83 | * that implement @prepare_late(). If implemented, it is always called | 84 | * that implement @prepare_late(). If implemented, it is always called |
84 | * after @enter(), even if @enter() fails. | 85 | * after @prepare_late and @enter(), even if one of them fails. |
85 | * | 86 | * |
86 | * @finish: Finish wake-up of the platform. | 87 | * @finish: Finish wake-up of the platform. |
87 | * @finish is called right prior to calling device drivers' regular suspend | 88 | * @finish is called right prior to calling device drivers' regular suspend |
88 | * callbacks. | 89 | * callbacks. |
89 | * This callback is optional, but should be implemented by the platforms | 90 | * This callback is optional, but should be implemented by the platforms |
90 | * that implement @prepare(). If implemented, it is always called after | 91 | * that implement @prepare(). If implemented, it is always called after |
91 | * @enter() and @wake(), if implemented, even if any of them fails. | 92 | * @enter() and @wake(), even if any of them fails. It is executed after |
93 | * a failing @prepare. | ||
92 | * | 94 | * |
93 | * @end: Called by the PM core right after resuming devices, to indicate to | 95 | * @end: Called by the PM core right after resuming devices, to indicate to |
94 | * the platform that the system has returned to the working state or | 96 | * the platform that the system has returned to the working state or |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 5f8d09f94325..7335952ee473 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -136,19 +136,19 @@ static int suspend_enter(suspend_state_t state) | |||
136 | if (suspend_ops->prepare) { | 136 | if (suspend_ops->prepare) { |
137 | error = suspend_ops->prepare(); | 137 | error = suspend_ops->prepare(); |
138 | if (error) | 138 | if (error) |
139 | return error; | 139 | goto Platform_finish; |
140 | } | 140 | } |
141 | 141 | ||
142 | error = dpm_suspend_noirq(PMSG_SUSPEND); | 142 | error = dpm_suspend_noirq(PMSG_SUSPEND); |
143 | if (error) { | 143 | if (error) { |
144 | printk(KERN_ERR "PM: Some devices failed to power down\n"); | 144 | printk(KERN_ERR "PM: Some devices failed to power down\n"); |
145 | goto Platfrom_finish; | 145 | goto Platform_finish; |
146 | } | 146 | } |
147 | 147 | ||
148 | if (suspend_ops->prepare_late) { | 148 | if (suspend_ops->prepare_late) { |
149 | error = suspend_ops->prepare_late(); | 149 | error = suspend_ops->prepare_late(); |
150 | if (error) | 150 | if (error) |
151 | goto Power_up_devices; | 151 | goto Platform_wake; |
152 | } | 152 | } |
153 | 153 | ||
154 | if (suspend_test(TEST_PLATFORM)) | 154 | if (suspend_test(TEST_PLATFORM)) |
@@ -180,10 +180,9 @@ static int suspend_enter(suspend_state_t state) | |||
180 | if (suspend_ops->wake) | 180 | if (suspend_ops->wake) |
181 | suspend_ops->wake(); | 181 | suspend_ops->wake(); |
182 | 182 | ||
183 | Power_up_devices: | ||
184 | dpm_resume_noirq(PMSG_RESUME); | 183 | dpm_resume_noirq(PMSG_RESUME); |
185 | 184 | ||
186 | Platfrom_finish: | 185 | Platform_finish: |
187 | if (suspend_ops->finish) | 186 | if (suspend_ops->finish) |
188 | suspend_ops->finish(); | 187 | suspend_ops->finish(); |
189 | 188 | ||