Commit f71bf0ca authored by Franck Bui-Huu's avatar Franck Bui-Huu Committed by Linus Torvalds

[PATCH] bootmem: miscellaneous coding style fixes

It fixes various coding style issues, specially when spaces are useless.  For
example '*' go next to the function name.
Signed-off-by: default avatarFranck Bui-Huu <vagabon.xyz@gmail.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bbc7b92e
...@@ -38,29 +38,30 @@ typedef struct bootmem_data { ...@@ -38,29 +38,30 @@ typedef struct bootmem_data {
struct list_head list; struct list_head list;
} bootmem_data_t; } bootmem_data_t;
extern unsigned long bootmem_bootmap_pages (unsigned long); extern unsigned long bootmem_bootmap_pages(unsigned long);
extern unsigned long init_bootmem (unsigned long addr, unsigned long memend); extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
extern void free_bootmem (unsigned long addr, unsigned long size); extern void free_bootmem(unsigned long addr, unsigned long size);
extern void * __alloc_bootmem (unsigned long size, extern void *__alloc_bootmem(unsigned long size,
unsigned long align, unsigned long align,
unsigned long goal); unsigned long goal);
extern void * __alloc_bootmem_nopanic (unsigned long size, extern void *__alloc_bootmem_nopanic(unsigned long size,
unsigned long align, unsigned long align,
unsigned long goal); unsigned long goal);
extern void * __alloc_bootmem_low(unsigned long size, extern void *__alloc_bootmem_low(unsigned long size,
unsigned long align,
unsigned long goal);
extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
unsigned long size,
unsigned long align,
unsigned long goal);
extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
unsigned long size,
unsigned long align, unsigned long align,
unsigned long goal); unsigned long goal,
extern void * __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long limit);
unsigned long size,
unsigned long align,
unsigned long goal);
extern void * __alloc_bootmem_core(struct bootmem_data *bdata,
unsigned long size,
unsigned long align,
unsigned long goal,
unsigned long limit);
#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
extern void reserve_bootmem (unsigned long addr, unsigned long size); extern void reserve_bootmem(unsigned long addr, unsigned long size);
#define alloc_bootmem(x) \ #define alloc_bootmem(x) \
__alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
#define alloc_bootmem_low(x) \ #define alloc_bootmem_low(x) \
...@@ -70,22 +71,24 @@ extern void reserve_bootmem (unsigned long addr, unsigned long size); ...@@ -70,22 +71,24 @@ extern void reserve_bootmem (unsigned long addr, unsigned long size);
#define alloc_bootmem_low_pages(x) \ #define alloc_bootmem_low_pages(x) \
__alloc_bootmem_low(x, PAGE_SIZE, 0) __alloc_bootmem_low(x, PAGE_SIZE, 0)
#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
extern unsigned long free_all_bootmem (void);
extern void * __alloc_bootmem_node (pg_data_t *pgdat, extern unsigned long free_all_bootmem(void);
unsigned long size, extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
unsigned long align, extern void *__alloc_bootmem_node(pg_data_t *pgdat,
unsigned long goal); unsigned long size,
extern unsigned long init_bootmem_node (pg_data_t *pgdat, unsigned long align,
unsigned long freepfn, unsigned long goal);
unsigned long startpfn, extern unsigned long init_bootmem_node(pg_data_t *pgdat,
unsigned long endpfn); unsigned long freepfn,
extern void reserve_bootmem_node (pg_data_t *pgdat, unsigned long startpfn,
unsigned long physaddr, unsigned long endpfn);
unsigned long size); extern void reserve_bootmem_node(pg_data_t *pgdat,
extern void free_bootmem_node (pg_data_t *pgdat, unsigned long physaddr,
unsigned long addr, unsigned long size);
unsigned long size); extern void free_bootmem_node(pg_data_t *pgdat,
extern unsigned long free_all_bootmem_node (pg_data_t *pgdat); unsigned long addr,
unsigned long size);
#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
#define alloc_bootmem_node(pgdat, x) \ #define alloc_bootmem_node(pgdat, x) \
__alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
...@@ -102,19 +105,19 @@ static inline void *alloc_remap(int nid, unsigned long size) ...@@ -102,19 +105,19 @@ static inline void *alloc_remap(int nid, unsigned long size)
{ {
return NULL; return NULL;
} }
#endif #endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
extern unsigned long __meminitdata nr_kernel_pages; extern unsigned long __meminitdata nr_kernel_pages;
extern unsigned long nr_all_pages; extern unsigned long nr_all_pages;
extern void * alloc_large_system_hash(const char *tablename, extern void *alloc_large_system_hash(const char *tablename,
unsigned long bucketsize, unsigned long bucketsize,
unsigned long numentries, unsigned long numentries,
int scale, int scale,
int flags, int flags,
unsigned int *_hash_shift, unsigned int *_hash_shift,
unsigned int *_hash_mask, unsigned int *_hash_mask,
unsigned long limit); unsigned long limit);
#define HASH_HIGHMEM 0x00000001 /* Consider highmem? */ #define HASH_HIGHMEM 0x00000001 /* Consider highmem? */
#define HASH_EARLY 0x00000002 /* Allocating during early boot? */ #define HASH_EARLY 0x00000002 /* Allocating during early boot? */
......
...@@ -38,7 +38,7 @@ unsigned long saved_max_pfn; ...@@ -38,7 +38,7 @@ unsigned long saved_max_pfn;
#endif #endif
/* return the number of _pages_ that will be allocated for the boot bitmap */ /* return the number of _pages_ that will be allocated for the boot bitmap */
unsigned long __init bootmem_bootmap_pages (unsigned long pages) unsigned long __init bootmem_bootmap_pages(unsigned long pages)
{ {
unsigned long mapsize; unsigned long mapsize;
...@@ -48,12 +48,14 @@ unsigned long __init bootmem_bootmap_pages (unsigned long pages) ...@@ -48,12 +48,14 @@ unsigned long __init bootmem_bootmap_pages (unsigned long pages)
return mapsize; return mapsize;
} }
/* /*
* link bdata in order * link bdata in order
*/ */
static void __init link_bootmem(bootmem_data_t *bdata) static void __init link_bootmem(bootmem_data_t *bdata)
{ {
bootmem_data_t *ent; bootmem_data_t *ent;
if (list_empty(&bdata_list)) { if (list_empty(&bdata_list)) {
list_add(&bdata->list, &bdata_list); list_add(&bdata->list, &bdata_list);
return; return;
...@@ -66,7 +68,6 @@ static void __init link_bootmem(bootmem_data_t *bdata) ...@@ -66,7 +68,6 @@ static void __init link_bootmem(bootmem_data_t *bdata)
} }
} }
list_add_tail(&bdata->list, &bdata_list); list_add_tail(&bdata->list, &bdata_list);
return;
} }
/* /*
...@@ -85,7 +86,7 @@ static unsigned long __init get_mapsize(bootmem_data_t *bdata) ...@@ -85,7 +86,7 @@ static unsigned long __init get_mapsize(bootmem_data_t *bdata)
/* /*
* Called once to set up the allocator itself. * Called once to set up the allocator itself.
*/ */
static unsigned long __init init_bootmem_core (pg_data_t *pgdat, static unsigned long __init init_bootmem_core(pg_data_t *pgdat,
unsigned long mapstart, unsigned long start, unsigned long end) unsigned long mapstart, unsigned long start, unsigned long end)
{ {
bootmem_data_t *bdata = pgdat->bdata; bootmem_data_t *bdata = pgdat->bdata;
...@@ -185,7 +186,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size, ...@@ -185,7 +186,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size,
unsigned long i, start = 0, incr, eidx, end_pfn; unsigned long i, start = 0, incr, eidx, end_pfn;
void *ret; void *ret;
if(!size) { if (!size) {
printk("__alloc_bootmem_core(): zero-sized request\n"); printk("__alloc_bootmem_core(): zero-sized request\n");
BUG(); BUG();
} }
...@@ -234,7 +235,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size, ...@@ -234,7 +235,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size,
for (j = i + 1; j < i + areasize; ++j) { for (j = i + 1; j < i + areasize; ++j) {
if (j >= eidx) if (j >= eidx)
goto fail_block; goto fail_block;
if (test_bit (j, bdata->node_bootmem_map)) if (test_bit(j, bdata->node_bootmem_map))
goto fail_block; goto fail_block;
} }
start = i; start = i;
...@@ -262,19 +263,21 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size, ...@@ -262,19 +263,21 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size,
bdata->last_offset && bdata->last_pos+1 == start) { bdata->last_offset && bdata->last_pos+1 == start) {
offset = ALIGN(bdata->last_offset, align); offset = ALIGN(bdata->last_offset, align);
BUG_ON(offset > PAGE_SIZE); BUG_ON(offset > PAGE_SIZE);
remaining_size = PAGE_SIZE-offset; remaining_size = PAGE_SIZE - offset;
if (size < remaining_size) { if (size < remaining_size) {
areasize = 0; areasize = 0;
/* last_pos unchanged */ /* last_pos unchanged */
bdata->last_offset = offset+size; bdata->last_offset = offset + size;
ret = phys_to_virt(bdata->last_pos*PAGE_SIZE + offset + ret = phys_to_virt(bdata->last_pos * PAGE_SIZE +
bdata->node_boot_start); offset +
bdata->node_boot_start);
} else { } else {
remaining_size = size - remaining_size; remaining_size = size - remaining_size;
areasize = (remaining_size+PAGE_SIZE-1)/PAGE_SIZE; areasize = (remaining_size + PAGE_SIZE-1) / PAGE_SIZE;
ret = phys_to_virt(bdata->last_pos*PAGE_SIZE + offset + ret = phys_to_virt(bdata->last_pos * PAGE_SIZE +
bdata->node_boot_start); offset +
bdata->last_pos = start+areasize-1; bdata->node_boot_start);
bdata->last_pos = start + areasize - 1;
bdata->last_offset = remaining_size; bdata->last_offset = remaining_size;
} }
bdata->last_offset &= ~PAGE_MASK; bdata->last_offset &= ~PAGE_MASK;
...@@ -287,7 +290,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size, ...@@ -287,7 +290,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size,
/* /*
* Reserve the area now: * Reserve the area now:
*/ */
for (i = start; i < start+areasize; i++) for (i = start; i < start + areasize; i++)
if (unlikely(test_and_set_bit(i, bdata->node_bootmem_map))) if (unlikely(test_and_set_bit(i, bdata->node_bootmem_map)))
BUG(); BUG();
memset(ret, 0, size); memset(ret, 0, size);
...@@ -338,7 +341,7 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat) ...@@ -338,7 +341,7 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat)
} }
} }
} else { } else {
i+=BITS_PER_LONG; i += BITS_PER_LONG;
} }
pfn += BITS_PER_LONG; pfn += BITS_PER_LONG;
} }
...@@ -361,51 +364,51 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat) ...@@ -361,51 +364,51 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat)
return total; return total;
} }
unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long __init init_bootmem_node(pg_data_t *pgdat, unsigned long freepfn,
unsigned long startpfn, unsigned long endpfn) unsigned long startpfn, unsigned long endpfn)
{ {
return(init_bootmem_core(pgdat, freepfn, startpfn, endpfn)); return init_bootmem_core(pgdat, freepfn, startpfn, endpfn);
} }
void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, void __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
unsigned long size) unsigned long size)
{ {
reserve_bootmem_core(pgdat->bdata, physaddr, size); reserve_bootmem_core(pgdat->bdata, physaddr, size);
} }
void __init free_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
unsigned long size) unsigned long size)
{ {
free_bootmem_core(pgdat->bdata, physaddr, size); free_bootmem_core(pgdat->bdata, physaddr, size);
} }
unsigned long __init free_all_bootmem_node (pg_data_t *pgdat) unsigned long __init free_all_bootmem_node(pg_data_t *pgdat)
{ {
return(free_all_bootmem_core(pgdat)); return free_all_bootmem_core(pgdat);
} }
unsigned long __init init_bootmem (unsigned long start, unsigned long pages) unsigned long __init init_bootmem(unsigned long start, unsigned long pages)
{ {
max_low_pfn = pages; max_low_pfn = pages;
min_low_pfn = start; min_low_pfn = start;
return(init_bootmem_core(NODE_DATA(0), start, 0, pages)); return init_bootmem_core(NODE_DATA(0), start, 0, pages);
} }
#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
void __init reserve_bootmem (unsigned long addr, unsigned long size) void __init reserve_bootmem(unsigned long addr, unsigned long size)
{ {
reserve_bootmem_core(NODE_DATA(0)->bdata, addr, size); reserve_bootmem_core(NODE_DATA(0)->bdata, addr, size);
} }
#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
void __init free_bootmem (unsigned long addr, unsigned long size) void __init free_bootmem(unsigned long addr, unsigned long size)
{ {
free_bootmem_core(NODE_DATA(0)->bdata, addr, size); free_bootmem_core(NODE_DATA(0)->bdata, addr, size);
} }
unsigned long __init free_all_bootmem (void) unsigned long __init free_all_bootmem(void)
{ {
return(free_all_bootmem_core(NODE_DATA(0))); return free_all_bootmem_core(NODE_DATA(0));
} }
void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align, void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align,
...@@ -414,9 +417,11 @@ void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align, ...@@ -414,9 +417,11 @@ void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align,
bootmem_data_t *bdata; bootmem_data_t *bdata;
void *ptr; void *ptr;
list_for_each_entry(bdata, &bdata_list, list) list_for_each_entry(bdata, &bdata_list, list) {
if ((ptr = __alloc_bootmem_core(bdata, size, align, goal, 0))) ptr = __alloc_bootmem_core(bdata, size, align, goal, 0);
return(ptr); if (ptr)
return ptr;
}
return NULL; return NULL;
} }
...@@ -424,6 +429,7 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align, ...@@ -424,6 +429,7 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align,
unsigned long goal) unsigned long goal)
{ {
void *mem = __alloc_bootmem_nopanic(size,align,goal); void *mem = __alloc_bootmem_nopanic(size,align,goal);
if (mem) if (mem)
return mem; return mem;
/* /*
...@@ -442,7 +448,7 @@ void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, ...@@ -442,7 +448,7 @@ void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
ptr = __alloc_bootmem_core(pgdat->bdata, size, align, goal, 0); ptr = __alloc_bootmem_core(pgdat->bdata, size, align, goal, 0);
if (ptr) if (ptr)
return (ptr); return ptr;
return __alloc_bootmem(size, align, goal); return __alloc_bootmem(size, align, goal);
} }
...@@ -455,10 +461,11 @@ void * __init __alloc_bootmem_low(unsigned long size, unsigned long align, ...@@ -455,10 +461,11 @@ void * __init __alloc_bootmem_low(unsigned long size, unsigned long align,
bootmem_data_t *bdata; bootmem_data_t *bdata;
void *ptr; void *ptr;
list_for_each_entry(bdata, &bdata_list, list) list_for_each_entry(bdata, &bdata_list, list) {
if ((ptr = __alloc_bootmem_core(bdata, size, ptr = __alloc_bootmem_core(bdata, size, align, goal, LOW32LIMIT);
align, goal, LOW32LIMIT))) if (ptr)
return(ptr); return ptr;
}
/* /*
* Whoops, we cannot satisfy the allocation request. * Whoops, we cannot satisfy the allocation request.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment