misc: cxl: Use device_type helpers to access the node type
PATCH v2 1/1 misc: cxl: Use device_type helpers to access the node type
Remove directly accessing device_type property and use the of_node_is_type accessor instead. While not using it here, this is part of eventually removing the struct device_node.type pointer.
---
v2:
- Reword commit message as this change was using the .type ptr.
drivers/misc/cxl/pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/misc/cxl/pci.c +1 -3
@@ -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
Le 05/12/2018 à 20:16, Rob Herring a écrit :
Quoted 10 lines
Remove directly accessing
device_typeproperty and use theof_node_is_typeaccessor instead. While not using it here, this is part of eventually removing the struct device_node.type pointer.Cc Frederic Barrat <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Acked-by Andrew Donnellan <[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 3 lines
---
v2:
- Reword commit message as this change was using the .type ptr.
Quoted 27 lines
drivers/misc/cxl/pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/misc/cxl/pci.c +1
-3@@ -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++; }
Quoted 10 lines · Rob Herring
Remove directly accessing
device_typeproperty and use theof_node_is_typeaccessor instead. While not using it here, this is part of eventually removing the struct device_node.type pointer.Cc Frederic Barrat <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Acked-by Andrew Donnellan <[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 3 lines
---
v2:
- Reword commit message as this change was using the .type ptr.
I already have v1 in my next.
cheers
Quoted 24 lines
drivers/misc/cxl/pci.c +1
-3@@ -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