PM / Runtime: Merge synchronous and async runtime routines
authorAlan Stern <stern@rowland.harvard.edu>
Sat, 25 Sep 2010 21:35:00 +0000 (23:35 +0200)
committerRafael J. Wysocki <rjw@sisk.pl>
Sat, 16 Oct 2010 23:57:46 +0000 (01:57 +0200)
commit1bfee5bc86fdaecc912e06080583eddab7263df2
tree1f1b0f5ff1b9b7a5eed1ccd62de1d8ffb37f2ea3
parent3f9af0513ae5b1f185302c2d0ba656640926d970
PM / Runtime: Merge synchronous and async runtime routines

This patch (as1423) merges the asynchronous routines
__pm_request_idle(), __pm_request_suspend(), and __pm_request_resume()
with their synchronous counterparts.  The RPM_ASYNC bitflag argument
serves to indicate what sort of operation to perform.

In the course of performing this merger, it became apparent that the
various functions don't all behave consistenly with regard to error
reporting and cancellation of outstanding requests.  A new routine,
rpm_check_suspend_allowed(), was written to centralize much of the
testing, and the other functions were revised to follow a simple
algorithm:

If the operation is disallowed because of the device's
settings or current state, return an error.

Cancel pending or scheduled requests of lower priority.

Schedule, queue, or perform the desired operation.

A few special cases and exceptions are noted in comments.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
drivers/base/power/runtime.c