From: Mike Christie <michael.christie@oracle.com>
To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de,
martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
james.bottomley@hansenpartnership.com
Cc: Mike Christie <michael.christie@oracle.com>
Subject: [PATCH 08/15] scsi: sd: Convert to scsi_execute_cmd
Date: Mon, 21 Nov 2022 21:39:27 -0600 [thread overview]
Message-ID: <20221122033934.33797-9-michael.christie@oracle.com> (raw)
In-Reply-To: <20221122033934.33797-1-michael.christie@oracle.com>
scsi_execute* is going to be removed. Convert sd_mod to use
scsi_execute_cmd.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
drivers/scsi/sd.c | 77 +++++++++++++++++++++++++++++++----------------
1 file changed, 51 insertions(+), 26 deletions(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index bc60ec91dc8f..678f2f5e7813 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -671,9 +671,11 @@ static int sd_sec_submit(void *data, u16 spsp, u8 secp, void *buffer,
put_unaligned_be16(spsp, &cdb[2]);
put_unaligned_be32(len, &cdb[6]);
- ret = scsi_execute(sdev, cdb, send ? DMA_TO_DEVICE : DMA_FROM_DEVICE,
- buffer, len, NULL, NULL, SD_TIMEOUT, sdkp->max_retries, 0,
- RQF_PM, NULL);
+ ret = scsi_execute_cmd(sdev, cdb, send ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN,
+ buffer, len, SD_TIMEOUT, sdkp->max_retries,
+ ((struct scsi_exec_args) {
+ .req_flags = BLK_MQ_REQ_PM
+ }));
return ret <= 0 ? ret : -EIO;
}
#endif /* CONFIG_BLK_SED_OPAL */
@@ -1594,8 +1596,12 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
* Leave the rest of the command zero to indicate
* flush everything.
*/
- res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, sshdr,
- timeout, sdkp->max_retries, 0, RQF_PM, NULL);
+ res = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0,
+ timeout, sdkp->max_retries,
+ ((struct scsi_exec_args) {
+ .sshdr = sshdr,
+ .req_flags = BLK_MQ_REQ_PM
+ }));
if (res == 0)
break;
}
@@ -1750,8 +1756,9 @@ static int sd_pr_command(struct block_device *bdev, u8 sa,
put_unaligned_be64(sa_key, &data[8]);
data[20] = flags;
- result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, &data, sizeof(data),
- &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL);
+ result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_OUT, &data,
+ sizeof(data), SD_TIMEOUT, sdkp->max_retries,
+ ((struct scsi_exec_args) { .sshdr = &sshdr }));
if (scsi_status_is_check_condition(result) &&
scsi_sense_valid(&sshdr)) {
@@ -2095,10 +2102,13 @@ sd_spinup_disk(struct scsi_disk *sdkp)
cmd[0] = TEST_UNIT_READY;
memset((void *) &cmd[1], 0, 9);
- the_result = scsi_execute_req(sdkp->device, cmd,
- DMA_NONE, NULL, 0,
- &sshdr, SD_TIMEOUT,
- sdkp->max_retries, NULL);
+ the_result = scsi_execute_cmd(sdkp->device, cmd,
+ REQ_OP_DRV_IN, NULL, 0,
+ SD_TIMEOUT,
+ sdkp->max_retries,
+ ((struct scsi_exec_args) {
+ .sshdr = &sshdr
+ }));
/*
* If the drive has indicated to us that it
@@ -2155,10 +2165,12 @@ sd_spinup_disk(struct scsi_disk *sdkp)
cmd[4] = 1; /* Start spin cycle */
if (sdkp->device->start_stop_pwr_cond)
cmd[4] |= 1 << 4;
- scsi_execute_req(sdkp->device, cmd, DMA_NONE,
- NULL, 0, &sshdr,
+ scsi_execute_cmd(sdkp->device, cmd,
+ REQ_OP_DRV_IN, NULL, 0,
SD_TIMEOUT, sdkp->max_retries,
- NULL);
+ ((struct scsi_exec_args) {
+ .sshdr = &sshdr
+ }));
spintime_expire = jiffies + 100 * HZ;
spintime = 1;
}
@@ -2305,9 +2317,12 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
cmd[13] = RC16_LEN;
memset(buffer, 0, RC16_LEN);
- the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE,
- buffer, RC16_LEN, &sshdr,
- SD_TIMEOUT, sdkp->max_retries, NULL);
+ the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN,
+ buffer, RC16_LEN, SD_TIMEOUT,
+ sdkp->max_retries,
+ ((struct scsi_exec_args) {
+ .sshdr = &sshdr
+ }));
if (media_not_present(sdkp, &sshdr))
return -ENODEV;
@@ -2390,9 +2405,11 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
memset(&cmd[1], 0, 9);
memset(buffer, 0, 8);
- the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE,
- buffer, 8, &sshdr,
- SD_TIMEOUT, sdkp->max_retries, NULL);
+ the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer,
+ 8, SD_TIMEOUT, sdkp->max_retries,
+ ((struct scsi_exec_args) {
+ .sshdr = &sshdr
+ }));
if (media_not_present(sdkp, &sshdr))
return -ENODEV;
@@ -3641,8 +3658,12 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
if (!scsi_device_online(sdp))
return -ENODEV;
- res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr,
- SD_TIMEOUT, sdkp->max_retries, 0, RQF_PM, NULL);
+ res = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0, SD_TIMEOUT,
+ sdkp->max_retries,
+ ((struct scsi_exec_args) {
+ .sshdr = &sshdr,
+ .req_flags = BLK_MQ_REQ_PM
+ }));
if (res) {
sd_print_result(sdkp, "Start/Stop Unit failed", res);
if (res > 0 && scsi_sense_valid(&sshdr)) {
@@ -3782,10 +3803,14 @@ static int sd_resume_runtime(struct device *dev)
if (sdp->ignore_media_change) {
/* clear the device's sense data */
static const u8 cmd[10] = { REQUEST_SENSE };
-
- if (scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL,
- NULL, sdp->request_queue->rq_timeout, 1, 0,
- RQF_PM, NULL))
+ int result;
+
+ result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0,
+ sdp->request_queue->rq_timeout, 1,
+ ((struct scsi_exec_args) {
+ .req_flags = BLK_MQ_REQ_PM
+ }));
+ if (result)
sd_printk(KERN_NOTICE, sdkp,
"Failed to clear sense data\n");
}
--
2.25.1
next prev parent reply other threads:[~2022-11-22 3:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 3:39 [PATCH 00/15] Add struct to pass in optional args to scsi_execute Mike Christie
2022-11-22 3:39 ` [PATCH 01/15] scsi: Add struct for args to execution functions Mike Christie
2022-11-22 6:36 ` Christoph Hellwig
2022-11-22 9:16 ` John Garry
2022-11-22 15:44 ` Mike Christie
2022-11-22 3:39 ` [PATCH 02/15] scsi: libata: Convert to scsi_execute_cmd Mike Christie
2022-11-22 3:39 ` [PATCH 03/15] hwmon: drivetemp: " Mike Christie
2022-11-22 3:39 ` [PATCH 04/15] scsi: ch: " Mike Christie
2022-11-22 3:39 ` [PATCH 05/15] scsi: scsi_dh: " Mike Christie
2022-11-22 3:39 ` [PATCH 06/15] scsi: core: " Mike Christie
2022-11-22 6:38 ` Christoph Hellwig
2022-11-22 16:13 ` Mike Christie
2022-11-22 18:46 ` Bart Van Assche
2022-11-22 20:06 ` Mike Christie
2022-11-22 3:39 ` [PATCH 07/15] scsi: spi: " Mike Christie
2022-11-22 3:39 ` Mike Christie [this message]
2022-11-22 3:39 ` [PATCH 09/15] scsi: zbc: " Mike Christie
2022-11-22 3:39 ` [PATCH 10/15] scsi: ses: " Mike Christie
2022-11-22 3:39 ` [PATCH 11/15] scsi: sr: " Mike Christie
2022-11-22 3:39 ` [PATCH 12/15] scsi: virtio_scsi: " Mike Christie
2022-11-22 3:39 ` [PATCH 13/15] scsi: target_core_pscsi: " Mike Christie
2022-11-22 3:39 ` [PATCH 14/15] scsi: cxlflash: " Mike Christie
2022-11-22 3:39 ` [PATCH 15/15] scsi: Remove scsi_execute functions Mike Christie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221122033934.33797-9-michael.christie@oracle.com \
--to=michael.christie@oracle.com \
--cc=bvanassche@acm.org \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mwilck@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox