|
@@ -1136,10 +1136,6 @@ static int sd_open(struct block_device *bdev, fmode_t mode)
|
|
|
|
|
|
sdev = sdkp->device;
|
|
sdev = sdkp->device;
|
|
|
|
|
|
- retval = scsi_autopm_get_device(sdev);
|
|
|
|
- if (retval)
|
|
|
|
- goto error_autopm;
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* If the device is in error recovery, wait until it is done.
|
|
* If the device is in error recovery, wait until it is done.
|
|
* If the device is offline, then disallow any access to it.
|
|
* 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)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
error_out:
|
|
error_out:
|
|
- scsi_autopm_put_device(sdev);
|
|
|
|
-error_autopm:
|
|
|
|
scsi_disk_put(sdkp);
|
|
scsi_disk_put(sdkp);
|
|
return retval;
|
|
return retval;
|
|
}
|
|
}
|
|
@@ -1220,7 +1214,6 @@ static void sd_release(struct gendisk *disk, fmode_t mode)
|
|
* XXX is followed by a "rmmod sd_mod"?
|
|
* XXX is followed by a "rmmod sd_mod"?
|
|
*/
|
|
*/
|
|
|
|
|
|
- scsi_autopm_put_device(sdev);
|
|
|
|
scsi_disk_put(sdkp);
|
|
scsi_disk_put(sdkp);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1381,14 +1374,9 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)
|
|
retval = -ENODEV;
|
|
retval = -ENODEV;
|
|
|
|
|
|
if (scsi_block_when_processing_errors(sdp)) {
|
|
if (scsi_block_when_processing_errors(sdp)) {
|
|
- retval = scsi_autopm_get_device(sdp);
|
|
|
|
- if (retval)
|
|
|
|
- goto out;
|
|
|
|
-
|
|
|
|
sshdr = kzalloc(sizeof(*sshdr), GFP_KERNEL);
|
|
sshdr = kzalloc(sizeof(*sshdr), GFP_KERNEL);
|
|
retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES,
|
|
retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES,
|
|
sshdr);
|
|
sshdr);
|
|
- scsi_autopm_put_device(sdp);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/* failed to execute TUR, assume media not present */
|
|
/* failed to execute TUR, assume media not present */
|
|
@@ -1438,8 +1426,9 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
|
|
* Leave the rest of the command zero to indicate
|
|
* Leave the rest of the command zero to indicate
|
|
* flush everything.
|
|
* flush everything.
|
|
*/
|
|
*/
|
|
- res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
|
|
|
|
- SD_FLUSH_TIMEOUT, SD_MAX_RETRIES, NULL);
|
|
|
|
|
|
+ res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0,
|
|
|
|
+ &sshdr, SD_FLUSH_TIMEOUT,
|
|
|
|
+ SD_MAX_RETRIES, NULL, REQ_PM);
|
|
if (res == 0)
|
|
if (res == 0)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -2857,6 +2846,7 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
|
|
|
|
|
|
sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
|
|
sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
|
|
sdp->removable ? "removable " : "");
|
|
sdp->removable ? "removable " : "");
|
|
|
|
+ blk_pm_runtime_init(sdp->request_queue, dev);
|
|
scsi_autopm_put_device(sdp);
|
|
scsi_autopm_put_device(sdp);
|
|
put_device(&sdkp->dev);
|
|
put_device(&sdkp->dev);
|
|
}
|
|
}
|
|
@@ -3040,8 +3030,8 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
|
|
if (!scsi_device_online(sdp))
|
|
if (!scsi_device_online(sdp))
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
|
|
|
|
- res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
|
|
|
|
- SD_TIMEOUT, SD_MAX_RETRIES, NULL);
|
|
|
|
|
|
+ res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
|
|
|
|
+ SD_TIMEOUT, SD_MAX_RETRIES, NULL, REQ_PM);
|
|
if (res) {
|
|
if (res) {
|
|
sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n");
|
|
sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n");
|
|
sd_print_result(sdkp, res);
|
|
sd_print_result(sdkp, res);
|