Skip to content

Commit

Permalink
sparc/iommu: use sbus_iommu_unmap_page in sbus_iommu_unmap_sg
Browse files Browse the repository at this point in the history
Use the page-level helper instead of duplicating the logic, while also
fixing the incorrect handling of larger than page sized offsets in
the sg variant.

Signed-off-by: Christoph Hellwig <[email protected]>
Reported-by: Guenter Roeck <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Christoph Hellwig authored and davem330 committed May 9, 2019
1 parent 031abf0 commit a7fce1f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/sparc/mm/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ static void sbus_iommu_unmap_sg(struct device *dev, struct scatterlist *sgl,
int nents, enum dma_data_direction dir, unsigned long attrs)
{
struct scatterlist *sg;
int i, n;
int i;

for_each_sg(sgl, sg, nents, i) {
n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
iommu_release_one(dev, sg->dma_address & PAGE_MASK, n);
sbus_iommu_unmap_page(dev, sg->dma_address, sg->length, dir,
attrs);
sg->dma_address = 0x21212121;
}
}
Expand Down

0 comments on commit a7fce1f

Please sign in to comment.