From 8bf8a1d1c13c687eda599c827d713eb70764a79f Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Fri, 20 Mar 2015 13:37:59 -0400 Subject: parisc: Eliminate sg_virt_addr() and private scatterlist.h The only reason to keep parisc's private asm/scatterlist.h was that it had the macro sg_virt_addr(). Convert all callers to use something else (sometimes just sg->offset was enough, others should use sg_virt()), and we can just use the asm-generic scatterlist.h instead. Signed-off-by: Matthew Wilcox Signed-off-by: Dave Anglin Signed-off-by: Helge Deller --- drivers/parisc/iommu-helpers.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'drivers/parisc/iommu-helpers.h') diff --git a/drivers/parisc/iommu-helpers.h b/drivers/parisc/iommu-helpers.h index 8c33491b21fe..761e77bfce5d 100644 --- a/drivers/parisc/iommu-helpers.h +++ b/drivers/parisc/iommu-helpers.h @@ -30,9 +30,9 @@ iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents, unsigned long vaddr; long size; - DBG_RUN_SG(" %d : %08lx/%05x %08lx/%05x\n", nents, + DBG_RUN_SG(" %d : %08lx/%05x %p/%05x\n", nents, (unsigned long)sg_dma_address(startsg), cnt, - sg_virt_addr(startsg), startsg->length + sg_virt(startsg), startsg->length ); @@ -66,7 +66,7 @@ iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents, BUG_ON(pdirp == NULL); - vaddr = sg_virt_addr(startsg); + vaddr = (unsigned long)sg_virt(startsg); sg_dma_len(dma_sg) += startsg->length; size = startsg->length + dma_offset; dma_offset = 0; @@ -113,7 +113,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev, */ contig_sg = startsg; dma_len = startsg->length; - dma_offset = sg_virt_addr(startsg) & ~IOVP_MASK; + dma_offset = startsg->offset; /* PARANOID: clear entries */ sg_dma_address(startsg) = 0; @@ -124,14 +124,13 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev, ** it's always looking one "ahead". */ while(--nents > 0) { - unsigned long prevstartsg_end, startsg_end; + unsigned long prev_end, sg_start; - prevstartsg_end = sg_virt_addr(startsg) + - startsg->length; + prev_end = (unsigned long)sg_virt(startsg) + + startsg->length; startsg++; - startsg_end = sg_virt_addr(startsg) + - startsg->length; + sg_start = (unsigned long)sg_virt(startsg); /* PARANOID: clear entries */ sg_dma_address(startsg) = 0; @@ -150,10 +149,13 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev, break; /* - ** Next see if we can append the next chunk (i.e. - ** it must end on one page and begin on another + * Next see if we can append the next chunk (i.e. + * it must end on one page and begin on another, or + * it must start on the same address as the previous + * entry ended. */ - if (unlikely(((prevstartsg_end | sg_virt_addr(startsg)) & ~PAGE_MASK) != 0)) + if (unlikely((prev_end != sg_start) || + ((prev_end | sg_start) & ~PAGE_MASK))) break; dma_len += startsg->length; -- cgit v1.2.3