From: chengang@emindsoft.com.cn
To: akpm@linux-foundation.org, trivial@kernel.org
Cc: kuleshovmail@gmail.com, tony.luck@intel.com,
tangchen@cn.fujitsu.com, will.deacon@arm.com, holt@sgi.com,
ard.biesheuvel@linaro.org, kirill.shutemov@linux.intel.com,
linux-kernel@vger.kernel.org,
Chen Gang <chengang@emindsoft.com.cn>,
Chen Gang <gang.chen.5i5j@gmail.com>
Subject: [PATCH trivial] include/linux/memblock.h: Clean up code for several trivial details
Date: Sun, 29 May 2016 22:36:07 +0800 [thread overview]
Message-ID: <1464532567-6353-1-git-send-email-chengang@emindsoft.com.cn> (raw)
From: Chen Gang <chengang@emindsoft.com.cn>
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).
Use "!!" to let the boolean function return boolean value directly.
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.
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
include/linux/memblock.h | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 3106ac1..83d0410 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -73,8 +73,8 @@ extern bool movable_node_enabled;
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 start, phys_addr_t end,
- int nid, ulong flags);
+ phys_addr_t start, phys_addr_t end,
+ int nid, ulong flags);
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 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,
phys_addr_t *out_end, int *out_nid);
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
@@ -148,7 +148,7 @@ void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start,
p_start, p_end, p_nid) \
for (i = (u64)ULLONG_MAX, \
__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; \
__next_mem_range_rev(&i, nid, flags, type_a, type_b, \
p_start, p_end, p_nid))
@@ -163,8 +163,7 @@ void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start,
* is initialized.
*/
#define for_each_reserved_mem_region(i, p_start, p_end) \
- for (i = 0UL, \
- __next_reserved_mem_region(&i, p_start, p_end); \
+ for (i = 0UL, __next_reserved_mem_region(&i, p_start, p_end); \
i != (u64)ULLONG_MAX; \
__next_reserved_mem_region(&i, p_start, p_end))
@@ -191,12 +190,12 @@ static inline bool movable_node_is_enabled(void)
static inline bool memblock_is_mirror(struct memblock_region *m)
{
- return m->flags & MEMBLOCK_MIRROR;
+ return !!(m->flags & MEMBLOCK_MIRROR);
}
static inline bool memblock_is_nomap(struct memblock_region *m)
{
- return m->flags & MEMBLOCK_NOMAP;
+ return !!(m->flags & MEMBLOCK_NOMAP);
}
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
@@ -403,15 +402,14 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
}
#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++)
#define for_each_memblock_type(memblock_type, rgn) \
- idx = 0; \
- rgn = &memblock_type->regions[idx]; \
- for (idx = 0; idx < memblock_type->cnt; \
- idx++,rgn = &memblock_type->regions[idx])
+ for (idx = 0, rgn = &memblock_type->regions[0]; \
+ idx < memblock_type->cnt; \
+ idx++, rgn = &memblock_type->regions[idx])
#ifdef CONFIG_MEMTEST
extern void early_memtest(phys_addr_t start, phys_addr_t end);
--
1.9.3
next reply other threads:[~2016-05-29 14:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-29 14:36 chengang [this message]
2016-05-29 15:08 ` Joe Perches
2016-05-30 14:21 ` Chen Gang
2016-05-30 14:33 ` Joe Perches
2016-05-30 22:14 ` Chen Gang
2016-05-31 2:06 ` Chen Gang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464532567-6353-1-git-send-email-chengang@emindsoft.com.cn \
--to=chengang@emindsoft.com.cn \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=gang.chen.5i5j@gmail.com \
--cc=holt@sgi.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kuleshovmail@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tangchen@cn.fujitsu.com \
--cc=tony.luck@intel.com \
--cc=trivial@kernel.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®