ASoC: simple-card: use common for_each_child_of_node() for loop
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 28 Aug 2014 03:08:47 +0000 (20:08 -0700)
committerMark Brown <broonie@kernel.org>
Fri, 29 Aug 2014 11:51:02 +0000 (12:51 +0100)
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/generic/simple-card.c

index 89027047364f2d5173d1a219ea0ee91d644ce8a1..fd8b045889488330fc7340498756dfc2bce93b47 100644 (file)
@@ -346,8 +346,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 
        if (multi) {
                struct device_node *np = NULL;
-               int i;
-               for (i = 0; (np = of_get_next_child(node, np)); i++) {
+               int i = 0;
+
+               for_each_child_of_node(node, np) {
                        dev_dbg(dev, "\tlink %d:\n", i);
                        ret = asoc_simple_card_dai_link_of(np, dev,
                                                           dai_link + i,
@@ -357,6 +358,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
                                of_node_put(np);
                                return ret;
                        }
+                       i++;
                }
        } else {
                ret = asoc_simple_card_dai_link_of(node, dev,