Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20c09df7 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley
Browse files

[SCSI] eata: fix the data buffer accessors conversion regression

This fixes the regression introduced by the commit
58e2a02e (eata: convert to use the
data buffer accessors), reported:

http://marc.info/?t=122987621300006&r=1&w=2



- fix DMA_NONE handling in map_dma()

- this driver can't use scsi_dma_map since host->shost_gendev.parent
is not set properly (it uses scsi_register).

Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reported-by: default avatarArthur Marsh <arthur.marsh@internode.on.net>
Tested-by: default avatarArthur Marsh <arthur.marsh@internode.on.net>
Cc: stable@kernel.org
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent d2131b33
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -1626,8 +1626,15 @@ static void map_dma(unsigned int i, struct hostdata *ha)

	cpp->sense_len = SCSI_SENSE_BUFFERSIZE;

	count = scsi_dma_map(SCpnt);
	BUG_ON(count < 0);
	if (!scsi_sg_count(SCpnt)) {
		cpp->data_len = 0;
		return;
	}

	count = pci_map_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt),
			   pci_dir);
	BUG_ON(!count);

	scsi_for_each_sg(SCpnt, sg, count, k) {
		cpp->sglist[k].address = H2DEV(sg_dma_address(sg));
		cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(sg));
@@ -1655,7 +1662,9 @@ static void unmap_dma(unsigned int i, struct hostdata *ha)
		pci_unmap_single(ha->pdev, DEV2H(cpp->sense_addr),
				 DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE);

	scsi_dma_unmap(SCpnt);
	if (scsi_sg_count(SCpnt))
		pci_unmap_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt),
			     pci_dir);

	if (!DEV2H(cpp->data_len))
		pci_dir = PCI_DMA_BIDIRECTIONAL;