diff options
author | Rob Herring <robh@kernel.org> | 2018-08-27 08:37:06 -0500 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2018-12-05 14:45:13 -0600 |
commit | b3e46d1a0590500335f0b95e669ad6d84b12b03a (patch) | |
tree | 03ae42679eab36e311870dffdafe1aa7870875a2 /drivers/of/base.c | |
parent | ae517053f003bc3739640acd8d77617b14bf45d2 (diff) | |
download | lwn-b3e46d1a0590500335f0b95e669ad6d84b12b03a.tar.gz lwn-b3e46d1a0590500335f0b95e669ad6d84b12b03a.zip |
of: Use of_node_name_eq for node name comparisons
Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r-- | drivers/of/base.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 57c837140a8b..998d032fcef9 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -496,7 +496,7 @@ static int __of_device_is_compatible(const struct device_node *device, /* Matching name is a bit better than not */ if (name && name[0]) { - if (!device->name || of_node_cmp(name, device->name)) + if (!of_node_name_eq(device, name)) return 0; score++; } @@ -835,7 +835,7 @@ struct device_node *of_get_child_by_name(const struct device_node *node, struct device_node *child; for_each_child_of_node(node, child) - if (child->name && (of_node_cmp(child->name, name) == 0)) + if (of_node_name_eq(child, name)) break; return child; } @@ -961,8 +961,7 @@ struct device_node *of_find_node_by_name(struct device_node *from, raw_spin_lock_irqsave(&devtree_lock, flags); for_each_of_allnodes_from(from, np) - if (np->name && (of_node_cmp(np->name, name) == 0) - && of_node_get(np)) + if (of_node_name_eq(np, name) && of_node_get(np)) break; of_node_put(from); raw_spin_unlock_irqrestore(&devtree_lock, flags); |