We often check if a pointer has a specific alignment.  Because the
'&' (bitwise AND) operator cannot take a pointer for the operand,
so we need a cast like, IS_ALIGNED((unsigned long)p, a).

IS_PTR_ALIGNED will be useful as a shorthand.

Signed-off-by: Masahiro Yamada <[email protected]>
---

 include/linux/kernel.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e5edd55..a810e4b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -50,6 +50,7 @@
 #define __ALIGN_MASK(x, mask)  __ALIGN_KERNEL_MASK((x), (mask))
 #define PTR_ALIGN(p, a)                ((typeof(p))ALIGN((unsigned long)(p), 
(a)))
 #define IS_ALIGNED(x, a)               (((x) & ((typeof(x))(a) - 1)) == 0)
+#define IS_PTR_ALIGNED(p, a)           (IS_ALIGNED((unsigned long)p, a))
 
 /* generic data direction definitions */
 #define READ                   0
-- 
2.7.4

Reply via email to