iommu/mediatek: Fix a build warning of BIT(32) in ARM
authorYong Wu <yong.wu@mediatek.com>
Thu, 24 Aug 2017 07:42:12 +0000 (15:42 +0800)
committerJoerg Roedel <jroedel@suse.de>
Mon, 28 Aug 2017 09:26:21 +0000 (11:26 +0200)
The commit ("iommu/mediatek: Enlarge the validate PA range
for 4GB mode") introduce the following build warning while ARCH=arm:

   drivers/iommu/mtk_iommu.c: In function 'mtk_iommu_iova_to_phys':
   include/linux/bitops.h:6:24: warning: left shift count >= width
of type [-Wshift-count-overflow]
    #define BIT(nr)   (1UL << (nr))
                           ^
>> drivers/iommu/mtk_iommu.c:407:9: note: in expansion of macro 'BIT'
      pa |= BIT(32);

  drivers/iommu/mtk_iommu.c: In function 'mtk_iommu_probe':
   include/linux/bitops.h:6:24: warning: left shift count >= width
of type [-Wshift-count-overflow]
    #define BIT(nr)   (1UL << (nr))
                           ^
   drivers/iommu/mtk_iommu.c:589:35: note: in expansion of macro 'BIT'
     data->enable_4GB = !!(max_pfn > (BIT(32) >> PAGE_SHIFT));

Use BIT_ULL instead of BIT.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/mtk_iommu.c

index bc00e404514c685e8f0ea48232d11feea0104081..bd515be5b380e32ac224b55d5b9a2dfff26a15ef 100644 (file)
@@ -404,7 +404,7 @@ static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain,
        spin_unlock_irqrestore(&dom->pgtlock, flags);
 
        if (data->enable_4GB)
-               pa |= BIT(32);
+               pa |= BIT_ULL(32);
 
        return pa;
 }
@@ -586,7 +586,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
        data->protect_base = ALIGN(virt_to_phys(protect), MTK_PROTECT_PA_ALIGN);
 
        /* Whether the current dram is over 4GB */
-       data->enable_4GB = !!(max_pfn > (BIT(32) >> PAGE_SHIFT));
+       data->enable_4GB = !!(max_pfn > (BIT_ULL(32) >> PAGE_SHIFT));
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        data->base = devm_ioremap_resource(dev, res);