public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: move phys_mem_access_prot_allowed to header
@ 2026-05-05  1:01 Rosen Penev
  2026-05-05  5:54 ` Arnd Bergmann
  0 siblings, 1 reply; 9+ messages in thread
From: Rosen Penev @ 2026-05-05  1:01 UTC (permalink / raw)
  To: linux-mm
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Andrew Morton,
	David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
	Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-05-06  6:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05  1:01 [PATCH] mm: move phys_mem_access_prot_allowed to header Rosen Penev
2026-05-05  5:54 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox