Skip to contentSkip to conversation

of/platform: Use dev_is_platform() to identify PCI devices

PATCH In review Kunwu Chan 2 participants 3 messages Aug 27, 2024 – Aug 29, 2024 Device tree

lore
Share & tools
lore

Kunwu Chan

author
#0 lore raw

PATCH 1/1 of/platform: Use dev_is_platform() to identify PCI devices

From: Kunwu Chan <[email protected]>

Use dev_is_platform() instead of checking bus type directly.

---
 drivers/of/platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/platform.c +1 -1
index 86be4dfb9323..3696140bae9e 100644
@@ -625,7 +625,7 @@ int of_platform_device_destroy(struct device *dev, void *data)
 	of_node_clear_flag(dev->of_node, OF_POPULATED);
 	of_node_clear_flag(dev->of_node, OF_POPULATED_BUS);
 
-	if (dev->bus == &platform_bus_type)
+	if (dev_is_platform(dev))
 		platform_device_unregister(to_platform_device(dev));
 #ifdef CONFIG_ARM_AMBA
 	else if (dev->bus == &amba_bustype)
Signature · 1 line
2.41.0
maintainer
#1 lore raw
Quoted 1 line · Kunwu Chan

From: Kunwu Chan <[email protected]>

Subject - For PCI devices?

Quoted 13 lines

Use dev_is_platform() instead of checking bus type directly.

---
 drivers/of/platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/platform.c +0 -0
index 86be4dfb9323..3696140bae9e 100644

drivers/of/platform.c int of_platform_device_destroy(struct device *dev, void *data) · line 631

Quoted 8 lines
drivers/of/platform.c +1 -1
@@ -625,7 +625,7 @@ int of_platform_device_destroy(struct device *dev, void *data)
 	of_node_clear_flag(dev->of_node, OF_POPULATED);
 	of_node_clear_flag(dev->of_node, OF_POPULATED_BUS);
 
-	if (dev->bus == &platform_bus_type)
+	if (dev_is_platform(dev))
 		platform_device_unregister(to_platform_device(dev));
 #ifdef CONFIG_ARM_AMBA
 	else if (dev->bus == &amba_bustype)

Perhaps to keep things consistent, add a dev_is_amba() and use it here.

Quoted 3 lines
Signature · 1 line
2.41.0
author
#2 lore raw

Thanks for the reply.

Quoted 3 lines · Rob Herring
Quoted 1 line · Kunwu Chan

From: Kunwu Chan <[email protected]>

Subject - For PCI devices?

My bad, i'll change it in v2.

Quoted 15 lines
Quoted 15 lines

Use dev_is_platform() instead of checking bus type directly.

---
  drivers/of/platform.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/platform.c +0 -0
index 86be4dfb9323..3696140bae9e 100644
@@ -625,7 +625,7 @@ int of_platform_device_destroy(struct device *dev, void *data)
  	of_node_clear_flag(dev->of_node, OF_POPULATED);
  	of_node_clear_flag(dev->of_node, OF_POPULATED_BUS);
 
Quoted 7 lines

drivers/of/platform.c int of_platform_device_destroy(struct device *dev, void *data) · line 631

Quoted 5 lines
drivers/of/platform.c +1 -1
-	if (dev->bus == &platform_bus_type)
+	if (dev_is_platform(dev))
  		platform_device_unregister(to_platform_device(dev));
  #ifdef CONFIG_ARM_AMBA
  	else if (dev->bus == &amba_bustype)

Perhaps to keep things consistent, add a dev_is_amba() and use it here.

Sure, i'am doing this in [1], i'll send the v2 patch after change it in AMBA.

[1] https://lore.kernel.org/all/[email protected]/

Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.41.0
Signature · 2 lines
Thanks,
  Kunwu.Chan