Skip to content

Commit 5b47aba

Browse files
t-8chKAGA-KOKO
authored andcommitted
vdso: Introduce vdso/align.h
The vDSO implementation can only include headers from the vdso/ namespace. To enable the usage of the ALIGN() macro from the vDSO, move linux/align.h to vdso/align.h wholly. As the only dependency linux/const.h is only a wrapper around vdso/const.h anyways adapt that dependency. Also provide a compatibility wrapper linux/align.h. Signed-off-by: Thomas Weißschuh <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 30533a5 commit 5b47aba

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

include/linux/align.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
#ifndef _LINUX_ALIGN_H
33
#define _LINUX_ALIGN_H
44

5-
#include <linux/const.h>
6-
7-
/* @a is a power of 2 value */
8-
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
9-
#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
10-
#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
11-
#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
12-
#define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a)))
13-
#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
5+
#include <vdso/align.h>
146

157
#endif /* _LINUX_ALIGN_H */

include/vdso/align.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef __VDSO_ALIGN_H
3+
#define __VDSO_ALIGN_H
4+
5+
#include <vdso/const.h>
6+
7+
/* @a is a power of 2 value */
8+
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
9+
#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
10+
#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
11+
#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
12+
#define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a)))
13+
#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
14+
15+
#endif /* __VDSO_ALIGN_H */

0 commit comments

Comments
 (0)