All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: patches@armlinux.org.uk
Cc: linux-kernel@vger.kernel.org,
	Russell King <linux@armlinux.org.uk>,
	Masahiro Yamada <masahiroy@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: make <linux/uaccess.h> self-contained for ARM
Date: Wed, 27 Sep 2023 02:22:53 +0900	[thread overview]
Message-ID: <20230926172253.73204-1-masahiroy@kernel.org> (raw)

When I compiled the following code for ARM, I encountered numerous
errors.

[Test Code]

    #include <linux/compiler.h>
    #include <linux/uaccess.h>

    int foo(int *x, int __user *ptr)
    {
            return get_user(*x, ptr);
    }

To fix them, make some asm headers self-contained:

 1. In arch/arm/include/asm/traps.h, include <linux/init.h> for __init,
    and <linux/linkage.h> for asmlinkage.

 2. In arch/arm/include/asm/domain.h, include <linux/thread_info.h>
    for current_thread_info().

 3. In arch/arm/include/asm/uaccess.h, include <linux/kernel.h> for
    might_fault().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

KernelVersion: v6.6-rc1

 arch/arm/include/asm/domain.h  | 2 +-
 arch/arm/include/asm/traps.h   | 2 ++
 arch/arm/include/asm/uaccess.h | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
index 41536feb4392..d48859fdf32c 100644
--- a/arch/arm/include/asm/domain.h
+++ b/arch/arm/include/asm/domain.h
@@ -8,8 +8,8 @@
 #define __ASM_PROC_DOMAIN_H
 
 #ifndef __ASSEMBLY__
+#include <linux/thread_info.h>
 #include <asm/barrier.h>
-#include <asm/thread_info.h>
 #endif
 
 /*
diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h
index 0aaefe3e1700..d44df9eac170 100644
--- a/arch/arm/include/asm/traps.h
+++ b/arch/arm/include/asm/traps.h
@@ -2,6 +2,8 @@
 #ifndef _ASMARM_TRAP_H
 #define _ASMARM_TRAP_H
 
+#include <linux/init.h>
+#include <linux/linkage.h>
 #include <linux/list.h>
 
 struct pt_regs;
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index bb5c81823117..6a2cc57f015a 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -8,6 +8,7 @@
 /*
  * User space memory access functions
  */
+#include <linux/kernel.h>
 #include <linux/string.h>
 #include <asm/page.h>
 #include <asm/domain.h>
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Masahiro Yamada <masahiroy@kernel.org>
To: patches@armlinux.org.uk
Cc: linux-kernel@vger.kernel.org,
	Russell King <linux@armlinux.org.uk>,
	Masahiro Yamada <masahiroy@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: make <linux/uaccess.h> self-contained for ARM
Date: Wed, 27 Sep 2023 02:22:53 +0900	[thread overview]
Message-ID: <20230926172253.73204-1-masahiroy@kernel.org> (raw)

When I compiled the following code for ARM, I encountered numerous
errors.

[Test Code]

    #include <linux/compiler.h>
    #include <linux/uaccess.h>

    int foo(int *x, int __user *ptr)
    {
            return get_user(*x, ptr);
    }

To fix them, make some asm headers self-contained:

 1. In arch/arm/include/asm/traps.h, include <linux/init.h> for __init,
    and <linux/linkage.h> for asmlinkage.

 2. In arch/arm/include/asm/domain.h, include <linux/thread_info.h>
    for current_thread_info().

 3. In arch/arm/include/asm/uaccess.h, include <linux/kernel.h> for
    might_fault().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

KernelVersion: v6.6-rc1

 arch/arm/include/asm/domain.h  | 2 +-
 arch/arm/include/asm/traps.h   | 2 ++
 arch/arm/include/asm/uaccess.h | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
index 41536feb4392..d48859fdf32c 100644
--- a/arch/arm/include/asm/domain.h
+++ b/arch/arm/include/asm/domain.h
@@ -8,8 +8,8 @@
 #define __ASM_PROC_DOMAIN_H
 
 #ifndef __ASSEMBLY__
+#include <linux/thread_info.h>
 #include <asm/barrier.h>
-#include <asm/thread_info.h>
 #endif
 
 /*
diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h
index 0aaefe3e1700..d44df9eac170 100644
--- a/arch/arm/include/asm/traps.h
+++ b/arch/arm/include/asm/traps.h
@@ -2,6 +2,8 @@
 #ifndef _ASMARM_TRAP_H
 #define _ASMARM_TRAP_H
 
+#include <linux/init.h>
+#include <linux/linkage.h>
 #include <linux/list.h>
 
 struct pt_regs;
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index bb5c81823117..6a2cc57f015a 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -8,6 +8,7 @@
 /*
  * User space memory access functions
  */
+#include <linux/kernel.h>
 #include <linux/string.h>
 #include <asm/page.h>
 #include <asm/domain.h>
-- 
2.39.2


             reply	other threads:[~2023-09-26 17:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26 17:22 Masahiro Yamada [this message]
2023-09-26 17:22 ` [PATCH] ARM: make <linux/uaccess.h> self-contained for ARM Masahiro Yamada
2023-09-26 17:28 ` Russell King (Oracle)
2023-09-26 17:28   ` Russell King (Oracle)
  -- strict thread matches above, loose matches on Subject: below --
2023-09-27 17:06 Masahiro Yamada
2023-09-27 17:06 ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230926172253.73204-1-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=patches@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.