aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2013-03-22 23:42:25 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-05-06 15:48:17 -0400
commit9b21493c4520970f8f404e0265f48e37f9cffaf5 (patch)
tree52192b0d2521ad8cba45bc081a279e8d746dfb27
parentb8d4a5bf6a049303a29a3275f463f09a490b50ea (diff)
[SCSI] sd: use REQ_PM in sd's runtime suspend operation
With the introduction of REQ_PM, modify sd's runtime suspend operation functions to use that flag so that the operations to put the device into runtime suspended state(i.e. sync cache and stop device) will not affect its runtime PM status. Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Aaron Lu <aaron.lu@intel.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/scsi_lib.c9
-rw-r--r--drivers/scsi/sd.c9
-rw-r--r--include/scsi/scsi_device.h16
3 files changed, 21 insertions, 13 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c31187d79343..86d522004a20 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -276,11 +276,10 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
276} 276}
277EXPORT_SYMBOL(scsi_execute); 277EXPORT_SYMBOL(scsi_execute);
278 278
279 279int scsi_execute_req_flags(struct scsi_device *sdev, const unsigned char *cmd,
280int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
281 int data_direction, void *buffer, unsigned bufflen, 280 int data_direction, void *buffer, unsigned bufflen,
282 struct scsi_sense_hdr *sshdr, int timeout, int retries, 281 struct scsi_sense_hdr *sshdr, int timeout, int retries,
283 int *resid) 282 int *resid, int flags)
284{ 283{
285 char *sense = NULL; 284 char *sense = NULL;
286 int result; 285 int result;
@@ -291,14 +290,14 @@ int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
291 return DRIVER_ERROR << 24; 290 return DRIVER_ERROR << 24;
292 } 291 }
293 result = scsi_execute(sdev, cmd, data_direction, buffer, bufflen, 292 result = scsi_execute(sdev, cmd, data_direction, buffer, bufflen,
294 sense, timeout, retries, 0, resid); 293 sense, timeout, retries, flags, resid);
295 if (sshdr) 294 if (sshdr)
296 scsi_normalize_sense(sense, SCSI_SENSE_BUFFERSIZE, sshdr); 295 scsi_normalize_sense(sense, SCSI_SENSE_BUFFERSIZE, sshdr);
297 296
298 kfree(sense); 297 kfree(sense);
299 return result; 298 return result;
300} 299}
301EXPORT_SYMBOL(scsi_execute_req); 300EXPORT_SYMBOL(scsi_execute_req_flags);
302 301
303/* 302/*
304 * Function: scsi_init_cmd_errh() 303 * Function: scsi_init_cmd_errh()
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 7992635d405f..c6e2b34a1036 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1424,8 +1424,9 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
1424 * Leave the rest of the command zero to indicate 1424 * Leave the rest of the command zero to indicate
1425 * flush everything. 1425 * flush everything.
1426 */ 1426 */
1427 res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr, 1427 res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0,
1428 SD_FLUSH_TIMEOUT, SD_MAX_RETRIES, NULL); 1428 &sshdr, SD_FLUSH_TIMEOUT,
1429 SD_MAX_RETRIES, NULL, REQ_PM);
1429 if (res == 0) 1430 if (res == 0)
1430 break; 1431 break;
1431 } 1432 }
@@ -3021,8 +3022,8 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
3021 if (!scsi_device_online(sdp)) 3022 if (!scsi_device_online(sdp))
3022 return -ENODEV; 3023 return -ENODEV;
3023 3024
3024 res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr, 3025 res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
3025 SD_TIMEOUT, SD_MAX_RETRIES, NULL); 3026 SD_TIMEOUT, SD_MAX_RETRIES, NULL, REQ_PM);
3026 if (res) { 3027 if (res) {
3027 sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n"); 3028 sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n");
3028 sd_print_result(sdkp, res); 3029 sd_print_result(sdkp, res);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index a7f9cba275e9..cc645876d147 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -394,10 +394,18 @@ extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
394 int data_direction, void *buffer, unsigned bufflen, 394 int data_direction, void *buffer, unsigned bufflen,
395 unsigned char *sense, int timeout, int retries, 395 unsigned char *sense, int timeout, int retries,
396 int flag, int *resid); 396 int flag, int *resid);
397extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, 397extern int scsi_execute_req_flags(struct scsi_device *sdev,
398 int data_direction, void *buffer, unsigned bufflen, 398 const unsigned char *cmd, int data_direction, void *buffer,
399 struct scsi_sense_hdr *, int timeout, int retries, 399 unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout,
400 int *resid); 400 int retries, int *resid, int flags);
401static inline int scsi_execute_req(struct scsi_device *sdev,
402 const unsigned char *cmd, int data_direction, void *buffer,
403 unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout,
404 int retries, int *resid)
405{
406 return scsi_execute_req_flags(sdev, cmd, data_direction, buffer,
407 bufflen, sshdr, timeout, retries, resid, 0);
408}
401extern void sdev_disable_disk_events(struct scsi_device *sdev); 409extern void sdev_disable_disk_events(struct scsi_device *sdev);
402extern void sdev_enable_disk_events(struct scsi_device *sdev); 410extern void sdev_enable_disk_events(struct scsi_device *sdev);
403 411