Re: dma related cleanups for wd719x

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

 



On Thursday 18 October 2018 15:01:14 Christoph Hellwig wrote:
> Hi Ondrej,
> 
> can you look over this series, which cleans up a few dma-related
> bits in the wd719x driver?
> 

This makes it work a bit (can detect drive and read partitions) but it hangs
completely after hdparm -t.

diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index d47190f08ed6..55a7a542e653 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -183,7 +183,7 @@ static void wd719x_finish_cmd(struct wd719x_scb *scb, int result)
 	list_del(&scb->list);
 
 	dma_unmap_single(&wd->pdev->dev, scb->phys,
-			sizeof(struct wd719x_scb), DMA_TO_DEVICE);
+			sizeof(struct wd719x_scb), DMA_BIDIRECTIONAL);
 	scsi_dma_unmap(cmd);
 	dma_unmap_single(&wd->pdev->dev, cmd->SCp.dma_handle,
 			 SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
@@ -236,6 +236,12 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
 	if (count_sg) {
 		struct scatterlist *sg;
 
+		scb->phys = dma_map_single(&wd->pdev->dev, scb, sizeof(*scb),
+					   DMA_BIDIRECTIONAL);
+
+		if (dma_mapping_error(&wd->pdev->dev, scb->phys))
+			goto out_unmap_scsi_cmd;
+
 		scb->data_length = cpu_to_le32(count_sg *
 					       sizeof(struct wd719x_sglist));
 		scb->data_p = cpu_to_le32(scb->phys +
@@ -246,11 +252,6 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
 			scb->sg_list[i].length = cpu_to_le32(sg_dma_len(sg));
 		}
 		scb->SCB_options |= WD719X_SCB_FLAGS_DO_SCATTER_GATHER;
-
-		scb->phys = dma_map_single(&wd->pdev->dev, scb, sizeof(*scb),
-					   DMA_TO_DEVICE);
-		if (dma_mapping_error(&wd->pdev->dev, scb->phys))
-			goto out_unmap_scsi_cmd;
 	} else { /* zero length */
 		scb->data_length = 0;
 		scb->data_p = 0;



-- 
Ondrej Zary



[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