• Aaron Lu's avatar
    [SCSI] sd: put to stopped power state when runtime suspend · a0147563
    Aaron Lu authored
    When device is runtime suspended, put it to stopped power state to save
    some power.
    This will also make the behaviour consistent with what the scsi_pm.c
    thinks about sd as the comment says:
    sd treats runtime suspend, system suspend and system hibernate identical.
    With this patch, it is now identical.
    And sd_shutdown will also do nothing when it finds the device has been
    runtime suspended, if we do not spin down the disk in runtime suspend
    by putting it into stopped power state, the disk will be shut down
    And the the same problem can be solved for runtime power off after
    runtime suspended case by this change.
    With the current runtime scheme for disk, it will only be runtime
    suspended when no process opens the disk, so this shouldn't happen a
    lot, which makes it acceptable to spin down the disk when runtime
    suspended. If some day a more aggressive runtime scheme is used, like
    the 'request based runtime pm for disk' that Alan Stern and Lin Ming
    has been working, we can introduce some policy to control this. But for
    now, make it simple and correct by spinning down the disk.
    Signed-off-by: default avatarAaron Lu <aaron.lu@intel.com>
    Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Acked-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
    Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
sd.c 83.5 KB