Skip to content

Commit e8dbc6a

Browse files
rpptmcgrof
authored andcommitted
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>
1 parent 3876215 commit e8dbc6a

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

arch/sparc/include/asm/pgtable_32.h

+2
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
432432

433433
#define VMALLOC_START _AC(0xfe600000,UL)
434434
#define VMALLOC_END _AC(0xffc00000,UL)
435+
#define MODULES_VADDR VMALLOC_START
436+
#define MODULES_END VMALLOC_END
435437

436438
/* We provide our own get_unmapped_area to cope with VA holes for userland */
437439
#define HAVE_ARCH_UNMAPPED_AREA

arch/sparc/kernel/module.c

+1-24
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,12 @@
2121

2222
#include "entry.h"
2323

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)
2925
{
30-
if (PAGE_ALIGN(size) > MODULES_LEN)
31-
return NULL;
3226
return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
3327
GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
3428
__builtin_return_address(0));
3529
}
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-
}
5330

5431
/* Make generic code ignore STT_REGISTER dummy undefined symbols. */
5532
int module_frob_arch_sections(Elf_Ehdr *hdr,

0 commit comments

Comments
 (0)