Re: [PATCH 3/5] asm-generic: use asm-generic/mman-common.h on mips and xtensa

From: Richard Henderson
Date: Sat Oct 05 2024 - 13:14:14 EST


On 9/25/24 14:06, Arnd Bergmann wrote:
From: Arnd Bergmann <arnd@xxxxxxxx>

mips and xtensa have almost the same asm/mman.h, aside from an
unintentional difference in MAP_UNINITIALIZED that has no effect in
practice.

Now that the MAP_* flags are moved out of asm-generic/mman-common.h,
the only difference from the its contents and the mips/xtensa version
is the PROT_SEM definition that is one bit off from the rest.

Make the generic PROT_SEM definition conditional on it already being
defined and then include that header from both architectures, to
remove the bulk of the contents.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
arch/alpha/include/uapi/asm/mman.h | 2 +
arch/mips/include/uapi/asm/mman.h | 65 +------------------------
arch/parisc/include/uapi/asm/mman.h | 3 ++
arch/xtensa/include/uapi/asm/mman.h | 66 +-------------------------
include/uapi/asm-generic/mman-common.h | 2 +
5 files changed, 9 insertions(+), 129 deletions(-)

diff --git a/arch/alpha/include/uapi/asm/mman.h b/arch/alpha/include/uapi/asm/mman.h
index 8946a13ce858..1f1c03c047ce 100644
--- a/arch/alpha/include/uapi/asm/mman.h
+++ b/arch/alpha/include/uapi/asm/mman.h
@@ -5,7 +5,9 @@
#define PROT_READ 0x1 /* page can be read */
#define PROT_WRITE 0x2 /* page can be written */
#define PROT_EXEC 0x4 /* page can be executed */
+#ifndef PROT_SEM /* different on mips and xtensa */
#define PROT_SEM 0x8 /* page may be used for atomic ops */
+#endif

Surely not conditional within arch/alpha/...

--- a/include/uapi/asm-generic/mman-common.h
+++ b/include/uapi/asm-generic/mman-common.h
@@ -10,7 +10,9 @@
#define PROT_READ 0x1 /* page can be read */
#define PROT_WRITE 0x2 /* page can be written */
#define PROT_EXEC 0x4 /* page can be executed */
+#ifndef PROT_SEM /* different on mips and xtensa */
#define PROT_SEM 0x8 /* page may be used for atomic ops */
+#endif
... only conditional here in asm-generic.


r~