aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/omap-iopgtable.h
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2015-07-20 18:33:30 -0400
committerJoerg Roedel <jroedel@suse.de>2015-08-03 10:04:42 -0400
commit5ff98fa68c88d7babf96b7df7c713aaf2ed6558a (patch)
treed523999e6f8ecdcce8a5531ddcbe8e8fd427b9d1 /drivers/iommu/omap-iopgtable.h
parent99ee98d6ac964f1a2412d9fe08e577aa4f13905d (diff)
iommu/omap: Use BIT(x) macros in omap-iopgtable.h
Switch to using the BIT(x) macros in omap-iopgtable.h where possible. This eliminates the following checkpatch check warning: "CHECK: Prefer using the BIT macro" A couple of macros that used zero bit shifting are defined directly to avoid the above warning on one of the macros. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/omap-iopgtable.h')
-rw-r--r--drivers/iommu/omap-iopgtable.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/iommu/omap-iopgtable.h b/drivers/iommu/omap-iopgtable.h
index bfde5405f514..01a315227bf0 100644
--- a/drivers/iommu/omap-iopgtable.h
+++ b/drivers/iommu/omap-iopgtable.h
@@ -13,25 +13,27 @@
13#ifndef _OMAP_IOPGTABLE_H 13#ifndef _OMAP_IOPGTABLE_H
14#define _OMAP_IOPGTABLE_H 14#define _OMAP_IOPGTABLE_H
15 15
16#include <linux/bitops.h>
17
16/* 18/*
17 * "L2 table" address mask and size definitions. 19 * "L2 table" address mask and size definitions.
18 */ 20 */
19#define IOPGD_SHIFT 20 21#define IOPGD_SHIFT 20
20#define IOPGD_SIZE (1UL << IOPGD_SHIFT) 22#define IOPGD_SIZE BIT(IOPGD_SHIFT)
21#define IOPGD_MASK (~(IOPGD_SIZE - 1)) 23#define IOPGD_MASK (~(IOPGD_SIZE - 1))
22 24
23/* 25/*
24 * "section" address mask and size definitions. 26 * "section" address mask and size definitions.
25 */ 27 */
26#define IOSECTION_SHIFT 20 28#define IOSECTION_SHIFT 20
27#define IOSECTION_SIZE (1UL << IOSECTION_SHIFT) 29#define IOSECTION_SIZE BIT(IOSECTION_SHIFT)
28#define IOSECTION_MASK (~(IOSECTION_SIZE - 1)) 30#define IOSECTION_MASK (~(IOSECTION_SIZE - 1))
29 31
30/* 32/*
31 * "supersection" address mask and size definitions. 33 * "supersection" address mask and size definitions.
32 */ 34 */
33#define IOSUPER_SHIFT 24 35#define IOSUPER_SHIFT 24
34#define IOSUPER_SIZE (1UL << IOSUPER_SHIFT) 36#define IOSUPER_SIZE BIT(IOSUPER_SHIFT)
35#define IOSUPER_MASK (~(IOSUPER_SIZE - 1)) 37#define IOSUPER_MASK (~(IOSUPER_SIZE - 1))
36 38
37#define PTRS_PER_IOPGD (1UL << (32 - IOPGD_SHIFT)) 39#define PTRS_PER_IOPGD (1UL << (32 - IOPGD_SHIFT))
@@ -41,14 +43,14 @@
41 * "small page" address mask and size definitions. 43 * "small page" address mask and size definitions.
42 */ 44 */
43#define IOPTE_SHIFT 12 45#define IOPTE_SHIFT 12
44#define IOPTE_SIZE (1UL << IOPTE_SHIFT) 46#define IOPTE_SIZE BIT(IOPTE_SHIFT)
45#define IOPTE_MASK (~(IOPTE_SIZE - 1)) 47#define IOPTE_MASK (~(IOPTE_SIZE - 1))
46 48
47/* 49/*
48 * "large page" address mask and size definitions. 50 * "large page" address mask and size definitions.
49 */ 51 */
50#define IOLARGE_SHIFT 16 52#define IOLARGE_SHIFT 16
51#define IOLARGE_SIZE (1UL << IOLARGE_SHIFT) 53#define IOLARGE_SIZE BIT(IOLARGE_SHIFT)
52#define IOLARGE_MASK (~(IOLARGE_SIZE - 1)) 54#define IOLARGE_MASK (~(IOLARGE_SIZE - 1))
53 55
54#define PTRS_PER_IOPTE (1UL << (IOPGD_SHIFT - IOPTE_SHIFT)) 56#define PTRS_PER_IOPTE (1UL << (IOPGD_SHIFT - IOPTE_SHIFT))
@@ -72,16 +74,16 @@ static inline phys_addr_t omap_iommu_translate(u32 d, u32 va, u32 mask)
72/* 74/*
73 * some descriptor attributes. 75 * some descriptor attributes.
74 */ 76 */
75#define IOPGD_TABLE (1 << 0) 77#define IOPGD_TABLE (1)
76#define IOPGD_SECTION (2 << 0) 78#define IOPGD_SECTION (2)
77#define IOPGD_SUPER (1 << 18 | 2 << 0) 79#define IOPGD_SUPER (BIT(18) | IOPGD_SECTION)
78 80
79#define iopgd_is_table(x) (((x) & 3) == IOPGD_TABLE) 81#define iopgd_is_table(x) (((x) & 3) == IOPGD_TABLE)
80#define iopgd_is_section(x) (((x) & (1 << 18 | 3)) == IOPGD_SECTION) 82#define iopgd_is_section(x) (((x) & (1 << 18 | 3)) == IOPGD_SECTION)
81#define iopgd_is_super(x) (((x) & (1 << 18 | 3)) == IOPGD_SUPER) 83#define iopgd_is_super(x) (((x) & (1 << 18 | 3)) == IOPGD_SUPER)
82 84
83#define IOPTE_SMALL (2 << 0) 85#define IOPTE_SMALL (2)
84#define IOPTE_LARGE (1 << 0) 86#define IOPTE_LARGE (1)
85 87
86#define iopte_is_small(x) (((x) & 2) == IOPTE_SMALL) 88#define iopte_is_small(x) (((x) & 2) == IOPTE_SMALL)
87#define iopte_is_large(x) (((x) & 3) == IOPTE_LARGE) 89#define iopte_is_large(x) (((x) & 3) == IOPTE_LARGE)