[PATCH] bootmem: miscellaneous coding style fixes
authorFranck Bui-Huu <vagabon.xyz@gmail.com>
Tue, 26 Sep 2006 06:31:08 +0000 (23:31 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 15:48:45 +0000 (08:48 -0700)
It fixes various coding style issues, specially when spaces are useless.  For
example '*' go next to the function name.

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/bootmem.h
mm/bootmem.c

index b2067e4a44860bce8c5e5a10ae0d5e8c08a38b57..31e9abb6d9775246c2533e4b89a39d41c896a907 100644 (file)
@@ -38,29 +38,30 @@ typedef struct bootmem_data {
        struct list_head list;
 } bootmem_data_t;
 
-extern unsigned long bootmem_bootmap_pages (unsigned long);
-extern unsigned long init_bootmem (unsigned long addr, unsigned long memend);
-extern void free_bootmem (unsigned long addr, unsigned long size);
-extern void * __alloc_bootmem (unsigned long size,
-                              unsigned long align,
-                              unsigned long goal);
-extern void * __alloc_bootmem_nopanic (unsigned long size,
-                                      unsigned long align,
-                                      unsigned long goal);
-extern void * __alloc_bootmem_low(unsigned long size,
+extern unsigned long bootmem_bootmap_pages(unsigned long);
+extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
+extern void free_bootmem(unsigned long addr, unsigned long size);
+extern void *__alloc_bootmem(unsigned long size,
+                            unsigned long align,
+                            unsigned long goal);
+extern void *__alloc_bootmem_nopanic(unsigned long size,
+                                    unsigned long align,
+                                    unsigned long goal);
+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 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 goal,
-                                  unsigned long limit);
+                                 unsigned long goal,
+                                 unsigned long limit);
+
 #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) \
        __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
 #define alloc_bootmem_low(x) \
@@ -70,22 +71,24 @@ extern void reserve_bootmem (unsigned long addr, unsigned long size);
 #define alloc_bootmem_low_pages(x) \
        __alloc_bootmem_low(x, PAGE_SIZE, 0)
 #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
-extern unsigned long free_all_bootmem (void);
-extern void * __alloc_bootmem_node (pg_data_t *pgdat,
-                                   unsigned long size,
-                                   unsigned long align,
-                                   unsigned long goal);
-extern unsigned long init_bootmem_node (pg_data_t *pgdat,
-                                       unsigned long freepfn,
-                                       unsigned long startpfn,
-                                       unsigned long endpfn);
-extern void reserve_bootmem_node (pg_data_t *pgdat,
-                                 unsigned long physaddr,
-                                 unsigned long size);
-extern void free_bootmem_node (pg_data_t *pgdat,
-                              unsigned long addr,
-                              unsigned long size);
-extern unsigned long free_all_bootmem_node (pg_data_t *pgdat);
+
+extern unsigned long free_all_bootmem(void);
+extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
+extern void *__alloc_bootmem_node(pg_data_t *pgdat,
+                                 unsigned long size,
+                                 unsigned long align,
+                                 unsigned long goal);
+extern unsigned long init_bootmem_node(pg_data_t *pgdat,
+                                      unsigned long freepfn,
+                                      unsigned long startpfn,
+                                      unsigned long endpfn);
+extern void reserve_bootmem_node(pg_data_t *pgdat,
+                                unsigned long physaddr,
+                                unsigned long size);
+extern void free_bootmem_node(pg_data_t *pgdat,
+                             unsigned long addr,
+                             unsigned long size);
+
 #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
 #define alloc_bootmem_node(pgdat, x) \
        __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)
 {
        return NULL;
 }
-#endif
+#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
 
 extern unsigned long __meminitdata nr_kernel_pages;
 extern unsigned long nr_all_pages;
 
-extern void * alloc_large_system_hash(const char *tablename,
-                                     unsigned long bucketsize,
-                                     unsigned long numentries,
-                                     int scale,
-                                     int flags,
-                                     unsigned int *_hash_shift,
-                                     unsigned int *_hash_mask,
-                                     unsigned long limit);
+extern void *alloc_large_system_hash(const char *tablename,
+                                    unsigned long bucketsize,
+                                    unsigned long numentries,
+                                    int scale,
+                                    int flags,
+                                    unsigned int *_hash_shift,
+                                    unsigned int *_hash_mask,
+                                    unsigned long limit);
 
 #define HASH_HIGHMEM   0x00000001      /* Consider highmem? */
 #define HASH_EARLY     0x00000002      /* Allocating during early boot? */
index 23c3317c09ed03340f68c5ed6dd4625442bc5b5c..f0f85fa713ca3f3e596c8bbd7ecba09b6baed188 100644 (file)
@@ -38,7 +38,7 @@ unsigned long saved_max_pfn;
 #endif
 
 /* 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;
 
@@ -48,12 +48,14 @@ unsigned long __init bootmem_bootmap_pages (unsigned long pages)
 
        return mapsize;
 }
+
 /*
  * link bdata in order
  */
 static void __init link_bootmem(bootmem_data_t *bdata)
 {
        bootmem_data_t *ent;
+
        if (list_empty(&bdata_list)) {
                list_add(&bdata->list, &bdata_list);
                return;
@@ -66,7 +68,6 @@ static void __init link_bootmem(bootmem_data_t *bdata)
                }
        }
        list_add_tail(&bdata->list, &bdata_list);
