OSDN Git Service

mtd: ofpart: use for_each_child_of_node() macro
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Fri, 23 Aug 2013 03:04:27 +0000 (11:04 +0800)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 30 Aug 2013 20:52:57 +0000 (21:52 +0100)
Use for_each_child_of_node() macro instead of open coding it.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/ofpart.c

index 7843a44..d64f8c3 100644 (file)
@@ -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;