* [PATCH] common: clarify global.of.kernel.add_machine_compatible
@ 2025-04-14 6:22 Ahmad Fatoum
2025-04-14 8:58 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-04-14 6:22 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-14 9:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-14 6:22 [PATCH] common: clarify global.of.kernel.add_machine_compatible Ahmad Fatoum
2025-04-14 8:58 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox