From: Joerg Roedel Date: Wed, 17 Sep 2008 10:17:00 +0000 (+0200) Subject: AMD IOMMU: simplify dma_mask_to_pages X-Git-Tag: v2.6.28-rc1~712^2^4~19 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=6754086ce67c0a1f5d7eac612102368781e14588;p=linux-2.6-omap-h63xx.git AMD IOMMU: simplify dma_mask_to_pages The current calculation is very complicated. This patch replaces it with a much simpler version. Signed-off-by: Joerg Roedel Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index f405a61f61f..db64482b179 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c @@ -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; } /*