• Rafael J. Wysocki's avatar
    PM / core: Direct DPM_FLAG_SMART_SUSPEND optimization · 75e94645
    Rafael J. Wysocki authored
    
    
    Make the PM core avoid invoking the "late" and "noirq" system-wide
    suspend (or analogous) callbacks provided by device drivers directly
    for devices with DPM_FLAG_SMART_SUSPEND set that are in runtime
    suspend during the "late" and "noirq" phases of system-wide suspend
    (or analogous) transitions.  That is only done for devices without
    any middle-layer "late" and "noirq" suspend callbacks (to avoid
    confusing the middle layer if there is one).
    
    The underlying observation is that runtime PM is disabled for devices
    during the "late" and "noirq" system-wide suspend phases, so if they
    remain in runtime suspend from the "late" phase forward, it doesn't
    make sense to invoke the "late" and "noirq" callbacks provided by
    the drivers for them (arguably, the device is already suspended and
    in the right state).  Thus, if the remaining driver suspend callbacks
    are to be invoked directly by the core, they can be skipped.
    
    This change really makes it possible for, say, platform device
    drivers to re-use runtime PM suspend and resume callbacks by
    pointing ->suspend_late and ->resume_early, respectively (and
    possibly the analogous hibernation-related callback pointers too),
    to them without adding any extra "is the device already suspended?"
    type of checks to the callback routines, as long as they will be
    invoked directly by the core.
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    75e94645
main.c 51.2 KB