From: Rosen Penev <rosenp@gmail.com>
To: linux-mm@kvack.org
Cc: Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
linux-kernel@vger.kernel.org (open list),
llvm@lists.linux.dev (open list:CLANG/LLVM BUILD
SUPPORT:Keyword:\b(?i:clang|llvm)\b)
Subject: [PATCH] mm: move phys_mem_access_prot_allowed to header
Date: Mon, 4 May 2026 18:01:12 -0700 [thread overview]
Message-ID: <20260505010112.645361-1-rosenp@gmail.com> (raw)
phys_mem_access_prot_allowed is only implemented for X86. For others, it
returns 1. Move it to header to avoid using __weak.
Fixes compilation with make LLVM=1 ARCH=mips
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/char/mem.c | 6 ------
include/linux/pgtable.h | 8 ++++++++
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 5fd421e48c04..ae8449674f46 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -239,12 +239,6 @@ static ssize_t write_mem(struct file *file, const char __user *buf,
return written;
}
-int __weak phys_mem_access_prot_allowed(struct file *file,
- unsigned long pfn, unsigned long size, pgprot_t *vma_prot)
-{
- return 1;
-}
-
#ifndef __HAVE_PHYS_MEM_ACCESS_PROT
/*
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index cdd68ed3ae1a..72a7fa388e88 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -2154,8 +2154,16 @@ static inline int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
#endif
struct file;
+#ifdef CONFIG_X86
int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t *vma_prot);
+#else
+static inline
+int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
+ unsigned long size, pgprot_t *vma_prot) {
+ return 1;
+}
+#endif
#ifndef CONFIG_X86_ESPFIX64
static inline void init_espfix_bsp(void) { }
--
2.54.0
next reply other threads:[~2026-05-05 1:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 1:01 Rosen Penev [this message]
2026-05-05 5:54 ` [PATCH] mm: move phys_mem_access_prot_allowed to header Arnd Bergmann
2026-05-05 7:47 ` Rosen Penev
2026-05-05 8:29 ` Arnd Bergmann
2026-05-05 8:54 ` Rosen Penev
2026-05-05 9:22 ` Arnd Bergmann
2026-05-05 22:36 ` Rosen Penev
2026-05-06 5:48 ` Nathan Chancellor
2026-05-06 6:02 ` Rosen Penev
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=20260505010112.645361-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=david@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=justinstitt@google.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mhocko@suse.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox