aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorJames Bottomley <JBottomley@Parallels.com>2013-05-10 10:54:01 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-05-10 10:54:01 -0400
commit297b8a07347555f0d2fafa4a1ddfc332d2d4afa9 (patch)
tree7c54ce22c1cd10118b5094441b8d7da2f4c58d6a /drivers/scsi/sd.c
parent832e77bc1106592c621fc42f2f6a4500e414a0a1 (diff)
parent6df339a51e3bf18b868384bdeb31e49a4fbaa3d8 (diff)
Merge branch 'postmerge' into for-linus
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 196240dcf26e..c1c555242d0d 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1136,10 +1136,6 @@ static int sd_open(struct block_device *bdev, fmode_t mode)
1136 1136
1137 sdev = sdkp->device; 1137 sdev = sdkp->device;
1138 1138
1139 retval = scsi_autopm_get_device(sdev);
1140 if (retval)
1141 goto error_autopm;
1142
1143 /* 1139 /*
1144 * If the device is in error recovery, wait until it is done. 1140 * If the device is in error recovery, wait until it is done.
1145 * If the device is offline, then disallow any access to it. 1141 * If the device is offline, then disallow any access to it.
@@ -1184,8 +1180,6 @@ static int sd_open(struct block_device *bdev, fmode_t mode)
1184 return 0; 1180 return 0;
1185 1181
1186error_out: 1182error_out:
1187 scsi_autopm_put_device(sdev);
1188error_autopm:
1189 scsi_disk_put(sdkp); 1183 scsi_disk_put(sdkp);
1190 return retval; 1184 return retval;
1191} 1185}
@@ -1220,7 +1214,6 @@ static void sd_release(struct gendisk *disk, fmode_t mode)
1220 * XXX is followed by a "rmmod sd_mod"? 1214 * XXX is followed by a "rmmod sd_mod"?
1221 */ 1215 */
1222 1216
1223 scsi_autopm_put_device(sdev);
1224 scsi_disk_put(sdkp); 1217 scsi_disk_put(sdkp);
1225} 1218}
1226 1219
@@ -1381,14 +1374,9 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)
1381 retval = -ENODEV; 1374 retval = -ENODEV;
1382 1375
1383 if (scsi_block_when_processing_errors(sdp)) { 1376 if (scsi_block_when_processing_errors(sdp)) {
1384 retval = scsi_autopm_get_device(sdp);
1385 if (retval)
1386 goto out;
1387
1388 sshdr = kzalloc(sizeof(*sshdr), GFP_KERNEL); 1377 sshdr = kzalloc(sizeof(*sshdr), GFP_KERNEL);
1389 retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES, 1378 retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES,
1390 sshdr); 1379 sshdr);
1391 scsi_autopm_put_device(sdp);
1392 } 1380 }
1393 1381
1394 /* failed to execute TUR, assume media not present */ 1382 /* failed to execute TUR, assume media not present */
@@ -1438,8 +1426,9 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
1438 * Leave the rest of the command zero to indicate 1426 * Leave the rest of the command zero to indicate
1439 * flush everything. 1427 * flush everything.
1440 */ 1428 */
1441 res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr, 1429 res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0,
1442 SD_FLUSH_TIMEOUT, SD_MAX_RETRIES, NULL); 1430 &sshdr, SD_FLUSH_TIMEOUT,
1431 SD_MAX_RETRIES, NULL, REQ_PM);
1443 if (res == 0) 1432 if (res == 0)
1444 break; 1433 break;
1445 } 1434 }
@@ -2857,6 +2846,7 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
2857 2846
2858 sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", 2847 sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
2859 sdp->removable ? "removable " : ""); 2848 sdp->removable ? "removable " : "");
2849 blk_pm_runtime_init(sdp->request_queue, dev);
2860 scsi_autopm_put_device(sdp); 2850 scsi_autopm_put_device(sdp);
2861 put_device(&sdkp->dev); 2851 put_device(&sdkp->dev);
2862} 2852}
@@ -3040,8 +3030,8 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
3040 if (!scsi_device_online(sdp)) 3030 if (!scsi_device_online(sdp))
3041 return -ENODEV; 3031 return -ENODEV;
3042 3032
3043 res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr, 3033 res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
3044 SD_TIMEOUT, SD_MAX_RETRIES, NULL); 3034 SD_TIMEOUT, SD_MAX_RETRIES, NULL, REQ_PM);
3045 if (res) { 3035 if (res) {
3046 sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n"); 3036 sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n");
3047 sd_print_result(sdkp, res); 3037 sd_print_result(sdkp, res);