Commit ca33d26a authored by Martin Oliveira's avatar Martin Oliveira Committed by Christoph Hellwig

alpha: return error code from alpha_pci_map_sg()

The .map_sg() op now expects an error code instead of zero on failure.

pci_map_single_1() can fail for different reasons, but since the only
supported type of error return is DMA_MAPPING_ERROR, we coalesce those
errors into EIO.

ENOMEM is returned when no page tables can be allocated.
Signed-off-by: default avatarMartin Oliveira <martin.oliveira@eideticom.com>
Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent dabb16f6
...@@ -649,7 +649,9 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg, ...@@ -649,7 +649,9 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
sg->dma_address sg->dma_address
= pci_map_single_1(pdev, SG_ENT_VIRT_ADDRESS(sg), = pci_map_single_1(pdev, SG_ENT_VIRT_ADDRESS(sg),
sg->length, dac_allowed); sg->length, dac_allowed);
return sg->dma_address != DMA_MAPPING_ERROR; if (sg->dma_address == DMA_MAPPING_ERROR)
return -EIO;
return 1;
} }
start = sg; start = sg;
...@@ -685,8 +687,10 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg, ...@@ -685,8 +687,10 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
if (out < end) if (out < end)
out->dma_length = 0; out->dma_length = 0;
if (out - start == 0) if (out - start == 0) {
printk(KERN_WARNING "pci_map_sg failed: no entries?\n"); printk(KERN_WARNING "pci_map_sg failed: no entries?\n");
return -ENOMEM;
}
DBGA("pci_map_sg: %ld entries\n", out - start); DBGA("pci_map_sg: %ld entries\n", out - start);
return out - start; return out - start;
...@@ -699,7 +703,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg, ...@@ -699,7 +703,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
entries. Unmap them now. */ entries. Unmap them now. */
if (out > start) if (out > start)
pci_unmap_sg(pdev, start, out - start, dir); pci_unmap_sg(pdev, start, out - start, dir);
return 0; return -ENOMEM;
} }
/* Unmap a set of streaming mode DMA translations. Again, cpu read /* Unmap a set of streaming mode DMA translations. Again, cpu read
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment