]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sparc64/kernel/iommu_common.h
sparc64: use iommu_num_pages function in IOMMU code
[linux-2.6-omap-h63xx.git] / arch / sparc64 / kernel / iommu_common.h
index 202d8ae2a67e3441e0c9c30b3440a942c8ee6fd0..591f5879039ce316a2a9d5187af3367f46e86ecb 100644 (file)
 
 #define SG_ENT_PHYS_ADDRESS(SG)        (__pa(sg_virt((SG))))
 
-static inline unsigned long iommu_nr_pages(unsigned long vaddr,
-                                           unsigned long slen)
-{
-       unsigned long npages;
-
-       npages = IO_PAGE_ALIGN(vaddr + slen) - (vaddr & IO_PAGE_MASK);
-       npages >>= IO_PAGE_SHIFT;
-
-       return npages;
-}
-
 static inline int is_span_boundary(unsigned long entry,
                                   unsigned long shift,
                                   unsigned long boundary_size,
@@ -53,7 +42,8 @@ static inline int is_span_boundary(unsigned long entry,
                                   struct scatterlist *sg)
 {
        unsigned long paddr = SG_ENT_PHYS_ADDRESS(outs);
-       int nr = iommu_nr_pages(paddr, outs->dma_length + sg->length);
+       int nr = iommu_num_pages(paddr, outs->dma_length + sg->length,
+                                IO_PAGE_SIZE);
 
        return iommu_is_span_boundary(entry, nr, shift, boundary_size);
 }