-       return;
 }
 
 /*
@@ -85,7 +86,7 @@ static unsigned long __init get_mapsize(bootmem_data_t *bdata)
 /*
  * 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)
 {
        bootmem_data_t *bdata = pgdat->bdata;
@@ -185,7 +186,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size,
        unsigned long i, start = 0, incr, eidx, end_pfn;
        void *ret;
 
-       if(!size) {
+       if (!size) {
                printk("__alloc_bootmem_core(): zero-sized request\n");
                BUG();
        }
@@ -234,7 +235,7 @@ restart_scan:
                for (j = i + 1; j < i + areasize; ++j) {
                        if (j >= eidx)
                                goto fail_block;
-                       if (test_bit (j, bdata->node_bootmem_map))
+                       if (test_bit(j, bdata->node_bootmem_map))
                                goto fail_block;
                }
                start = i;
@@ -262,19 +263,21 @@ found:
            bdata->last_offset && bdata->last_pos+1 == start) {
                offset = ALIGN(bdata->last_offset, align);
                BUG_ON(offset > PAGE_SIZE);
-               remaining_size = PAGE_SIZE-offset;
+               remaining_size = PAGE_SIZE - offset;
                if (size < remaining_size) {
                        areasize = 0;
                        /* last_pos unchanged */
-                       bdata->last_offset = offset+size;
-                       ret = phys_to_virt(bdata->last_pos*PAGE_SIZE + offset +
-                                               bdata->node_boot_start);
+                       bdata->last_offset = offset + size;
+                       ret = phys_to_virt(bdata->last_pos * PAGE_SIZE +
+                                          offset +
+                                          bdata->node_boot_start);
                } else {
                        remaining_size = size - remaining_size;
-                       areasize = (remaining_size+PAGE_SIZE-1)/PAGE_SIZE;
-                       ret = phys_to_virt(bdata->last_pos*PAGE_SIZE + offset +
-                                               bdata->node_boot_start);
-                       bdata->last_pos = start+areasize-1;
+                       areasize = (remaining_size + PAGE_SIZE-1) / PAGE_SIZE;
+                       ret = phys_to_virt(bdata->last_pos * PAGE_SIZE +
+                                          offset +
+                                          bdata->node_boot_start);
+                       bdata->last_pos = start + areasize - 1;
                        bdata->last_offset = remaining_size;
                }
                bdata->last_offset &= ~PAGE_MASK;
@@ -287,7 +290,7 @@ found:
        /*
         * 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)))
                        BUG();
        memset(ret, 0, size);
@@ -338,7 +341,7 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat)
                                }
                        }
                } else {
-                       i+=BITS_PER_LONG;
+                       i += BITS_PER_LONG;
                }
                pfn += BITS_PER_LONG;
        }
@@ -361,51 +364,51 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat)
        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)
 {
-       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,
-                                 unsigned long size)
+void __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
+                                unsigned long size)
 {
        reserve_bootmem_core(pgdat->bdata, physaddr, size);
 }
 
-void __init free_bootmem_node (pg_data_t *pgdat, unsigned long physaddr,
-                              unsigned long size)
+void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
+                             unsigned long 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;
        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
-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);
 }
 #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);
 }
 
-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,
@@ -414,9 +417,11 @@ void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align,
        bootmem_data_t *bdata;
        void *ptr;
 
-       list_for_each_entry(bdata, &bdata_list, list)
-               if ((ptr = __alloc_bootmem_core(bdata, size, align, goal, 0)))
-                       return(ptr);
+       list_for_each_entry(bdata, &bdata_list, list) {
+               ptr = __alloc_bootmem_core(bdata, size, align, goal, 0);
+               if (ptr)
+                       return ptr;
+       }
        return NULL;
 }
 
@@ -424,6 +429,7 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align,
                              unsigned long goal)
 {
        void *mem = __alloc_bootmem_nopanic(size,align,goal);
+
        if (mem)
                return mem;
        /*
@@ -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);
        if (ptr)
-               return (ptr);
+               return ptr;
 
        return __alloc_bootmem(size, align, goal);
 }
@@ -455,10 +461,11 @@ void * __init __alloc_bootmem_low(unsigned long size, unsigned long align,
        bootmem_data_t *bdata;
        void *ptr;
 
-       list_for_each_entry(bdata, &bdata_list, list)
-               if ((ptr = __alloc_bootmem_core(bdata, size,
-                                                align, goal, LOW32LIMIT)))
-                       return(ptr);
+       list_for_each_entry(bdata, &bdata_list, list) {
+               ptr = __alloc_bootmem_core(bdata, size, align, goal, LOW32LIMIT);
+               if (ptr)
+                       return ptr;
+       }
 
        /*
         * Whoops, we cannot satisfy the allocation request.