diff options
author | John Keeping <john@metanate.com> | 2016-04-05 10:05:46 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2016-04-07 08:50:18 -0400 |
commit | fbedd9b9905c1643b9f7244d88999e39632bbd87 (patch) | |
tree | ffa7def37d3a6843c3c9fc88018e1640c7a9d090 /drivers/iommu/rockchip-iommu.c | |
parent | eebb8034a5be8c2177cbf07ca2ecd2ff8a058958 (diff) |
iommu/rockchip: Fix "is stall active" check
Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
slaves") rk_iommu_is_stall_active() always returns false because the
bitwise AND operates on the boolean flag promoted to an integer and a
value that is either zero or BIT(2).
Explicitly convert the right-hand value to a boolean so that both sides
are guaranteed to be either zero or one.
rk_iommu_is_paging_enabled() does not suffer from the same problem since
RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same change
for consistency and to make it clear that it's correct without needing
to lookup the value.
Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi slaves")
Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/rockchip-iommu.c')
-rw-r--r-- | drivers/iommu/rockchip-iommu.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c | |||
@@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu *iommu) | |||
315 | int i; | 315 | int i; |
316 | 316 | ||
317 | for (i = 0; i < iommu->num_mmu; i++) | 317 | for (i = 0; i < iommu->num_mmu; i++) |
318 | active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) & | 318 | active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) & |
319 | RK_MMU_STATUS_STALL_ACTIVE; | 319 | RK_MMU_STATUS_STALL_ACTIVE); |
320 | 320 | ||
321 | return active; | 321 | return active; |
322 | } | 322 | } |
@@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu *iommu) | |||
327 | int i; | 327 | int i; |
328 | 328 | ||
329 | for (i = 0; i < iommu->num_mmu; i++) | 329 | for (i = 0; i < iommu->num_mmu; i++) |
330 | enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) & | 330 | enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) & |
331 | RK_MMU_STATUS_PAGING_ENABLED; | 331 | RK_MMU_STATUS_PAGING_ENABLED); |
332 | 332 | ||
333 | return enable; | 333 | return enable; |
334 | } | 334 | } |