[PATCH 2/2] include: common.h: move barebox version/info declarations to new header
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Jul 1 00:12:23 PDT 2024
Including all of common.h just to get the barebox version is overkill.
Let's move the version/info declarations into a separate header that can
be used instead.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
include/barebox-info.h | 31 +++++++++++++++++++++++++++++++
include/common.h | 23 +----------------------
2 files changed, 32 insertions(+), 22 deletions(-)
create mode 100644 include/barebox-info.h
diff --git a/include/barebox-info.h b/include/barebox-info.h
new file mode 100644
index 000000000000..446cd0dbaf93
--- /dev/null
+++ b/include/barebox-info.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef __BAREBOX_INFO_H__
+#define __BAREBOX_INFO_H__
+
+#include <linux/types.h>
+
+extern const char version_string[];
+extern const char release_string[];
+extern const char buildsystem_version_string[];
+
+#ifdef CONFIG_BANNER
+void barebox_banner(void);
+#else
+static inline void barebox_banner(void) {}
+#endif
+
+const char *barebox_get_model(void);
+void barebox_set_model(const char *);
+const char *barebox_get_hostname(void);
+void barebox_set_hostname(const char *);
+void barebox_set_hostname_no_overwrite(const char *);
+bool barebox_hostname_is_valid(const char *s);
+
+const char *barebox_get_serial_number(void);
+void barebox_set_serial_number(const char *);
+
+void barebox_set_of_machine_compatible(const char *);
+const char *barebox_get_of_machine_compatible(void);
+
+#endif
diff --git a/include/common.h b/include/common.h
index d7b5261bc921..fb8931c51eb9 100644
--- a/include/common.h
+++ b/include/common.h
@@ -20,6 +20,7 @@
#include <asm/common.h>
#include <asm/io.h>
#include <linux/printk.h>
+#include <barebox-info.h>
/*
* sanity check. The Linux Kernel defines only one of __LITTLE_ENDIAN and
@@ -113,26 +114,4 @@ int memcpy_parse_options(int argc, char *argv[], int *sourcefd,
int rwsize, int destmode);
#define RW_BUF_SIZE (unsigned)4096
-extern const char version_string[];
-extern const char release_string[];
-extern const char buildsystem_version_string[];
-#ifdef CONFIG_BANNER
-void barebox_banner(void);
-#else
-static inline void barebox_banner(void) {}
-#endif
-
-const char *barebox_get_model(void);
-void barebox_set_model(const char *);
-const char *barebox_get_hostname(void);
-void barebox_set_hostname(const char *);
-void barebox_set_hostname_no_overwrite(const char *);
-bool barebox_hostname_is_valid(const char *s);
-
-const char *barebox_get_serial_number(void);
-void barebox_set_serial_number(const char *);
-
-void barebox_set_of_machine_compatible(const char *);
-const char *barebox_get_of_machine_compatible(void);
-
#endif /* __COMMON_H_ */
--
2.39.2
More information about the barebox
mailing list