History

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>

Mike Rapoport (IBM) committed 2 years ago

Commit e8dbc6a1 parent 38762152 files · +3 −24Browse files

Unified · Split

2 files
  1. arch/sparc/include/asm/pgtable_32.h +2 −0
  2. arch/sparc/kernel/module.c +1 −24
arch/sparc/include/asm/pgtable_32.h+2−0
@@ -432,6 +432,8 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma, · 431 unmodified lines
432 432
433#define VMALLOC_START _AC(0xfe600000,UL)433#define VMALLOC_START _AC(0xfe600000,UL)
434#define VMALLOC_END _AC(0xffc00000,UL)434#define VMALLOC_END _AC(0xffc00000,UL)
435#define MODULES_VADDR VMALLOC_START
436#define MODULES_END VMALLOC_END
435 437
436/* We provide our own get_unmapped_area to cope with VA holes for userland */438/* We provide our own get_unmapped_area to cope with VA holes for userland */
437#define HAVE_ARCH_UNMAPPED_AREA439#define HAVE_ARCH_UNMAPPED_AREA
arch/sparc/kernel/module.c+1−24
@@ -21,35 +21,12 @@ · 20 unmodified lines
21 21
22#include "entry.h"22#include "entry.h"
23 23
24#ifdef CONFIG_SPARC6424void *module_alloc(unsigned long size)
25
26#include <linux/jump_label.h>
27
28static void *module_map(unsigned long size)
29{25{
30 if (PAGE_ALIGN(size) > MODULES_LEN)
31 return NULL;
32 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,26 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
33 GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,27 GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
34 __builtin_return_address(0));28 __builtin_return_address(0));
35}29}
36#else
37static void *module_map(unsigned long size)
38{
39 return vmalloc(size);
40}
41#endif /* CONFIG_SPARC64 */
42
43void *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}
53 30
54/* Make generic code ignore STT_REGISTER dummy undefined symbols. */31/* Make generic code ignore STT_REGISTER dummy undefined symbols. */
55int module_frob_arch_sections(Elf_Ehdr *hdr,32int module_frob_arch_sections(Elf_Ehdr *hdr,