diff mbox series

[v2,02/15] scsi: libata: Convert to scsi_execute_args

Message ID 20221209061325.705999-3-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_req is going to be removed. Convert libata to
scsi_execute_args.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/ata/libata-scsi.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

Comments

John Garry Dec. 9, 2022, 9:55 a.m. UTC | #1
On 09/12/2022 06:13, Mike Christie wrote:
> scsi_execute_req is going to be removed. Convert libata to
> scsi_execute_args.
> 
> Signed-off-by: Mike Christie<michael.christie@oracle.com>
> ---
>   drivers/ata/libata-scsi.c | 23 ++++++++++++++---------
>   1 file changed, 14 insertions(+), 9 deletions(-)

FWIW,

Reviewed-by: John Garry <john.g.garry@oracle.com>
Damien Le Moal Dec. 12, 2022, 5:11 a.m. UTC | #2
On 12/9/22 15:13, Mike Christie wrote:
> scsi_execute_req is going to be removed. Convert libata to
> scsi_execute_args.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>

The title should be:

ata: libata-scsi: Convert to scsi_execute_args

Apart from that,

Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

Martin,

Can you take that one through the scsi tree ?
diff mbox series

Patch

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 06a3d95ed8f9..1dbd02118803 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -367,8 +367,12 @@  int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
 	u8 scsi_cmd[MAX_COMMAND_SIZE];
 	u8 args[4], *argbuf = NULL;
 	int argsize = 0;
-	enum dma_data_direction data_dir;
 	struct scsi_sense_hdr sshdr;
+	const struct scsi_exec_args exec_args = {
+		.sshdr = &sshdr,
+		.sense = sensebuf,
+		.sense_len = sizeof(sensebuf),
+	};
 	int cmd_result;
 
 	if (arg == NULL)
@@ -391,11 +395,9 @@  int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
 		scsi_cmd[1]  = (4 << 1); /* PIO Data-in */
 		scsi_cmd[2]  = 0x0e;     /* no off.line or cc, read from dev,
 					    block count in sector count field */
-		data_dir = DMA_FROM_DEVICE;
 	} else {
 		scsi_cmd[1]  = (3 << 1); /* Non-data */
 		scsi_cmd[2]  = 0x20;     /* cc but no off.line or data xfer */
-		data_dir = DMA_NONE;
 	}
 
 	scsi_cmd[0] = ATA_16;
@@ -413,9 +415,8 @@  int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
 
 	/* Good values for timeout and retries?  Values below
 	   from scsi_ioctl_send_command() for default case... */
-	cmd_result = scsi_execute(scsidev, scsi_cmd, data_dir, argbuf, argsize,
-				  sensebuf, &sshdr, (10*HZ), 5, 0, 0, NULL);
-
+	cmd_result = scsi_execute_args(scsidev, scsi_cmd, REQ_OP_DRV_IN, argbuf,
+				       argsize, 10 * HZ, 5, exec_args);
 	if (cmd_result < 0) {
 		rc = cmd_result;
 		goto error;
@@ -475,6 +476,11 @@  int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
 	u8 args[7];
 	struct scsi_sense_hdr sshdr;
 	int cmd_result;
+	const struct scsi_exec_args exec_args = {
+		.sshdr = &sshdr,
+		.sense = sensebuf,
+		.sense_len = sizeof(sensebuf),
+	};
 
 	if (arg == NULL)
 		return -EINVAL;
@@ -497,9 +503,8 @@  int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
 
 	/* Good values for timeout and retries?  Values below
 	   from scsi_ioctl_send_command() for default case... */
-	cmd_result = scsi_execute(scsidev, scsi_cmd, DMA_NONE, NULL, 0,
-				sensebuf, &sshdr, (10*HZ), 5, 0, 0, NULL);
-
+	cmd_result = scsi_execute_args(scsidev, scsi_cmd, REQ_OP_DRV_IN, NULL,
+				       0, 10 * HZ, 5, exec_args);
 	if (cmd_result < 0) {
 		rc = cmd_result;
 		goto error;