lkml.org 
[lkml]   [2026]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm: move phys_mem_access_prot_allowed to header
Date
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

\
 
 \ /
  Last update: 2026-05-05 03:02    [W:0.092 / U:5.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog