summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2018-08-29 22:03:37 +0200
committerDavid S. Miller <davem@davemloft.net>2018-10-08 07:41:08 +0200
commitdf58f37b5d8f883fb18ba85e8d9a624154879832 (patch)
treee451435e9eee69780594dcb693a733298ff1bdfd /drivers
parentsparc: Convert to using %pOFn instead of device_node.name (diff)
downloadlinux-df58f37b5d8f883fb18ba85e8d9a624154879832.tar.xz
linux-df58f37b5d8f883fb18ba85e8d9a624154879832.zip
sbus: Use of_get_child_by_name helper
Use the of_get_child_by_name() helper instead of open coding searching for the '/options' node. This removes directly accessing the name pointer as well. Cc: "David S. Miller" <davem@davemloft.net> Cc: sparclinux@vger.kernel.org Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/sbus/char/openprom.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 7b31f19ade83..050879a2ddef 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -715,22 +715,13 @@ static struct miscdevice openprom_dev = {
static int __init openprom_init(void)
{
- struct device_node *dp;
int err;
err = misc_register(&openprom_dev);
if (err)
return err;
- dp = of_find_node_by_path("/");
- dp = dp->child;
- while (dp) {
- if (!strcmp(dp->name, "options"))
- break;
- dp = dp->sibling;
- }
- options_node = dp;
-
+ options_node = of_get_child_by_name(of_find_node_by_path("/"), "options");
if (!options_node) {
misc_deregister(&openprom_dev);
return -EIO;