]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc: simplify module_alloc()
authorMike Rapoport (IBM) <rppt@kernel.org>
Sun, 5 May 2024 16:06:16 +0000 (19:06 +0300)
committerLuis Chamberlain <mcgrof@kernel.org>
Tue, 14 May 2024 07:31:43 +0000 (00:31 -0700)
Define MODULES_VADDR and MODULES_END as VMALLOC_START and VMALLOC_END
for 32-bit and reduce module_alloc() to

__vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, ...)

as with the new defines the allocations becomes identical for both 32
and 64 bits.

While on it, drop unused include of <linux/jump_label.h>

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
arch/sparc/include/asm/pgtable_32.h
arch/sparc/kernel/module.c

index 9e85d57ac3f2e2a4b85223a575ae187e63bd9cfb..62bcafe38b1f6f9a2a66a45784cb7854e4dd5445 100644 (file)
@@ -432,6 +432,8 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
 
 #define VMALLOC_START           _AC(0xfe600000,UL)
 #define VMALLOC_END             _AC(0xffc00000,UL)
+#define MODULES_VADDR           VMALLOC_START
+#define MODULES_END             VMALLOC_END
 
 /* We provide our own get_unmapped_area to cope with VA holes for userland */
 #define HAVE_ARCH_UNMAPPED_AREA
index 66c45a2764bc893e204cadd120338613c7bfe63d..d37adb2a0b54f73b7901c53378bc049766efa3f3 100644 (file)
 
 #include "entry.h"
 
-#ifdef CONFIG_SPARC64
-
-#include <linux/jump_label.h>
-
-static void *module_map(unsigned long size)
+void *module_alloc(unsigned long size)
 {
-       if (PAGE_ALIGN(size) > MODULES_LEN)
-               return NULL;
        return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
                                GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
                                __builtin_return_address(0));
 }
-#else
-static void *module_map(unsigned long size)
-{
-       return vmalloc(size);
-}
-#endif /* CONFIG_SPARC64 */
-
-void *module_alloc(unsigned long size)
-{
-       void *ret;
-
-       ret = module_map(size);
-       if (ret)
-               memset(ret, 0, size);
-
-       return ret;
-}
 
 /* Make generic code ignore STT_REGISTER dummy undefined symbols.  */
 int module_frob_arch_sections(Elf_Ehdr *hdr,