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

sparc/iommu: return error codes from .map_sg() ops

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

Returning an errno from __sbus_iommu_map_sg() results in
sbus_iommu_map_sg_gflush() and sbus_iommu_map_sg_pflush() returning an
errno, as those functions are wrappers around __sbus_iommu_map_sg().
Signed-off-by: default avatarMartin Oliveira <martin.oliveira@eideticom.com>
Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 7e4e7d4c
...@@ -448,7 +448,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist, ...@@ -448,7 +448,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
iommu = dev->archdata.iommu; iommu = dev->archdata.iommu;
strbuf = dev->archdata.stc; strbuf = dev->archdata.stc;
if (nelems == 0 || !iommu) if (nelems == 0 || !iommu)
return 0; return -EINVAL;
spin_lock_irqsave(&iommu->lock, flags); spin_lock_irqsave(&iommu->lock, flags);
...@@ -580,7 +580,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist, ...@@ -580,7 +580,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
} }
spin_unlock_irqrestore(&iommu->lock, flags); spin_unlock_irqrestore(&iommu->lock, flags);
return 0; return -EINVAL;
} }
/* If contexts are being used, they are the same in all of the mappings /* If contexts are being used, they are the same in all of the mappings
......
...@@ -486,7 +486,7 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, ...@@ -486,7 +486,7 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
iommu = dev->archdata.iommu; iommu = dev->archdata.iommu;
if (nelems == 0 || !iommu) if (nelems == 0 || !iommu)
return 0; return -EINVAL;
atu = iommu->atu; atu = iommu->atu;
prot = HV_PCI_MAP_ATTR_READ; prot = HV_PCI_MAP_ATTR_READ;
...@@ -619,7 +619,7 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, ...@@ -619,7 +619,7 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
} }
local_irq_restore(flags); local_irq_restore(flags);
return 0; return -EINVAL;
} }
static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
......
...@@ -256,7 +256,7 @@ static int __sbus_iommu_map_sg(struct device *dev, struct scatterlist *sgl, ...@@ -256,7 +256,7 @@ static int __sbus_iommu_map_sg(struct device *dev, struct scatterlist *sgl,
sg->dma_address =__sbus_iommu_map_page(dev, sg_page(sg), sg->dma_address =__sbus_iommu_map_page(dev, sg_page(sg),
sg->offset, sg->length, per_page_flush); sg->offset, sg->length, per_page_flush);
if (sg->dma_address == DMA_MAPPING_ERROR) if (sg->dma_address == DMA_MAPPING_ERROR)
return 0; return -EIO;
sg->dma_length = sg->length; sg->dma_length = sg->length;
} }
......
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