summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2021-04-20 14:05:10 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-22 10:43:25 +0200
commitc295d3007ff63064181befa734d9705dfc10b396 (patch)
treec4a0f975d12e6446a7537f32ceba7686d2dcc303 /drivers/staging
parentbd36d5e2d5c48ee2cb12f98ad0b334d05917b850 (diff)
downloadlinux-c295d3007ff63064181befa734d9705dfc10b396.tar.bz2
staging: octeon: Use 'for_each_child_of_node'
Use 'for_each_child_of_node' instead of hand writing it. This saves a few line of code. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/eaffe388e6c51e97caf3e8fa474de74428575455.1618920182.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/octeon/ethernet.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 5dea6e96ec90..7c60b0cd8bf7 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -614,14 +614,11 @@ static const struct net_device_ops cvm_oct_pow_netdev_ops = {
static struct device_node *cvm_oct_of_get_child
(const struct device_node *parent, int reg_val)
{
- struct device_node *node = NULL;
- int size;
+ struct device_node *node;
const __be32 *addr;
+ int size;
- for (;;) {
- node = of_get_next_child(parent, node);
- if (!node)
- break;
+ for_each_child_of_node(parent, node) {
addr = of_get_property(node, "reg", &size);
if (addr && (be32_to_cpu(*addr) == reg_val))
break;