From: Srinivas Kandagatla <srinivas.kandaga...@st.com> As follow-up to "dt: introduce of_get_child_by_name to get child node by name." patch, This patch removes some of the code duplication in the driver by replacing it with of_get_child_by_name instead.
Signed-off-by: Srinivas Kandagatla <srinivas.kandaga...@st.com> --- drivers/tty/hvc/hvc_opal.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c index 0d2ea0c..4c7d161 100644 --- a/drivers/tty/hvc/hvc_opal.c +++ b/drivers/tty/hvc/hvc_opal.c @@ -344,7 +344,7 @@ void __init hvc_opal_init_early(void) return; } } else { - struct device_node *opal, *np; + struct device_node *opal; /* Current OPAL takeover doesn't provide the stdout * path, so we hard wire it @@ -360,12 +360,7 @@ void __init hvc_opal_init_early(void) } if (!opal) return; - for_each_child_of_node(opal, np) { - if (!strcmp(np->name, "serial")) { - stdout_node = np; - break; - } - } + stdout_node = of_get_child_by_name(opal, "serial"); of_node_put(opal); } if (!stdout_node) -- 1.7.0.4 _______________________________________________ devicetree-discuss mailing list devicetree-discuss@lists.ozlabs.org https://lists.ozlabs.org/listinfo/devicetree-discuss