aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-10-16 17:26:49 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-10-16 17:26:49 -0400
commit9bd717c0dc8224cadfd66df7eeff98c987711d98 (patch)
treebca8a9232d457d984d87da53b5ffadcb7dcd46be /drivers/base
parent7811ac276bb9f77aa6475110ef340c1bc3090def (diff)
parent857b36c7b038ac56a882ee914df93e5985443074 (diff)
Merge branch 'pm-runtime' into pm-for-linus
* pm-runtime: PM / Runtime: Handle .runtime_suspend() failure correctly PM / Runtime: Fix kerneldoc comment for rpm_suspend() PM / Runtime: Update document about callbacks
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/runtime.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 7a6fb5e34a0e..6bb3aafa85ed 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -286,14 +286,16 @@ static int rpm_callback(int (*cb)(struct device *), struct device *dev)
286 * @dev: Device to suspend. 286 * @dev: Device to suspend.
287 * @rpmflags: Flag bits. 287 * @rpmflags: Flag bits.
288 * 288 *
289 * Check if the device's runtime PM status allows it to be suspended. If 289 * Check if the device's runtime PM status allows it to be suspended.
290 * another suspend has been started earlier, either return immediately or wait 290 * Cancel a pending idle notification, autosuspend or suspend. If
291 * for it to finish, depending on the RPM_NOWAIT and RPM_ASYNC flags. Cancel a 291 * another suspend has been started earlier, either return immediately
292 * pending idle notification. If the RPM_ASYNC flag is set then queue a 292 * or wait for it to finish, depending on the RPM_NOWAIT and RPM_ASYNC
293 * suspend request; otherwise run the ->runtime_suspend() callback directly. 293 * flags. If the RPM_ASYNC flag is set then queue a suspend request;
294 * If a deferred resume was requested while the callback was running then carry 294 * otherwise run the ->runtime_suspend() callback directly. When
295 * it out; otherwise send an idle notification for the device (if the suspend 295 * ->runtime_suspend succeeded, if a deferred resume was requested while
296 * failed) or for its parent (if the suspend succeeded). 296 * the callback was running then carry it out, otherwise send an idle
297 * notification for its parent (if the suspend succeeded and both
298 * ignore_children of parent->power and irq_safe of dev->power are not set).
297 * 299 *
298 * This function must be called under dev->power.lock with interrupts disabled. 300 * This function must be called under dev->power.lock with interrupts disabled.
299 */ 301 */
@@ -418,15 +420,16 @@ static int rpm_suspend(struct device *dev, int rpmflags)
418 dev->power.runtime_error = 0; 420 dev->power.runtime_error = 0;
419 else 421 else
420 pm_runtime_cancel_pending(dev); 422 pm_runtime_cancel_pending(dev);
421 } else { 423 wake_up_all(&dev->power.wait_queue);
424 goto out;
425 }
422 no_callback: 426 no_callback:
423 __update_runtime_status(dev, RPM_SUSPENDED); 427 __update_runtime_status(dev, RPM_SUSPENDED);
424 pm_runtime_deactivate_timer(dev); 428 pm_runtime_deactivate_timer(dev);
425 429
426 if (dev->parent) { 430 if (dev->parent) {
427 parent = dev->parent; 431 parent = dev->parent;
428 atomic_add_unless(&parent->power.child_count, -1, 0); 432 atomic_add_unless(&parent->power.child_count, -1, 0);
429 }
430 } 433 }
431 wake_up_all(&dev->power.wait_queue); 434 wake_up_all(&dev->power.wait_queue);
432 435