[PATCH 1/5] include: move PAGE_ definitions into linux/pagemap.h
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Sep 11 08:08:56 PDT 2023
<common.h> is a fat header and we shouldn't need to include it just to
get a definition for PAGE_SIZE. In Linux PAGE_SIZE is defined per
architecture, but in barebox we only have 4K pages so far, so let's move
it into <linux/pagemap.h>.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
include/common.h | 6 +-----
include/linux/pagemap.h | 8 +++++++-
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/common.h b/include/common.h
index cf3e0447a09a..b7b4d9e35094 100644
--- a/include/common.h
+++ b/include/common.h
@@ -16,6 +16,7 @@
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
+#include <linux/pagemap.h>
#include <asm/common.h>
#include <asm/io.h>
#include <linux/printk.h>
@@ -105,11 +106,6 @@ void shutdown_barebox(void);
char __##name[sizeof(type) * (size) + (align) - 1]; \
type *name = (type *)ALIGN((uintptr_t)__##name, align)
-#define PAGE_SIZE 4096
-#define PAGE_SHIFT 12
-#define PAGE_ALIGN(s) ALIGN(s, PAGE_SIZE)
-#define PAGE_ALIGN_DOWN(x) ALIGN_DOWN(x, PAGE_SIZE)
-
int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
char **sourcefile, char **destfile, int *swab);
int memcpy_parse_options(int argc, char *argv[], int *sourcefd,
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 20c38a0b8912..01cbfc17c57b 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -3,11 +3,17 @@
#ifndef _LINUX_PAGEMAP_H
#define _LINUX_PAGEMAP_H
+#include <linux/kernel.h>
+
/*
* Copyright 1995 Linus Torvalds
*/
-#include <common.h>
+
+#define PAGE_SIZE 4096
+#define PAGE_SHIFT 12
+#define PAGE_ALIGN(s) ALIGN(s, PAGE_SIZE)
+#define PAGE_ALIGN_DOWN(x) ALIGN_DOWN(x, PAGE_SIZE)
#define PAGE_CACHE_SHIFT PAGE_SHIFT
#define PAGE_CACHE_SIZE PAGE_SIZE
--
2.39.2
More information about the barebox
mailing list