Skip to contentSkip to conversation

PCI: Use of_node_name_eq for node name comparisons

PATCH Applied Rob Herring 2 participants 2 messages Apr 16, 2020 – Apr 24, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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]>
---
 drivers/pci/hotplug/rpaphp_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/hotplug/rpaphp_core.c +1 -1
index 6504869efabc..9887c9de08c3 100644
@@ -435,7 +435,7 @@ static int rpaphp_drc_add_slot(struct device_node *dn)
  */
 int rpaphp_add_slot(struct device_node *dn)
 {
-	if (!dn->name || strcmp(dn->name, "pci"))
+	if (!of_node_name_eq(dn, "pci"))
 		return 0;
 
 	if (of_find_property(dn, "ibm,drc-info", NULL))
Signature · 1 line
2.20.1
#1 lore raw
Quoted 10 lines · Rob Herring

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]>

Applied to pci/hotplug for v5.8, thanks!

Quoted 20 lines
---
 drivers/pci/hotplug/rpaphp_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/hotplug/rpaphp_core.c +1 -1
index 6504869efabc..9887c9de08c3 100644
@@ -435,7 +435,7 @@ static int rpaphp_drc_add_slot(struct device_node *dn)
  */
 int rpaphp_add_slot(struct device_node *dn)
 {
-	if (!dn->name || strcmp(dn->name, "pci"))
+	if (!of_node_name_eq(dn, "pci"))
 		return 0;
 
 	if (of_find_property(dn, "ibm,drc-info", NULL))
Signature · 1 line
2.20.1