Revert "iommu/rockchip: fix bool operation error and probe warning"
authorJeffy Chen <jeffy.chen@rock-chips.com>
Tue, 29 Nov 2016 03:34:49 +0000 (11:34 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 30 Nov 2016 06:10:02 +0000 (14:10 +0800)
This reverts commit e0492807e6b91becccbcab6eca1df27da55d726b.

Same issue fixed by upstream(e04928 "iommu/rockchip: fix bool operation
error and probe warning) which picked as (2e7026 "UPSTREAM: iommu/rockchip:
Fix "is stall active" check).

Conflicts:
drivers/iommu/rockchip-iommu.c

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Change-Id: I56e61894b1da14bce78ae1b3d08158dfb5b027bb

drivers/iommu/rockchip-iommu.c

index 4f856a1a9492cc788c6204ba96f438788b096f29..650c7e42afe85d005c139df3399167edb08ad4cd 100644 (file)
@@ -311,22 +311,24 @@ static void rk_iommu_zap_lines(struct rk_iommu *iommu, dma_addr_t iova_start,
 
 static bool rk_iommu_is_stall_active(struct rk_iommu *iommu)
 {
-       u32 active = RK_MMU_STATUS_STALL_ACTIVE;
+       bool active = true;
        int i;
 
        for (i = 0; i < iommu->num_mmu; i++)
-               active &= !!rk_iommu_read(iommu->bases[i], RK_MMU_STATUS);
+               active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
+                                       RK_MMU_STATUS_STALL_ACTIVE);
 
        return active;
 }
 
 static bool rk_iommu_is_paging_enabled(struct rk_iommu *iommu)
 {
-       u32 enable = RK_MMU_STATUS_PAGING_ENABLED;
+       bool enable = true;
        int i;
 
        for (i = 0; i < iommu->num_mmu; i++)
-               enable &= !!rk_iommu_read(iommu->bases[i], RK_MMU_STATUS);
+               enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
+                                       RK_MMU_STATUS_PAGING_ENABLED);
 
        return enable;
 }
@@ -1139,9 +1141,9 @@ static int rk_iommu_probe(struct platform_device *pdev)
 
        for (i = 0; i < num_res; i++) {
                res = platform_get_resource(pdev, IORESOURCE_MEM, i);
-               if (!res)
-                       continue;
                iommu->bases[i] = devm_ioremap_resource(&pdev->dev, res);
+               if (IS_ERR(iommu->bases[i]))
+                       continue;
                iommu->num_mmu++;
        }
        if (iommu->num_mmu == 0)