[PATCH 1/2] include: gfp: move flags into <linux/gfp.h>

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jul 1 00:12:22 PDT 2024


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




More information about the barebox mailing list