mtd: ofpart: use for_each_child_of_node() macro

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Aug 30 16:59:05 EDT 2013


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=60ea89e22aa5de529d0fdb9de07504afa8e5d4b0
Commit:     60ea89e22aa5de529d0fdb9de07504afa8e5d4b0
Parent:     3156231fb644cf29c1d7f21766ff9e33dc9761d3
Author:     Wei Yongjun <yongjun_wei at trendmicro.com.cn>
AuthorDate: Fri Aug 23 11:04:27 2013 +0800
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Aug 30 21:52:57 2013 +0100

    mtd: ofpart: use for_each_child_of_node() macro
    
    Use for_each_child_of_node() macro instead of open coding it.
    
    Signed-off-by: Wei Yongjun <yongjun_wei at trendmicro.com.cn>
    Acked-by: Huang Shijie <b32955 at freescale.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/ofpart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 7843a44..d64f8c3 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -43,9 +43,8 @@ static int parse_ofpart_partitions(struct mtd_info *master,
 		return 0;
 
 	/* First count the subnodes */
-	pp = NULL;
 	nr_parts = 0;
-	while ((pp = of_get_next_child(node, pp))) {
+	for_each_child_of_node(node,  pp) {
 		if (node_has_compatible(pp))
 			continue;
 
@@ -59,9 +58,8 @@ static int parse_ofpart_partitions(struct mtd_info *master,
 	if (!*pparts)
 		return -ENOMEM;
 
-	pp = NULL;
 	i = 0;
-	while ((pp = of_get_next_child(node, pp))) {
+	for_each_child_of_node(node,  pp) {
 		const __be32 *reg;
 		int len;
 		int a_cells, s_cells;



More information about the linux-mtd-cvs mailing list