[PATCH 5/5] include: move ARRAY_AND_SIZE to <linux/kernel.h>

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

 



Linux defines this macro at multiple places. We define it once, but in
<common.h>, which is a bit heavy weight. Move it next to the
ARRAY_SIZE() definition.

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

diff --git a/include/common.h b/include/common.h
index e37630243e73..4167d4676e50 100644
--- a/include/common.h
+++ b/include/common.h
@@ -88,8 +88,6 @@ enum autoboot_state do_autoboot_countdown(void);
 void __noreturn start_barebox(void);
 void shutdown_barebox(void);
 
-#define ARRAY_AND_SIZE(x)	(x), ARRAY_SIZE(x)
-
 /*
  * The STACK_ALIGN_ARRAY macro is used to allocate a buffer on the stack that
  * meets a minimum alignment requirement.
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 9ccdd60224dd..4483d33e65bb 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -15,6 +15,7 @@
 #define IS_ALIGNED(x, a)		(((x) & ((typeof(x))(a) - 1)) == 0)
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
+#define ARRAY_AND_SIZE(x)	(x), ARRAY_SIZE(x)
 
 /*
  * This looks more complex than it should be. But we need to
diff --git a/scripts/include/linux/kernel.h b/scripts/include/linux/kernel.h
index dc2e64e16413..f3083ff3545d 100644
--- a/scripts/include/linux/kernel.h
+++ b/scripts/include/linux/kernel.h
@@ -9,6 +9,7 @@
 #define __ALIGN_MASK(x, mask)	(((x) + (mask)) & ~(mask))
 #define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a) - 1)
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define ARRAY_AND_SIZE(x)	(x), ARRAY_SIZE(x)
 
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



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

  Powered by Linux