[SCSI] scsi_pm: use callbacks from dev_pm_ops for scsi devices
authorAaron Lu <aaron.lu@intel.com>
Fri, 9 Nov 2012 07:27:54 +0000 (15:27 +0800)
committerJames Bottomley <JBottomley@Parallels.com>
Fri, 30 Nov 2012 09:26:48 +0000 (09:26 +0000)
commit80d2fd48cca2a0de806c3130551744a04ad5b80b
tree93fd73939dde64143a8f381dba5eea72b486d684
parent9c31d8e1319e0d3f85673c7119a10700bf03f77a
[SCSI] scsi_pm: use callbacks from dev_pm_ops for scsi devices

Use of pm_message_t is deprecated and device driver is not supposed
to use that. This patch migrates the SCSI bus level pm callbacks
to call device's pm callbacks defined in its driver's dev_pm_ops.

This is achieved by finding out which device pm callback should be used
in bus callback function, and then pass that callback function pointer
as a param to the scsi_bus_{suspend,resume}_common routine, which will
further pass that callback to scsi_dev_type_{suspend,resume} after
proper handling.

The special case for freeze in scsi_bus_suspend_common is not necessary
since there is no high level SCSI driver has implemented freeze, so no
need to runtime resume the device if it is in runtime suspended state
for system freeze, just return like the system suspend/hibernate case.

Since only sd has implemented drv->suspend/drv->resume, and I'll update
sd driver to use the new callbacks in the following patch, there is no
need to fallback to call drv->suspend/drv->resume if dev_pm_ops is NULL.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/scsi_pm.c