Skip to contentSkip to conversation

misc: cxl: Use device_type helpers to access the node type

PATCH Applied Rob Herring 3 participants 3 messages Nov 16, 2018 – Dec 7, 2018 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc: cxl: Use device_type helpers to access the node type

Remove directly accessing device_node.type pointer and use the accessors instead. This will eventually allow removing the type pointer.

Cc Frederic Barrat <[email protected]>
Cc Andrew Donnellan <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/misc/cxl/pci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/misc/cxl/pci.c +1 -3
index b66d832d3233..c79ba1c699ad 100644
@@ -1718,7 +1718,6 @@ int cxl_slot_is_switched(struct pci_dev *dev)
 {
 	struct device_node *np;
 	int depth = 0;
-	const __be32 *prop;
 
 	if (!(np = pci_device_to_OF_node(dev))) {
 		pr_err("cxl: np = NULL\n");
@@ -1727,8 +1726,7 @@ int cxl_slot_is_switched(struct pci_dev *dev)
 	of_node_get(np);
 	while (np) {
 		np = of_get_next_parent(np);
-		prop = of_get_property(np, "device_type", NULL);
-		if (!prop || strcmp((char *)prop, "pciex"))
+		if (!of_node_is_type(np, "pciex"))
 			break;
 		depth++;
 	}
Signature · 1 line
2.19.1
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Rob Herring

Remove directly accessing device_node.type pointer and use the accessors instead. This will eventually allow removing the type pointer.

This description doesn't quite match what's being fixed - we're not accessing the .type pointer, we're getting the device_type property directly.

Quoted 6 lines
Cc Frederic Barrat <[email protected]>
Cc Andrew Donnellan <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

Apart from that:

Quoted 27 lines
---
  drivers/misc/cxl/pci.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/misc/cxl/pci.c +1 -3
index b66d832d3233..c79ba1c699ad 100644
@@ -1718,7 +1718,6 @@ int cxl_slot_is_switched(struct pci_dev *dev)
  {
  	struct device_node *np;
  	int depth = 0;
-	const __be32 *prop;
 
  	if (!(np = pci_device_to_OF_node(dev))) {
  		pr_err("cxl: np = NULL\n");
@@ -1727,8 +1726,7 @@ int cxl_slot_is_switched(struct pci_dev *dev)
  	of_node_get(np);
  	while (np) {
  		np = of_get_next_parent(np);
-		prop = of_get_property(np, "device_type", NULL);
-		if (!prop || strcmp((char *)prop, "pciex"))
+		if (!of_node_is_type(np, "pciex"))
  			break;
  		depth++;
  	}
Signature · 2 lines
Andrew Donnellan              OzLabs, ADL Canberra
[email protected]  IBM Australia Limited
#2 lore raw
In reply to Rob Herring
Quoted 10 lines · Rob Herring

Remove directly accessing device_node.type pointer and use the accessors instead. This will eventually allow removing the type pointer.

Cc Frederic Barrat <[email protected]>
Cc Andrew Donnellan <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/d2db097905d6ec439b7e863dc9a7e7

cheers