Skip to contentSkip to conversation

driver core: platform: Remove platform_device_add_properties()

PATCH RESEND In review Heikki Krogerus 3 participants 6 messages Aug 17, 2021 – Aug 18, 2021

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

cover driver core: platform: Remove platform_device_add_properties()

Hi,

It seems Rafael never took these. Let's try again.

The original cover letter:

It looks like there is only one place left that still uses the function. Converting that last user and removing the thing.

Note, I'm actually resending the patch for board-paz00.c. I'm assuming the original patch slipped through the cracks because it did not end up anywhere.

I would imagine that it's OK to everybody if Greg takes these?

thanks,

Heikki Krogerus (2):
ARM: tegra: paz00: Handle device properties with software node API driver core: platform: Remove platform_device_add_properties()

 arch/arm/mach-tegra/board-paz00.c |  2 +-
 drivers/base/platform.c           | 20 ++------------------
 include/linux/platform_device.h   |  2 --
 3 files changed, 3 insertions(+), 21 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH RESEND 1/2 ARM: tegra: paz00: Handle device properties with software node API

The old device property API is going to be removed. Replacing the device_add_properties() call with the software node API equivalent, device_create_managed_software_node().

---
 arch/arm/mach-tegra/board-paz00.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-tegra/board-paz00.c +1 -1
index b5c990a7a5af5..18d37f90cdfe3 100644
@@ -36,7 +36,7 @@ static struct gpiod_lookup_table wifi_gpio_lookup = {
 
 void __init tegra_paz00_wifikill_init(void)
 {
-	platform_device_add_properties(&wifi_rfkill_device, wifi_rfkill_prop);
+	device_create_managed_software_node(&wifi_rfkill_device.dev, wifi_rfkill_prop, NULL);
 	gpiod_add_lookup_table(&wifi_gpio_lookup);
 	platform_device_register(&wifi_rfkill_device);
 }
Signature · 1 line
2.30.2
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH RESEND 1/2] ARM: tegra: paz00: Handle device properties with software node API

Quoted 15 lines · Heikki Krogerus

The old device property API is going to be removed. Replacing the device_add_properties() call with the software node API equivalent, device_create_managed_software_node().

---
 arch/arm/mach-tegra/board-paz00.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-tegra/board-paz00.c +0 -0
index b5c990a7a5af5..18d37f90cdfe3 100644

