PCI: Use of_node_name_eq for node name comparisons
PATCH 1/1 PCI: 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 Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Signed-off-by Rob Herring <[email protected]>
--- drivers/pci/hotplug/rpaphp_core.c | 2 +- drivers/pci/of.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/pci/hotplug/rpaphp_core.c +1 -1
@@ -354,7 +354,7 @@ int rpaphp_add_slot(struct device_node *dn)const int *indexes, *names, *types, *power_domains;char *name, *type; -if (!dn->name ||strcmp (dn->name,"pci" )) +if (!of_node_name_eq (dn,"pci" ))return 0 ;/* If this is not a hotplug slot, return without doing anything. */
drivers/pci/of.c +1 -1
@@ -113,7 +113,7 @@ struct device_node *of_pci_find_child_device(struct device_node *parent,* a fake root for all functions of a multi-function * device we go down them as well. */ -if (!strcmp (node->name,"multifunc-device" )) { +if (of_node_name_eq (node,"multifunc-device" )) {for_each_child_of_node (node, node2) {if (__of_pci_pci_compare (node2, devfn)) {of_node_put (node);
Signature · 1 line
2.19.1
Bjorn Helgaas
Applied[+cc Michael B]
Quoted 10 lines · Rob Herring
Convert string compares of DT node names to use
of_node_name_eqhelper instead. This removes direct access to the node name pointer.Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Bjorn Helgaas <[email protected]>Signed-off-by Rob Herring <[email protected]>
I applied the pci/of.c change to pci/misc for v5.1, thanks!
I dropped the rpaphp_core.c part because there's another patch in-flight [1] that touches the same code, and it would be easier if Michael picked up this change and added it to his series.
Bjorn
[1] https://lore.kernel.org/lkml/[email protected]/
Quoted 34 lines
--- drivers/pci/hotplug/rpaphp_core.c | 2 +- drivers/pci/of.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/pci/hotplug/rpaphp_core.c +1
-1@@ -354,7 +354,7 @@ int rpaphp_add_slot(struct device_node *dn)const int *indexes, *names, *types, *power_domains;char *name, *type; -if (!dn->name ||strcmp (dn->name,"pci" )) +if (!of_node_name_eq (dn,"pci" ))return 0 ;/* If this is not a hotplug slot, return without doing anything. */ drivers/pci/of.c +1
-1@@ -113,7 +113,7 @@ struct device_node *of_pci_find_child_device(struct device_node *parent,* a fake root for all functions of a multi-function * device we go down them as well. */ -if (!strcmp (node->name,"multifunc-device" )) { +if (of_node_name_eq (node,"multifunc-device" )) {for_each_child_of_node (node, node2) {if (__of_pci_pci_compare (node2, devfn)) {of_node_put (node);Signature · 1 line
2.19.1