Skip to contentSkip to conversation

ACPI: arm64: use platform_device_set_fwnode()

PATCH Applied Bartosz Golaszewski 3 participants 7 messages Jul 28 – Aug 7

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

cover ACPI: arm64: use platform_device_set_fwnode()

Note: This must go through the driver core tree where the prerequisite commit 8877c06885ce ("driver core: platform: provide platform_device_set_fwnode()") lives before the upcoming merge window!

A series of recent changes in platform device code provided the platform_device_set_fwnode() helper but later changes converted all its users to different APIs. The function however should be used whenever a dynamically allocated platform device gets a firmware node assigned so use it in two such cases in ACPI arm64 drivers.

---
Bartosz Golaszewski (2):
ACPI/APMT: use platform_device_set_fwnode()
ACPI/IORT: use platform_device_set_fwnode()

 drivers/acpi/arm64/apmt.c | 2 +-
 drivers/acpi/arm64/iort.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

---
base-commit: 0d33d21e47d9dc66f91e44da3fc9220c74d93df7
change-id: 20260728-acpi-arm64-pdev-set-fwnode-1d50f24a5c12

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>
#1 lore raw

PATCH 1/2 ACPI/APMT: use platform_device_set_fwnode()

Platform devices using the split approach of calling platform_device_alloc() and platform_device_add() must not assign the firmware nodes manually but use the provided platform_device_set_fwnode() function which additionally makes sure we track the reference count of the firmware node correctly.

Replace the manual assignment of the firmware node with a call to platform_device_set_fwnode().

---
 drivers/acpi/arm64/apmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/arm64/apmt.c +1 -1
index bb010f6164e528acd802f65afd80d65a57f5844f..c927e4f08ec2c98137d4e3c64ec1709d672ad9a2 100644
@@ -99,7 +99,7 @@ static int __init apmt_add_platform_device(struct acpi_apmt_node *node,
 	if (ret)
 		goto dev_put;
 
-	pdev->dev.fwnode = fwnode;
+	platform_device_set_fwnode(pdev, fwnode);
 
 	ret = platform_device_add(pdev);
 
Signature · 1 line
2.47.3
maintainer Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] ACPI/APMT: use platform_device_set_fwnode()

Quoted 9 lines · Bartosz Golaszewski

Platform devices using the split approach of calling platform_device_alloc() and platform_device_add() must not assign the firmware nodes manually but use the provided platform_device_set_fwnode() function which additionally makes sure we track the reference count of the firmware node correctly.

Replace the manual assignment of the firmware node with a call to platform_device_set_fwnode().

I don't see platform_device_set_fwnode() in the upstream tree, is it in -next ? I didn't see -next tag as well.

Quoted 10 lines
---
 drivers/acpi/arm64/apmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/arm64/apmt.c +0 -0
index bb010f6164e528acd802f65afd80d65a57f5844f..c927e4f08ec2c98137d4e3c64ec1709d672ad9a2 100644

drivers/acpi/arm64/apmt.c static int __init apmt_add_platform_device(struct acpi_apmt_node *node, · line 103

Quoted 6 lines
drivers/acpi/arm64/apmt.c +1 -1
@@ -99,7 +99,7 @@ static int __init apmt_add_platform_device(struct acpi_apmt_node *node,
 	if (ret)
 		goto dev_put;
 
-	pdev->dev.fwnode = fwnode;
+	platform_device_set_fwnode(pdev, fwnode);
 

Assuming platform_device_set_fwnode() does what is needed,

Signature · 2 lines
Regards,
Sudeep
#3 lore raw

Re: [PATCH 1/2] ACPI/APMT: use platform_device_set_fwnode()

Quoted 2 lines · Sudeep Holla

I don't see platform_device_set_fwnode() in the upstream tree, is it in -next ? I didn't see -next tag as well.

It should be contained in linux-next through driver-core-next.

#4 lore raw

PATCH 2/2 ACPI/IORT: use platform_device_set_fwnode()

In reply to Bartosz Golaszewski

Platform devices using the split approach of calling platform_device_alloc() and platform_device_add() must not assign the firmware nodes manually but use the provided platform_device_set_fwnode() function which additionally makes sure we track the reference count of the firmware node correctly.

Replace the manual assignment of the firmware node with a call to platform_device_set_fwnode().

---
 drivers/acpi/arm64/iort.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/arm64/iort.c +1 -1
index 34412cd697d8bdc3654c40ca539ddc695a926a26..1020ac953e428797b5b90bd73c6c6ae35e6fd352 100644
@@ -1992,7 +1992,7 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node,
 		goto dev_put;
 	}
 
-	pdev->dev.fwnode = fwnode;
+	platform_device_set_fwnode(pdev, fwnode);
 
 	if (ops->dev_dma_configure)
 		ops->dev_dma_configure(&pdev->dev, node);
Signature · 1 line
2.47.3
maintainer Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] ACPI/IORT: use platform_device_set_fwnode()

Quoted 19 lines · Bartosz Golaszewski

Platform devices using the split approach of calling platform_device_alloc() and platform_device_add() must not assign the firmware nodes manually but use the provided platform_device_set_fwnode() function which additionally makes sure we track the reference count of the firmware node correctly.

Replace the manual assignment of the firmware node with a call to platform_device_set_fwnode().

---
 drivers/acpi/arm64/iort.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/arm64/iort.c +0 -0
index 34412cd697d8bdc3654c40ca539ddc695a926a26..1020ac953e428797b5b90bd73c6c6ae35e6fd352 100644

drivers/acpi/arm64/iort.c static int __init iort_add_platform_device(struct acpi_iort_node *node, · line 1996

Quoted 6 lines
drivers/acpi/arm64/iort.c +1 -1
@@ -1992,7 +1992,7 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node,
 		goto dev_put;
 	}
 
-	pdev->dev.fwnode = fwnode;
+	platform_device_set_fwnode(pdev, fwnode);
 

With the condition specified in 1/2. I assume you plan to take it via the same tree that introduces platform_device_set_fwnode() ?

Signature · 2 lines
Regards,
Sudeep
#6 lore raw
In reply to Bartosz Golaszewski
Quoted 1 line · Bartosz Golaszewski

[PATCH 0/2] ACPI: arm64: use platform_device_set_fwnode()

Applied, thanks!

Branch: driver-core-testing
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git

[1/2] ACPI/APMT: use platform_device_set_fwnode()

      commit: 5ab289f5eabc
[2/2] ACPI/IORT: use platform_device_set_fwnode()
      commit: 67b1e7245bd6

The patches will appear in the next linux-next integration (typically within 24 hours on weekdays).

The patches are in the driver-core-testing branch and will be promoted to driver-core-next after validation.