Commit ba6c19fd authored by Chen Gang's avatar Chen Gang Committed by Linus Torvalds

include/linux/memblock.h: Clean up code for several trivial details

Correct the function parameters alignment, since original code already
use both tabs and white spaces together for the incorrect parameters
alignment functions.

If one line can hold one statement within 80 columns, let it in one line
(original code did not consider about the tabs/spaces for 2nd line when
a statement is separated into 2 lines).

Try to let '' aligned within one macro, since all related lines are
short enough.

Remove useless statement "idx = 0;", and always assign rgn within the
'for' statement.

Link: http://lkml.kernel.org/r/1464904899-1714-1-git-send-email-chengang@emindsoft.com.cnSigned-off-by: default avatarChen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 91537fee
...@@ -73,8 +73,8 @@ extern bool movable_node_enabled; ...@@ -73,8 +73,8 @@ extern bool movable_node_enabled;
if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align, phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align,
phys_addr_t start, phys_addr_t end, phys_addr_t start, phys_addr_t end,
int nid, ulong flags); int nid, ulong flags);
phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
phys_addr_t size, phys_addr_t align); phys_addr_t size, phys_addr_t align);
phys_addr_t get_allocated_memblock_reserved_regions_info(phys_addr_t *addr); phys_addr_t get_allocated_memblock_reserved_regions_info(phys_addr_t *addr);
...@@ -110,7 +110,7 @@ void __next_mem_range_rev(u64 *idx, int nid, ulong flags, ...@@ -110,7 +110,7 @@ void __next_mem_range_rev(u64 *idx, int nid, ulong flags,
phys_addr_t *out_end, int *out_nid); phys_addr_t *out_end, int *out_nid);
void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start, void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start,
phys_addr_t *out_end); phys_addr_t *out_end);
/** /**
* for_each_mem_range - iterate through memblock areas from type_a and not * for_each_mem_range - iterate through memblock areas from type_a and not
...@@ -148,7 +148,7 @@ void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start, ...@@ -148,7 +148,7 @@ void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start,
p_start, p_end, p_nid) \ p_start, p_end, p_nid) \
for (i = (u64)ULLONG_MAX, \ for (i = (u64)ULLONG_MAX, \
__next_mem_range_rev(&i, nid, flags, type_a, type_b,\ __next_mem_range_rev(&i, nid, flags, type_a, type_b,\
p_start, p_end, p_nid); \ p_start, p_end, p_nid); \
i != (u64)ULLONG_MAX; \ i != (u64)ULLONG_MAX; \
__next_mem_range_rev(&i, nid, flags, type_a, type_b, \ __next_mem_range_rev(&i, nid, flags, type_a, type_b, \
p_start, p_end, p_nid)) p_start, p_end, p_nid))
...@@ -163,8 +163,7 @@ void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start, ...@@ -163,8 +163,7 @@ void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start,
* is initialized. * is initialized.
*/ */
#define for_each_reserved_mem_region(i, p_start, p_end) \ #define for_each_reserved_mem_region(i, p_start, p_end) \
for (i = 0UL, \ for (i = 0UL, __next_reserved_mem_region(&i, p_start, p_end); \
__next_reserved_mem_region(&i, p_start, p_end); \
i != (u64)ULLONG_MAX; \ i != (u64)ULLONG_MAX; \
__next_reserved_mem_region(&i, p_start, p_end)) __next_reserved_mem_region(&i, p_start, p_end))
...@@ -403,15 +402,14 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo ...@@ -403,15 +402,14 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
} }
#define for_each_memblock(memblock_type, region) \ #define for_each_memblock(memblock_type, region) \
for (region = memblock.memblock_type.regions; \ for (region = memblock.memblock_type.regions; \
region < (memblock.memblock_type.regions + memblock.memblock_type.cnt); \ region < (memblock.memblock_type.regions + memblock.memblock_type.cnt); \
region++) region++)
#define for_each_memblock_type(memblock_type, rgn) \ #define for_each_memblock_type(memblock_type, rgn) \
idx = 0; \ for (idx = 0, rgn = &memblock_type->regions[0]; \
rgn = &memblock_type->regions[idx]; \ idx < memblock_type->cnt; \
for (idx = 0; idx < memblock_type->cnt; \ idx++, rgn = &memblock_type->regions[idx])
idx++,rgn = &memblock_type->regions[idx])
#ifdef CONFIG_MEMTEST #ifdef CONFIG_MEMTEST
extern void early_memtest(phys_addr_t start, phys_addr_t end); extern void early_memtest(phys_addr_t start, phys_addr_t end);
......
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