diff options
author | Aaron Lu <aaron.lu@intel.com> | 2012-11-09 02:27:55 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-11-30 04:28:34 -0500 |
commit | 691e3d3175daff73d9b1771bf79ab032fdcec5a5 (patch) | |
tree | f1b66686e4fe57f2494787de0378ad2ca5be4502 /drivers/scsi/sd.c | |
parent | 80d2fd48cca2a0de806c3130551744a04ad5b80b (diff) |
[SCSI] sd: update sd to use the new pm callbacks
Update sd driver to use the callbacks defined in dev_pm_ops.
sd_freeze is NULL, the bus level callback has taken care of quiescing
the device so there should be nothing needs to be done here.
Consequently, sd_thaw is not needed here either.
suspend, poweroff and runtime suspend share the same routine sd_suspend,
which will sync flush and then stop the drive, this is the same as before.
resume, restore and runtime resume share the same routine sd_resume,
which will start the drive by putting it into active power state, this
is also the same as before.
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>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index b1195fd537b6..7992635d405f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -105,7 +105,7 @@ static void sd_unlock_native_capacity(struct gendisk *disk); | |||
105 | static int sd_probe(struct device *); | 105 | static int sd_probe(struct device *); |
106 | static int sd_remove(struct device *); | 106 | static int sd_remove(struct device *); |
107 | static void sd_shutdown(struct device *); | 107 | static void sd_shutdown(struct device *); |
108 | static int sd_suspend(struct device *, pm_message_t state); | 108 | static int sd_suspend(struct device *); |
109 | static int sd_resume(struct device *); | 109 | static int sd_resume(struct device *); |
110 | static void sd_rescan(struct device *); | 110 | static void sd_rescan(struct device *); |
111 | static int sd_done(struct scsi_cmnd *); | 111 | static int sd_done(struct scsi_cmnd *); |
@@ -465,15 +465,23 @@ static struct class sd_disk_class = { | |||
465 | .dev_attrs = sd_disk_attrs, | 465 | .dev_attrs = sd_disk_attrs, |
466 | }; | 466 | }; |
467 | 467 | ||
468 | static const struct dev_pm_ops sd_pm_ops = { | ||
469 | .suspend = sd_suspend, | ||
470 | .resume = sd_resume, | ||
471 | .poweroff = sd_suspend, | ||
472 | .restore = sd_resume, | ||
473 | .runtime_suspend = sd_suspend, | ||
474 | .runtime_resume = sd_resume, | ||
475 | }; | ||
476 | |||
468 | static struct scsi_driver sd_template = { | 477 | static struct scsi_driver sd_template = { |
469 | .owner = THIS_MODULE, | 478 | .owner = THIS_MODULE, |
470 | .gendrv = { | 479 | .gendrv = { |
471 | .name = "sd", | 480 | .name = "sd", |
472 | .probe = sd_probe, | 481 | .probe = sd_probe, |
473 | .remove = sd_remove, | 482 | .remove = sd_remove, |
474 | .suspend = sd_suspend, | ||
475 | .resume = sd_resume, | ||
476 | .shutdown = sd_shutdown, | 483 | .shutdown = sd_shutdown, |
484 | .pm = &sd_pm_ops, | ||
477 | }, | 485 | }, |
478 | .rescan = sd_rescan, | 486 | .rescan = sd_rescan, |
479 | .done = sd_done, | 487 | .done = sd_done, |
@@ -3054,7 +3062,7 @@ exit: | |||
3054 | scsi_disk_put(sdkp); | 3062 | scsi_disk_put(sdkp); |
3055 | } | 3063 | } |
3056 | 3064 | ||
3057 | static int sd_suspend(struct device *dev, pm_message_t mesg) | 3065 | static int sd_suspend(struct device *dev) |
3058 | { | 3066 | { |
3059 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); | 3067 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); |
3060 | int ret = 0; | 3068 | int ret = 0; |
@@ -3069,8 +3077,7 @@ static int sd_suspend(struct device *dev, pm_message_t mesg) | |||
3069 | goto done; | 3077 | goto done; |
3070 | } | 3078 | } |
3071 | 3079 | ||
3072 | if (((mesg.event & PM_EVENT_SLEEP) || PMSG_IS_AUTO(mesg)) && | 3080 | if (sdkp->device->manage_start_stop) { |
3073 | sdkp->device->manage_start_stop) { | ||
3074 | sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); | 3081 | sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); |
3075 | ret = sd_start_stop_device(sdkp, 0); | 3082 | ret = sd_start_stop_device(sdkp, 0); |
3076 | } | 3083 | } |