* [PATCH v4 5/5] dt/tty/opal: Use of_get_child_by_name to get a named child
@ 2012-09-18 7:11 Srinivas KANDAGATLA
0 siblings, 0 replies; only message in thread
From: Srinivas KANDAGATLA @ 2012-09-18 7:11 UTC (permalink / raw)
To: benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r
Cc: kgene.kim-Sze3O3UU22JBDgjK7y7TUQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E,
ben-linux-elnMNo+KYs3YtjvyW6yDsg
From: Srinivas Kandagatla <srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
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.kandagatla-qxv4g6HH51o@public.gmane.org>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-09-18 7:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-18 7:11 [PATCH v4 5/5] dt/tty/opal: Use of_get_child_by_name to get a named child Srinivas KANDAGATLA
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).