powerpc: 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.

A couple of open coded iterating thru the child node names are converted
to use for_each_child_of_node() instead.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Rob Herring
2018-12-05 13:50:18 -06:00
committed by Michael Ellerman
parent 0d1223dd92
commit 2c8e65b595
15 changed files with 39 additions and 64 deletions

View File

@@ -400,8 +400,7 @@ void __init find_legacy_serial_ports(void)
/* Next, fill our array with ISA ports */
for_each_node_by_type(np, "serial") {
struct device_node *isa = of_get_parent(np);
if (isa && (!strcmp(isa->name, "isa") ||
!strcmp(isa->name, "lpc"))) {
if (of_node_name_eq(isa, "isa") || of_node_name_eq(isa, "lpc")) {
if (of_device_is_available(np)) {
index = add_legacy_isa_port(np, isa);
if (index >= 0 && np == stdout)
@@ -415,11 +414,11 @@ void __init find_legacy_serial_ports(void)
/* Next, try to locate PCI ports */
for (np = NULL; (np = of_find_all_nodes(np));) {
struct device_node *pci, *parent = of_get_parent(np);
if (parent && !strcmp(parent->name, "isa")) {
if (of_node_name_eq(parent, "isa")) {
of_node_put(parent);
continue;
}
if (strcmp(np->name, "serial") &&
if (!of_node_name_eq(np, "serial") &&
!of_node_is_type(np, "serial")) {
of_node_put(parent);
continue;