diff mbox series

[v2,11/15] scsi: sr: Convert to scsi_execute_args/cmd

Message ID 20221209061325.705999-12-michael.christie@oracle.com (mailing list archive)
State Superseded
Headers show
Series scsi: Add struct for args to execution functions | expand

Commit Message

Mike Christie Dec. 9, 2022, 6:13 a.m. UTC
scsi_execute* is going to be removed. Convert sr to scsi_execute_args/cmd.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/sr.c       | 13 ++++++++-----
 drivers/scsi/sr_ioctl.c | 11 +++++++----
 2 files changed, 15 insertions(+), 9 deletions(-)

Comments

John Garry Dec. 9, 2022, 10:20 a.m. UTC | #1
On 09/12/2022 06:13, Mike Christie wrote:
> scsi_execute* is going to be removed. Convert sr to scsi_execute_args/cmd.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>

FWIW:

Reviewed-by: John Garry <john.g.garry@oracle.com>

BTW, I think that the earlier nitpick about assigning exec_args.sshdr 
applies here as well
Bart Van Assche Dec. 12, 2022, 9:18 p.m. UTC | #2
On 12/8/22 22:13, Mike Christie wrote:
> scsi_execute* is going to be removed. Convert sr to scsi_execute_args/cmd.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
diff mbox series

Patch

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index a278b739d0c5..bcaf0701c120 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -170,10 +170,13 @@  static unsigned int sr_get_events(struct scsi_device *sdev)
 	struct event_header *eh = (void *)buf;
 	struct media_event_desc *med = (void *)(buf + 4);
 	struct scsi_sense_hdr sshdr;
+	const struct scsi_exec_args exec_args = {
+		.sshdr = &sshdr,
+	};
 	int result;
 
-	result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, sizeof(buf),
-				  &sshdr, SR_TIMEOUT, MAX_RETRIES, NULL);
+	result = scsi_execute_args(sdev, cmd, REQ_OP_DRV_IN, buf, sizeof(buf),
+				   SR_TIMEOUT, MAX_RETRIES, exec_args);
 	if (scsi_sense_valid(&sshdr) && sshdr.sense_key == UNIT_ATTENTION)
 		return DISK_EVENT_MEDIA_CHANGE;
 
@@ -730,9 +733,9 @@  static void get_sectorsize(struct scsi_cd *cd)
 		memset(buffer, 0, sizeof(buffer));
 
 		/* Do the command and wait.. */
-		the_result = scsi_execute_req(cd->device, cmd, DMA_FROM_DEVICE,
-					      buffer, sizeof(buffer), NULL,
-					      SR_TIMEOUT, MAX_RETRIES, NULL);
+		the_result = scsi_execute_cmd(cd->device, cmd, REQ_OP_DRV_IN,
+					      buffer, sizeof(buffer),
+					      SR_TIMEOUT, MAX_RETRIES);
 
 		retries--;
 
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c
index fbdb5124d7f7..3d65c4eb70a4 100644
--- a/drivers/scsi/sr_ioctl.c
+++ b/drivers/scsi/sr_ioctl.c
@@ -190,11 +190,13 @@  int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
 	struct scsi_device *SDev;
 	struct scsi_sense_hdr local_sshdr, *sshdr = &local_sshdr;
 	int result, err = 0, retries = 0;
+	struct scsi_exec_args exec_args = {};
 
 	SDev = cd->device;
 
 	if (cgc->sshdr)
 		sshdr = cgc->sshdr;
+	exec_args.sshdr = sshdr;
 
       retry:
 	if (!scsi_block_when_processing_errors(SDev)) {
@@ -202,10 +204,11 @@  int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
 		goto out;
 	}
 
-	result = scsi_execute(SDev, cgc->cmd, cgc->data_direction,
-			      cgc->buffer, cgc->buflen, NULL, sshdr,
-			      cgc->timeout, IOCTL_RETRIES, 0, 0, NULL);
-
+	result = scsi_execute_args(SDev, cgc->cmd,
+				   cgc->data_direction == DMA_TO_DEVICE ?
+				   REQ_OP_DRV_OUT : REQ_OP_DRV_IN, cgc->buffer,
+				   cgc->buflen, cgc->timeout, IOCTL_RETRIES,
+				   exec_args);
 	/* Minimal error checking.  Ignore cases we know about, and report the rest. */
 	if (result < 0) {
 		err = result;