From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 5/5] include: move ARRAY_AND_SIZE to <linux/kernel.h>
Date: Sat, 30 Oct 2021 16:17:39 +0200 [thread overview]
Message-ID: <20211030141739.2207431-5-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20211030141739.2207431-1-a.fatoum@pengutronix.de>
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@pengutronix.de>
---
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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-10-30 14:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-30 14:17 [PATCH 1/5] include: <linux/bitops.h>: discard left-over hweight code Ahmad Fatoum
2021-10-30 14:17 ` [PATCH 2/5] scripts: <linux/bitops.h>: fix references to undefined __BITS_PER_LONG Ahmad Fatoum
2021-10-30 14:17 ` [PATCH 3/5] include: add dedicated header for printf/printk Ahmad Fatoum
2021-10-30 14:17 ` [PATCH 4/5] include: <asm-generic/bug.h>: make self-contained Ahmad Fatoum
2021-10-30 14:17 ` Ahmad Fatoum [this message]
2021-11-01 9:08 ` [PATCH 1/5] include: <linux/bitops.h>: discard left-over hweight code Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211030141739.2207431-5-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox