mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] include: gfp: move flags into <linux/gfp.h>
@ 2024-07-01  7:12 Ahmad Fatoum
  2024-07-01  7:12 ` [PATCH 2/2] include: common.h: move barebox version/info declarations to new header Ahmad Fatoum
  2024-07-01 10:09 ` [PATCH 1/2] include: gfp: move flags into <linux/gfp.h> Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-07-01  7:12 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The GFP arguments are unused in barebox and are only used to reduce
churn when porting kernel code. To make it easier to port code using
them in headers, move them to <linux/gfp.h> like Linux does.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/linux/gfp.h  | 12 ++++++++++++
 include/linux/slab.h |  7 +------
 2 files changed, 13 insertions(+), 6 deletions(-)
 create mode 100644 include/linux/gfp.h

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
new file mode 100644
index 000000000000..799c2e461278
--- /dev/null
+++ b/include/linux/gfp.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _LINUX_GFP_H
+#define _LINUX_GFP_H
+
+/* unused in barebox, just bogus values */
+#define GFP_KERNEL	0
+#define GFP_NOFS	0
+#define GFP_USER	0
+#define __GFP_NOWARN	0
+
+#endif
diff --git a/include/linux/slab.h b/include/linux/slab.h
index eba3593d758a..a63aad1c348c 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -6,6 +6,7 @@
 #include <dma.h>
 #include <linux/overflow.h>
 #include <linux/string.h>
+#include <linux/gfp.h>
 
 #define SLAB_CONSISTENCY_CHECKS	0
 #define SLAB_RED_ZONE		0
@@ -25,12 +26,6 @@
 #define SLAB_RECLAIM_ACCOUNT	0
 #define SLAB_TEMPORARY		0
 
-/* unused in barebox, just bogus values */
-#define GFP_KERNEL	0
-#define GFP_NOFS	0
-#define GFP_USER	0
-#define __GFP_NOWARN	0
-
 static inline void *kmalloc(size_t size, gfp_t flags)
 {
 	return dma_alloc(size);
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] include: common.h: move barebox version/info declarations to new header
  2024-07-01  7:12 [PATCH 1/2] include: gfp: move flags into <linux/gfp.h> Ahmad Fatoum
@ 2024-07-01  7:12 ` Ahmad Fatoum
  2024-07-01 10:09 ` [PATCH 1/2] include: gfp: move flags into <linux/gfp.h> Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-07-01  7:12 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] include: gfp: move flags into <linux/gfp.h>
  2024-07-01  7:12 [PATCH 1/2] include: gfp: move flags into <linux/gfp.h> Ahmad Fatoum
  2024-07-01  7:12 ` [PATCH 2/2] include: common.h: move barebox version/info declarations to new header Ahmad Fatoum
@ 2024-07-01 10:09 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-07-01 10:09 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Mon, 01 Jul 2024 09:12:22 +0200, Ahmad Fatoum wrote:
> The GFP arguments are unused in barebox and are only used to reduce
> churn when porting kernel code. To make it easier to port code using
> them in headers, move them to <linux/gfp.h> like Linux does.
> 
> 

Applied, thanks!

[1/2] include: gfp: move flags into <linux/gfp.h>
      https://git.pengutronix.de/cgit/barebox/commit/?id=c8f11ea0b782 (link may not be stable)
[2/2] include: common.h: move barebox version/info declarations to new header
      https://git.pengutronix.de/cgit/barebox/commit/?id=d0465fc42387 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-01 10:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-01  7:12 [PATCH 1/2] include: gfp: move flags into <linux/gfp.h> Ahmad Fatoum
2024-07-01  7:12 ` [PATCH 2/2] include: common.h: move barebox version/info declarations to new header Ahmad Fatoum
2024-07-01 10:09 ` [PATCH 1/2] include: gfp: move flags into <linux/gfp.h> Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox