riscv: move kaslr_offset() to page.h as a static inline function
PATCH 1/2 riscv: move kaslr_offset() to page.h as a static inline function
From: Austin Kim <[email protected]>
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 <[email protected]>
--- arch/riscv/include/asm/page.h | 5 ++++- arch/riscv/mm/init.c | 5 ----- 2 files changed, 4 insertions(+), 6 deletions(-)
arch/riscv/include/asm/page.h +4 -1
@@ -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) {
arch/riscv/mm/init.c +0 -5
@@ -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)
Signature · 1 line
2.34.1
Paul Walmsley
maintainerQuoted 8 lines · Austin Kim
From: Austin Kim <[email protected]>
The
kaslr_offset()function is a simple accessor that returns kernel_map.virt_offset. This commit change also ensures thatkaslr_offset()is consistently available across various kernel configurations without requiring explicit linkage tomm/init.c.Signed-off-by Austin Kim <[email protected]>
Thanks, queued for v7.0-rc.
- Paul