AMD IOMMU: simplify dma_mask_to_pages
authorJoerg Roedel <joerg.roedel@amd.com>
Wed, 17 Sep 2008 10:17:00 +0000 (12:17 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 19 Sep 2008 10:59:26 +0000 (12:59 +0200)
The current calculation is very complicated. This patch replaces it with
a much simpler version.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/amd_iommu.c

index f405a61f61fc758fe8b63f8de54fb29e77005a40..db64482b179639d1cfeeed6181903b4dbacc827c 100644 (file)
@@ -472,8 +472,7 @@ static int init_unity_mappings_for_device(struct dma_ops_domain *dma_dom,
  ****************************************************************************/
 static unsigned long dma_mask_to_pages(unsigned long mask)
 {
-       return (mask >> PAGE_SHIFT) +
-               (PAGE_ALIGN(mask & ~PAGE_MASK) >> PAGE_SHIFT);
+       return PAGE_ALIGN(mask) >> PAGE_SHIFT;
 }
 
 /*