[PATCH] include: move STACK_ALIGN_ARRAY to linux/align.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As part of the measures to factor out stuff from common.h into dedicated
headers, move out STACK_ALIGN_ARRAY. This macro doesn't exit in Linux,
but the file is fitting.

We don't need to explicitly include it, because it's being included by
<linux/kernel.h>.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 include/common.h      | 12 ------------
 include/linux/align.h | 11 +++++++++++
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/include/common.h b/include/common.h
index fb8931c51eb9..571f46fd0bc1 100644
--- a/include/common.h
+++ b/include/common.h
@@ -95,18 +95,6 @@ enum autoboot_state do_autoboot_countdown(void);
 
 void __noreturn start_barebox(void);
 void shutdown_barebox(void);
-
-/*
- * The STACK_ALIGN_ARRAY macro is used to allocate a buffer on the stack that
- * meets a minimum alignment requirement.
- *
- * Note that the size parameter is the number of array elements to allocate,
- * not the number of bytes.
- */
-#define STACK_ALIGN_ARRAY(type, name, size, align)		\
-	char __##name[sizeof(type) * (size) + (align) - 1];	\
-	type *name = (type *)ALIGN((uintptr_t)__##name, align)
-
 int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
 		char **sourcefile, char **destfile, int *swab);
 int memcpy_parse_options(int argc, char *argv[], int *sourcefd,
diff --git a/include/linux/align.h b/include/linux/align.h
index 8df1b3dcd749..4b373bf73d5b 100644
--- a/include/linux/align.h
+++ b/include/linux/align.h
@@ -10,4 +10,15 @@
 #define PTR_IS_ALIGNED(x, a)	IS_ALIGNED((unsigned long)(x), (a))
 #define IS_ALIGNED(x, a)		(((x) & ((typeof(x))(a) - 1)) == 0)
 
+/*
+ * The STACK_ALIGN_ARRAY macro is used to allocate a buffer on the stack that
+ * meets a minimum alignment requirement.
+ *
+ * Note that the size parameter is the number of array elements to allocate,
+ * not the number of bytes.
+ */
+#define STACK_ALIGN_ARRAY(type, name, size, align)		\
+	char __##name[sizeof(type) * (size) + (align) - 1];	\
+	type *name = (type *)ALIGN((unsigned long)__##name, align)
+
 #endif
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux