From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] common: clarify global.of.kernel.add_machine_compatible
Date: Mon, 14 Apr 2025 08:22:57 +0200 [thread overview]
Message-ID: <20250414062257.2721241-1-a.fatoum@pengutronix.de> (raw)
While the name hints at the compatible being added has something to do
with the kernel, the magicvar help text doesn't.
Point that out and make the functionality dependent on CONFIG_OFTREE.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/misc.c | 7 +++++--
include/barebox-info.h | 5 +++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/common/misc.c b/common/misc.c
index 0c883b76c1c2..375fbbb199c7 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -148,7 +148,6 @@ BAREBOX_MAGICVAR(global.model, "Product name of this hardware");
static char *hostname;
static char *serial_number;
-static char *of_machine_compatible;
/* Note that HOST_NAME_MAX is 64 on Linux */
#define BAREBOX_HOST_NAME_MAX 64
@@ -260,6 +259,9 @@ const char *barebox_get_serial_number(void)
BAREBOX_MAGICVAR(global.serial_number, "Board serial number");
+#ifdef CONFIG_OFTREE
+static char *of_machine_compatible;
+
void barebox_set_of_machine_compatible(const char *__compatible)
{
free(of_machine_compatible);
@@ -282,7 +284,8 @@ static int of_kernel_init(void)
}
device_initcall(of_kernel_init);
-BAREBOX_MAGICVAR(global.of.kernel.add_machine_compatible, "Additional machine/board compatible");
+BAREBOX_MAGICVAR(global.of.kernel.add_machine_compatible, "Extra machine/board compatible to prepend to kernel DT compatible");
+#endif
static void __noreturn do_panic(bool stacktrace, const char *fmt, va_list ap)
{
diff --git a/include/barebox-info.h b/include/barebox-info.h
index 446cd0dbaf93..ab46c69e9eb5 100644
--- a/include/barebox-info.h
+++ b/include/barebox-info.h
@@ -25,7 +25,12 @@ bool barebox_hostname_is_valid(const char *s);
const char *barebox_get_serial_number(void);
void barebox_set_serial_number(const char *);
+#ifdef CONFIG_OFTREE
void barebox_set_of_machine_compatible(const char *);
const char *barebox_get_of_machine_compatible(void);
+#else
+static inline void barebox_set_of_machine_compatible(const char *) {return NULL; }
+static inline const char *barebox_get_of_machine_compatible(void) { return NULL; }
+#endif
#endif
--
2.39.5
next reply other threads:[~2025-04-14 6:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-14 6:22 Ahmad Fatoum [this message]
2025-04-14 8:58 ` 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=20250414062257.2721241-1-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