driver core: count references of the platform device's fwnode, not OF node
Get series with b4
b4 am [email protected] change-id 20260520-pdev-fwnode-ref-d867836971ebVersions newest first
- v3 Latest20 patches 10 repliesIn review
- v219 patches 10 repliesSuperseded
- v123 patches 34 repliesApplied
Changes in v3 from the cover letter
- Use device_set_node() where applicable
- Use __free(device_node) in fsl iommu driver
- Don't use __free() where not really required
- Add a patch updating the kerneldoc for platform_device_alloc()
- Collect more tags
- Link to v2: https://patch.msgid.link/[email protected]
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/20 | powerpc/powermac: fix OF node refcountarch/ | +1 | 0 replies | |
| 2/20 | driver core: platform: provide platform_device_set_of_node()drivers/ include/ | +22 | 4 replies | |
| 3/20 | driver core: platform: provide platform_device_set_fwnode()drivers/ include/ | +22 | 0 replies | |
| 4/20 | driver core: platform: provide platform_device_set_of_node_from_dev()drivers/ include/ | +18 | 0 replies | |
| 5/20 | driver core: update kerneldoc for platform_device_alloc()drivers/ | +7 | 3 replies | |
| 6/20 | of: platform: use platform_device_set_of_node()drivers/ | +1 | 0 replies | |
| 7/20 | powerpc/powermac: use platform_device_set_of_node()arch/ | +1 | 0 replies | |
| 8/20 | i2c: pxa-pci: use platform_device_set_of_node()drivers/ | +2 | 0 replies | |
| 9/20 | iommu/fsl: use platform_device_set_of_node()drivers/ | +6 | 1 reply | |
| 10/20 | net: bcmgenet: use platform_device_set_of_node()drivers/ | +2 | 0 replies | |
| 11/20 | pmdomain: imx: use platform_device_set_of_node()drivers/ | +1 | 1 reply | |
| 12/20 | mfd: tps6586: use platform_device_set_of_node()drivers/ | +1 | 0 replies | |
| 13/20 | slimbus: qcom-ngd-ctrl: use platform_device_set_of_node()drivers/ | +1 | 0 replies | |
| 14/20 | net: mv643xx: use platform_device_set_of_node()drivers/ | +1 | 0 replies | |
| 15/20 | drm/xe/i2c: use platform_device_set_fwnode()drivers/ | +1 | 0 replies | |
| 16/20 | platform/surface: gpe: use platform_device_set_fwnode()drivers/ | +1 | 0 replies | |
| 17/20 | usb: chipidea: use platform_device_set_of_node_from_dev()drivers/ | +1 | 0 replies | |
| 18/20 | usb: musb: use platform_device_set_of_node_from_dev()drivers/ | +1 | 0 replies | |
| 19/20 | reset: rzg2l: use platform_device_set_of_node_from_dev()drivers/ | +1 | 0 replies | |
| 20/20 | driver core: platform: count references to all kinds of firmware nodesdrivers/ | +5 | 0 replies |
Reviews trailers per patch
19 of 20 patches have a Reviewed-by or Acked-by.
| Patch | Andy Shevchenko | Manuel Ebner | Rob Herring (Arm) | Andi Shyti | Wolfram Sang | Frank Li | Lee Jones | Konrad Dybcio | Robin Murphy | Jakub Kicinski | Ilpo Järvinen | Peter Chen | Philipp Zabel | Ulf Hansson |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1/20 | R-b | |||||||||||||
| 2/20 | R-b | R-b | ||||||||||||
| 3/20 | R-b | |||||||||||||
| 4/20 | R-b | |||||||||||||
| 5/20 | ||||||||||||||
| 6/20 | R-b | A-b | ||||||||||||
| 7/20 | R-b | |||||||||||||
| 8/20 | R-b | A-b | A-b | |||||||||||
| 9/20 | R-b | R-b | A-b | |||||||||||
| 10/20 | R-b | |||||||||||||
| 11/20 | R-b | R-b | A-b | |||||||||||
| 12/20 | R-b | A-b | ||||||||||||
| 13/20 | R-b | A-b | ||||||||||||
| 14/20 | R-b | A-b | ||||||||||||
| 15/20 | R-b | |||||||||||||
| 16/20 | R-b | A-b | ||||||||||||
| 17/20 | R-b | A-b | ||||||||||||
| 18/20 | R-b | |||||||||||||
| 19/20 | R-b | A-b | ||||||||||||
| 20/20 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 14 reviewers.
Cover letter [PATCH v3 00/20] driver core: count references of the platform device's fwnode, not OF node
Platform device core provides helper interfaces for dealing with dynamically created platform devices. Most users should use platform_device_register_full() which encapsulates most of the operations but some modules will want to use the split approach of calling platform_device_alloc() + platform_device_add() separately for various reasons.
With many platform devices now using dynamic software nodes as their primary firmware nodes and with the platform device interface being extended to also better cover the use-cases of secondary software nodes, I believe it makes sense to switch to counting the references of all kinds of firmware nodes.
To that end, I identified all users of platform_device_alloc() that also assign dev.of_node or dev.fwnode manually. I noticed five cases where the references are not increased as they should (patches 1-5 fix these users) and provided three new functions in platform_device.h that now become the preferred interfaces for assigning firmware nodes to dynamic platform devices (in line with platform_device_add_data(), platform_device_add_resources(), etc.). The bulk of the patches in this series are small driver conversions to port all users to going through the new functions that now encapsulate the refcount logic. With that done, the final patch seamlessly switches to counting the references of all firmware node types.
This effort is prerequisite of removing platform_device_release_full() and unifying the release path for dynamic platform devices using unmanaged software nodes.
Merging strategy: The entire series should go through the driver core tree, possibly with an immutable branch provided to solve any potential conflicts though these are rather unlikely.
---
Changes in v3:
- Use device_set_node() where applicable
- Use __free(device_node) in fsl iommu driver
- Don't use __free() where not really required
- Add a patch updating the kerneldoc for platform_device_alloc()
- Collect more tags
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Rebased on top of v7.2-rc1, dropped applied patches, collected tags
- Link to v1: https://patch.msgid.link/[email protected]
---
Bartosz Golaszewski (20):
powerpc/powermac: fix OF node refcount
driver core: platform: provide platform_device_set_of_node() driver core: platform: provide platform_device_set_fwnode() driver core: platform: provide platform_device_set_of_node_from_dev() driver core: update kerneldoc for platform_device_alloc()
of: platform: use platform_device_set_of_node() powerpc/powermac: use platform_device_set_of_node()
i2c: pxa-pci: use platform_device_set_of_node()
iommu/fsl: use platform_device_set_of_node()
net: bcmgenet: use platform_device_set_of_node()
pmdomain: imx: use platform_device_set_of_node()
mfd: tps6586: use platform_device_set_of_node()
slimbus: qcom-ngd-ctrl: use platform_device_set_of_node()
net: mv643xx: use platform_device_set_of_node() drm/xe/i2c: use platform_device_set_fwnode() platform/surface: gpe: use platform_device_set_fwnode()
usb: chipidea: use platform_device_set_of_node_from_dev()
usb: musb: use platform_device_set_of_node_from_dev()
reset: rzg2l: use platform_device_set_of_node_from_dev() driver core: platform: count references to all kinds of firmware nodes
arch/powerpc/platforms/powermac/low_i2c.c | 2 +- drivers/base/platform.c | 61 ++++++++++++++++++++++++++-- drivers/gpu/drm/xe/xe_i2c.c | 2 +- drivers/i2c/busses/i2c-pxa-pci.c | 3 +- drivers/iommu/fsl_pamu.c | 16 +++----- drivers/mfd/tps6586x.c | 2 +- drivers/net/ethernet/broadcom/genet/bcmmii.c | 3 +- drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +- drivers/of/platform.c | 2 +- drivers/platform/surface/surface_gpe.c | 2 +- drivers/pmdomain/imx/gpc.c | 3 +- drivers/reset/reset-rzg2l-usbphy-ctrl.c | 2 +- drivers/slimbus/qcom-ngd-ctrl.c | 2 +- drivers/usb/chipidea/core.c | 2 +- drivers/usb/musb/jz4740.c | 2 +- include/linux/platform_device.h | 9 ++++ 16 files changed, 88 insertions(+), 27 deletions(-)
---
base-commit: 8cdeaa50eae8dad34885515f62559ee83e7e8dda
change-id: 20260520-pdev-fwnode-ref-d867836971eb
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>