Skip to content

Commit 97a1fcb

Browse files
cfd-36Linus Torvalds
authored andcommitted
uml: more __init annotations
2.6.23-rc1 turned up another batch of references from non-__init code to __init code. In most cases, these were missing __init annotations. In one case (os_drop_memory), the annotation was present but wrong. init_maps is __init, but for some reason was being very careful about the mechanism by which it allocated memory, checking whether it was OK to use kmalloc (at this point in the boot, it definitely isn't) and using either alloc_bootmem_low_pages or kmalloc/vmalloc. So, the kmalloc/vmalloc code is removed. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent da3e30e commit 97a1fcb

6 files changed

Lines changed: 12 additions & 17 deletions

File tree

‎arch/um/drivers/mconsole_kern.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ static struct mc_device mem_mc = {
499499
.remove = mem_remove,
500500
};
501501

502-
static int mem_mc_init(void)
502+
static int __init mem_mc_init(void)
503503
{
504504
if(can_drop_memory())
505505
mconsole_register_dev(&mem_mc);
@@ -798,7 +798,7 @@ void mconsole_stack(struct mc_request *req)
798798
*/
799799
static char *notify_socket = NULL;
800800

801-
static int mconsole_init(void)
801+
static int __init mconsole_init(void)
802802
{
803803
/* long to avoid size mismatch warnings from gcc */
804804
long sock;

‎arch/um/drivers/net_kern.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ static int eth_setup_common(char *str, int index)
623623
return found;
624624
}
625625

626-
static int eth_setup(char *str)
626+
static int __init eth_setup(char *str)
627627
{
628628
struct eth_init *new;
629629
char *error;

‎arch/um/kernel/mem.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static void setup_highmem(unsigned long highmem_start,
6262
}
6363
#endif
6464

65-
void mem_init(void)
65+
void __init mem_init(void)
6666
{
6767
/* clear the zero-page */
6868
memset((void *) empty_zero_page, 0, PAGE_SIZE);

‎arch/um/kernel/physmem.c‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ unsigned long high_physmem;
2828

2929
extern unsigned long long physmem_size;
3030

31-
int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
31+
int __init init_maps(unsigned long physmem, unsigned long iomem,
32+
unsigned long highmem)
3233
{
3334
struct page *p, *map;
3435
unsigned long phys_len, phys_pages, highmem_len, highmem_pages;
@@ -47,13 +48,7 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
4748
total_pages = phys_pages + iomem_pages + highmem_pages;
4849
total_len = phys_len + iomem_len + highmem_len;
4950

50-
if(kmalloc_ok){
51-
map = kmalloc(total_len, GFP_KERNEL);
52-
if(map == NULL)
53-
map = vmalloc(total_len);
54-
}
55-
else map = alloc_bootmem_low_pages(total_len);
56-
51+
map = alloc_bootmem_low_pages(total_len);
5752
if(map == NULL)
5853
return -ENOMEM;
5954

@@ -98,8 +93,8 @@ void map_memory(unsigned long virt, unsigned long phys, unsigned long len,
9893

9994
extern int __syscall_stub_start;
10095

101-
void setup_physmem(unsigned long start, unsigned long reserve_end,
102-
unsigned long len, unsigned long long highmem)
96+
void __init setup_physmem(unsigned long start, unsigned long reserve_end,
97+
unsigned long len, unsigned long long highmem)
10398
{
10499
unsigned long reserve = reserve_end - start;
105100
int pfn = PFN_UP(__pa(reserve_end));

‎arch/um/kernel/skas/process.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void init_idle_skas(void)
145145

146146
extern void start_kernel(void);
147147

148-
static int start_kernel_proc(void *unused)
148+
static int __init start_kernel_proc(void *unused)
149149
{
150150
int pid;
151151

@@ -165,7 +165,7 @@ extern int userspace_pid[];
165165

166166
extern char cpu0_irqstack[];
167167

168-
int start_uml_skas(void)
168+
int __init start_uml_skas(void)
169169
{
170170
stack_protections((unsigned long) &cpu0_irqstack);
171171
set_sigstack(cpu0_irqstack, THREAD_SIZE);

‎arch/um/os-Linux/process.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ int os_unmap_memory(void *addr, int len)
194194
#define MADV_REMOVE KERNEL_MADV_REMOVE
195195
#endif
196196

197-
int __init os_drop_memory(void *addr, int length)
197+
int os_drop_memory(void *addr, int length)
198198
{
199199
int err;
200200

0 commit comments

Comments
 (0)