diff mbox series

[05/10] scsi: use rq_dma_dir in scsi_setup_cmnd

Message ID 20201005084130.143273-6-hch@lst.de
State New
Headers show
Series [01/10] scsi: don't export scsi_device_from_queue | expand

Commit Message

Christoph Hellwig Oct. 5, 2020, 8:41 a.m. UTC
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/scsi_lib.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Hannes Reinecke Oct. 5, 2020, 9:04 a.m. UTC | #1
On 10/5/20 10:41 AM, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/scsi/scsi_lib.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 3c551f06ebe9be..670ad06812b419 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1200,12 +1200,7 @@ static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev,
>   	struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
>   	blk_status_t ret;
>   
> -	if (!blk_rq_bytes(req))
> -		cmd->sc_data_direction = DMA_NONE;
> -	else if (rq_data_dir(req) == WRITE)
> -		cmd->sc_data_direction = DMA_TO_DEVICE;
> -	else
> -		cmd->sc_data_direction = DMA_FROM_DEVICE;
> +	cmd->sc_data_direction = rq_dma_dir(req);
>   
>   	if (blk_rq_is_scsi(req))
>   		ret = scsi_setup_scsi_cmnd(sdev, req);
> 
Makes me wonder if we can't kill sc_data_direction completely.
But maybe later.

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 3c551f06ebe9be..670ad06812b419 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1200,12 +1200,7 @@  static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev,
 	struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
 	blk_status_t ret;
 
-	if (!blk_rq_bytes(req))
-		cmd->sc_data_direction = DMA_NONE;
-	else if (rq_data_dir(req) == WRITE)
-		cmd->sc_data_direction = DMA_TO_DEVICE;
-	else
-		cmd->sc_data_direction = DMA_FROM_DEVICE;
+	cmd->sc_data_direction = rq_dma_dir(req);
 
 	if (blk_rq_is_scsi(req))
 		ret = scsi_setup_scsi_cmnd(sdev, req);