Re: [PATCH v2 41/44] wd719x: Stop using the SCSI pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Feb 8, 2022, at 9:25 AM, Bart Van Assche <bvanassche@xxxxxxx> wrote:
> 
> Move the DMA handle into the per-command private data instead of using the
> SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the
> SCSI pointer from struct scsi_cmnd.
> 
> Cc: Ondrej Zary <linux@xxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
> ---
> drivers/scsi/wd719x.c | 12 ++++++------
> drivers/scsi/wd719x.h |  1 +
> 2 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
> index 1a7947554581..f341b79d8036 100644
> --- a/drivers/scsi/wd719x.c
> +++ b/drivers/scsi/wd719x.c
> @@ -196,7 +196,7 @@ static void wd719x_finish_cmd(struct wd719x_scb *scb, int result)
> 	dma_unmap_single(&wd->pdev->dev, scb->phys,
> 			sizeof(struct wd719x_scb), DMA_BIDIRECTIONAL);
> 	scsi_dma_unmap(cmd);
> -	dma_unmap_single(&wd->pdev->dev, cmd->SCp.dma_handle,
> +	dma_unmap_single(&wd->pdev->dev, scb->dma_handle,
> 			 SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
> 
> 	cmd->result = result << 16;
> @@ -229,11 +229,11 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
> 
> 	/* map sense buffer */
> 	scb->sense_buf_length = SCSI_SENSE_BUFFERSIZE;
> -	cmd->SCp.dma_handle = dma_map_single(&wd->pdev->dev, cmd->sense_buffer,
> -			SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
> -	if (dma_mapping_error(&wd->pdev->dev, cmd->SCp.dma_handle))
> +	scb->dma_handle = dma_map_single(&wd->pdev->dev, cmd->sense_buffer,
> +			       SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
> +	if (dma_mapping_error(&wd->pdev->dev, scb->dma_handle))
> 		goto out_unmap_scb;
> -	scb->sense_buf = cpu_to_le32(cmd->SCp.dma_handle);
> +	scb->sense_buf = cpu_to_le32(scb->dma_handle);
> 
> 	/* request autosense */
> 	scb->SCB_options |= WD719X_SCB_FLAGS_AUTO_REQUEST_SENSE;
> @@ -288,7 +288,7 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
> 	return 0;
> 
> out_unmap_sense:
> -	dma_unmap_single(&wd->pdev->dev, cmd->SCp.dma_handle,
> +	dma_unmap_single(&wd->pdev->dev, scb->dma_handle,
> 			 SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
> out_unmap_scb:
> 	dma_unmap_single(&wd->pdev->dev, scb->phys, sizeof(*scb),
> diff --git a/drivers/scsi/wd719x.h b/drivers/scsi/wd719x.h
> index abaabd419a54..966ab0fb4621 100644
> --- a/drivers/scsi/wd719x.h
> +++ b/drivers/scsi/wd719x.h
> @@ -56,6 +56,7 @@ struct wd719x_scb {
> 	u8 flags[2];	/* 62-63 SCB specific flags (local to each thread) */
> 	/* everything below is for driver use (not used by card) */
> 	dma_addr_t phys;	/* bus address of the SCB */
> +	dma_addr_t dma_handle;
> 	struct scsi_cmnd *cmd;	/* a copy of the pointer we were passed */
> 	struct list_head list;
> 	struct wd719x_sglist sg_list[WD719X_SG] __aligned(8); /* SG list */

Reviewed-by: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx>

--
Himanshu Madhani	 Oracle Linux Engineering





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux