Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sparc: simplify module_alloc()

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>

authored by

Mike Rapoport (IBM) and committed by
Luis Chamberlain
e8dbc6a8 38762155

+3 -24
+2
arch/sparc/include/asm/pgtable_32.h
··· 432 432 433 433 #define VMALLOC_START _AC(0xfe600000,UL) 434 434 #define VMALLOC_END _AC(0xffc00000,UL) 435 + #define MODULES_VADDR VMALLOC_START 436 + #define MODULES_END VMALLOC_END 435 437 436 438 /* We provide our own get_unmapped_area to cope with VA holes for userland */ 437 439 #define HAVE_ARCH_UNMAPPED_AREA
+1 -24
arch/sparc/kernel/module.c
··· 21 21 22 22 #include "entry.h" 23 23 24 - #ifdef CONFIG_SPARC64 25 - 26 - #include <linux/jump_label.h> 27 - 28 - static void *module_map(unsigned long size) 24 + void *module_alloc(unsigned long size) 29 25 { 30 - if (PAGE_ALIGN(size) > MODULES_LEN) 31 - return NULL; 32 26 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, 33 27 GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE, 34 28 __builtin_return_address(0)); 35 - } 36 - #else 37 - static void *module_map(unsigned long size) 38 - { 39 - return vmalloc(size); 40 - } 41 - #endif /* CONFIG_SPARC64 */ 42 - 43 - void *module_alloc(unsigned long size) 44 - { 45 - void *ret; 46 - 47 - ret = module_map(size); 48 - if (ret) 49 - memset(ret, 0, size); 50 - 51 - return ret; 52 29 } 53 30 54 31 /* Make generic code ignore STT_REGISTER dummy undefined symbols. */