]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
riscv: move kaslr_offset() to page.h as a static inline function
authorAustin Kim <austin.kim@lge.com>
Sun, 5 Apr 2026 00:42:40 +0000 (18:42 -0600)
committerPaul Walmsley <pjw@kernel.org>
Sun, 5 Apr 2026 00:42:40 +0000 (18:42 -0600)
The kaslr_offset() function is a simple accessor that returns
kernel_map.virt_offset. This commit change also ensures that kaslr_offset()
is consistently available across various kernel configurations without
requiring explicit linkage to mm/init.c.

Signed-off-by: Austin Kim <austin.kim@lge.com>
Link: https://patch.msgid.link/aYwJ76yHaMbbQVJA@adminpc-PowerEdge-R7525
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/include/asm/page.h
arch/riscv/mm/init.c

index 187aad0a7b03e0d799cf5657e02dd8b4ba7e344f..813b6da57399001ab45778dc1a3a78c68b7894ee 100644 (file)
@@ -190,7 +190,10 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x);
 
 #define sym_to_pfn(x)           __phys_to_pfn(__pa_symbol(x))
 
-unsigned long kaslr_offset(void);
+static inline unsigned long kaslr_offset(void)
+{
+       return kernel_map.virt_offset;
+}
 
 static __always_inline void *pfn_to_kaddr(unsigned long pfn)
 {
index 811e03786c560f128c4d556d7c3e43617370dd19..257df6bd258fa61644aed43a956d80e98fddd8f9 100644 (file)
@@ -1078,11 +1078,6 @@ static int __init print_nokaslr(char *p)
        return 0;
 }
 early_param("nokaslr", print_nokaslr);
-
-unsigned long kaslr_offset(void)
-{
-       return kernel_map.virt_offset;
-}
 #endif
 
 asmlinkage void __init setup_vm(uintptr_t dtb_pa)