Skip to content

Commit 229f587

Browse files
kishonLorenzo Pieralisi
authored andcommitted
linux/kernel.h: Add PTR_ALIGN_DOWN macro
Add a macro for aligning down a pointer. This is useful to get an aligned register address when a device allows only word access and doesn't allow half word or byte access. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Acked-by: Rob Herring <[email protected]>
1 parent 19abcd7 commit 229f587

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/linux/kernel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
3535
#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
3636
#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
37+
#define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a)))
3738
#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
3839

3940
/* generic data direction definitions */

0 commit comments

Comments
 (0)