arch/arm/mach-tegra/board-paz00.c static struct gpiod_lookup_table wifi_gpio_lookup = { · line 42

Quoted 8 lines
arch/arm/mach-tegra/board-paz00.c +1 -1
@@ -36,7 +36,7 @@ static struct gpiod_lookup_table wifi_gpio_lookup = {
 
 void __init tegra_paz00_wifikill_init(void)
 {
-	platform_device_add_properties(&wifi_rfkill_device, wifi_rfkill_prop);
+	device_create_managed_software_node(&wifi_rfkill_device.dev, wifi_rfkill_prop, NULL);
 	gpiod_add_lookup_table(&wifi_gpio_lookup);
 	platform_device_register(&wifi_rfkill_device);
 }

Seems alright. Looks to be doing mostly the same thing as the original platform_device_add_properties() was doing, except for the node now being managed, which is irrelevant in this context.

I'm fine with Greg picking this up. I'm not aware of any other changes to this file that might cause a conflict for v5.15.

#3 lore raw

Re: [PATCH RESEND 1/2] ARM: tegra: paz00: Handle device properties with software node API

Quoted 29 lines · Thierry Reding
Quoted 15 lines · Heikki Krogerus

The old device property API is going to be removed. Replacing the device_add_properties() call with the software node API equivalent, device_create_managed_software_node().

---
 arch/arm/mach-tegra/board-paz00.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-tegra/board-paz00.c +0 -0
index b5c990a7a5af5..18d37f90cdfe3 100644

arch/arm/mach-tegra/board-paz00.c static struct gpiod_lookup_table wifi_gpio_lookup = { · line 42

Quoted 8 lines
arch/arm/mach-tegra/board-paz00.c +1 -1
@@ -36,7 +36,7 @@ static struct gpiod_lookup_table wifi_gpio_lookup = {
 
 void __init tegra_paz00_wifikill_init(void)
 {
-	platform_device_add_properties(&wifi_rfkill_device, wifi_rfkill_prop);
+	device_create_managed_software_node(&wifi_rfkill_device.dev, wifi_rfkill_prop, NULL);
 	gpiod_add_lookup_table(&wifi_gpio_lookup);
 	platform_device_register(&wifi_rfkill_device);
 }

Seems alright. Looks to be doing mostly the same thing as the original platform_device_add_properties() was doing, except for the node now being managed, which is irrelevant in this context.

Quoted 4 lines

I'm fine with Greg picking this up. I'm not aware of any other changes to this file that might cause a conflict for v5.15.

I'll pick it up, thanks!

greg k-h

#4 lore raw

PATCH RESEND 2/2 driver core: platform: Remove platform_device_add_properties()

In reply to Heikki Krogerus

There are no more users for it. The last place where it's called is in platform_device_register_full(). Replacing that call with device_create_managed_software_node() and removing the function.

---
 drivers/base/platform.c         | 20 ++------------------
 include/linux/platform_device.h |  2 --
 2 files changed, 2 insertions(+), 20 deletions(-)
drivers/base/platform.c +2 -18
index a94b7f4548814..652531f67135a 100644
@@ -641,22 +641,6 @@ int platform_device_add_data(struct platform_device *pdev, const void *data,
 }
 EXPORT_SYMBOL_GPL(platform_device_add_data);
 
-/**
- * platform_device_add_properties - add built-in properties to a platform device
- * @pdev: platform device to add properties to
- * @properties: null terminated array of properties to add
- *
- * The function will take deep copy of @properties and attach the copy to the
- * platform device. The memory associated with properties will be freed when the
- * platform device is released.
- */
-int platform_device_add_properties(struct platform_device *pdev,
-				   const struct property_entry *properties)
-{
-	return device_add_properties(&pdev->dev, properties);
-}
-EXPORT_SYMBOL_GPL(platform_device_add_properties);
-
 /**
  * platform_device_add - add a platform device to device hierarchy
  * @pdev: platform device we're adding
@@ -842,8 +826,8 @@ struct platform_device *platform_device_register_full(
 		goto err;
 
 	if (pdevinfo->properties) {
-		ret = platform_device_add_properties(pdev,
-						     pdevinfo->properties);
+		ret = device_create_managed_software_node(&pdev->dev,
+							  pdevinfo->properties, NULL);
 		if (ret)
 			goto err;
 	}
include/linux/platform_device.h +0 -2
index ed42ea9f60ba0..7c96f169d2740 100644
@@ -197,8 +197,6 @@ extern int platform_device_add_resources(struct platform_device *pdev,
 					 unsigned int num);
 extern int platform_device_add_data(struct platform_device *pdev,
 				    const void *data, size_t size);
-extern int platform_device_add_properties(struct platform_device *pdev,
-				const struct property_entry *properties);
 extern int platform_device_add(struct platform_device *pdev);
 extern void platform_device_del(struct platform_device *pdev);
 extern void platform_device_put(struct platform_device *pdev);
Signature · 1 line
2.30.2
Reviewed-by on v1 2/2
#5 lore raw
Quoted 11 lines · Heikki Krogerus

There are no more users for it. The last place where it's called is in platform_device_register_full(). Replacing that call with device_create_managed_software_node() and removing the function.

---
 drivers/base/platform.c         | 20 ++------------------
 include/linux/platform_device.h |  2 --
 2 files changed, 2 insertions(+), 20 deletions(-)

Indeed, no other users, and looks correct, too =):