• Alan Stern's avatar
    PM / Runtime: Merge synchronous and async runtime routines · 1bfee5bc
    Alan Stern authored
    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: default avatarAlan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
    1bfee5bc
runtime.c 27.1 KB