Netdev List
 help / color / mirror / Atom feed
* [PATCH v2 00/19] driver core: count references of the platform device's fwnode, not OF node
@ 2026-06-29  9:12 Bartosz Golaszewski
  2026-06-29  9:12 ` [PATCH v2 01/19] powerpc/powermac: fix OF node refcount Bartosz Golaszewski
                   ` (19 more replies)
  0 siblings, 20 replies; 24+ messages in thread
From: Bartosz Golaszewski @ 2026-06-29  9:12 UTC (permalink / raw)
  To: Lee Jones, Mark Brown, Thierry Reding, Sebastian Hesselbarth,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Srinivas Kandagatla, Greg Kroah-Hartman, Vinod Koul,
	Rafael J. Wysocki, Danilo Krummrich, Rob Herring, Saravana Kannan,
	Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Andi Shyti, Andy Shevchenko,
	Joerg Roedel, Will Deacon, Robin Murphy, Doug Berger,
	Florian Fainelli, Broadcom internal kernel review list,
	Ulf Hansson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Matthew Brost, Thomas Hellström, Rodrigo Vivi,
	David Airlie, Simona Vetter, Peter Chen, Paul Cercueil, Bin Liu,
	Philipp Zabel, Maximilian Luz, Hans de Goede, Ilpo Järvinen,
	Krzysztof Kozlowski, Benjamin Herrenschmidt
  Cc: brgl, linux-kernel, netdev, linux-arm-msm, linux-sound,
	driver-core, devicetree, linuxppc-dev, linux-i2c, iommu, linux-pm,
	imx, linux-arm-kernel, intel-xe, dri-devel, linux-usb, linux-mips,
	platform-driver-x86, Bartosz Golaszewski, stable, Wolfram Sang

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.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
Changes in v2:
- Rebased on top of v7.2-rc1, dropped applied patches, collected tags
- Link to v1: https://patch.msgid.link/20260521-pdev-fwnode-ref-v1-0-88c324a1b8d2@oss.qualcomm.com

---
Bartosz Golaszewski (19):
      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()
      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                      | 56 ++++++++++++++++++++++++++--
 drivers/gpu/drm/xe/xe_i2c.c                  |  2 +-
 drivers/i2c/busses/i2c-pxa-pci.c             |  3 +-
 drivers/iommu/fsl_pamu.c                     |  7 ++--
 drivers/mfd/tps6586x.c                       |  2 +-
 drivers/net/ethernet/broadcom/genet/bcmmii.c | 10 +++--
 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              |  8 ++++
 16 files changed, 84 insertions(+), 23 deletions(-)
---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260520-pdev-fwnode-ref-d867836971eb

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2026-06-29 16:23 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29  9:12 [PATCH v2 00/19] driver core: count references of the platform device's fwnode, not OF node Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 01/19] powerpc/powermac: fix OF node refcount Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 02/19] driver core: platform: provide platform_device_set_of_node() Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 03/19] driver core: platform: provide platform_device_set_fwnode() Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 04/19] driver core: platform: provide platform_device_set_of_node_from_dev() Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 05/19] of: platform: use platform_device_set_of_node() Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 06/19] powerpc/powermac: " Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 07/19] i2c: pxa-pci: " Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 08/19] iommu/fsl: " Bartosz Golaszewski
2026-06-29 14:08   ` Frank Li
2026-06-29  9:12 ` [PATCH v2 09/19] net: bcmgenet: " Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 10/19] pmdomain: imx: " Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 11/19] mfd: tps6586: " Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 12/19] slimbus: qcom-ngd-ctrl: " Bartosz Golaszewski
2026-06-29  9:25   ` Konrad Dybcio
2026-06-29  9:12 ` [PATCH v2 13/19] net: mv643xx: " Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 14/19] drm/xe/i2c: use platform_device_set_fwnode() Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 15/19] platform/surface: gpe: " Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 16/19] usb: chipidea: use platform_device_set_of_node_from_dev() Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 17/19] usb: musb: " Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 18/19] reset: rzg2l: " Bartosz Golaszewski
2026-06-29  9:12 ` [PATCH v2 19/19] driver core: platform: count references to all kinds of firmware nodes Bartosz Golaszewski
2026-06-29 16:21   ` Andy Shevchenko
2026-06-29 16:23 ` [PATCH v2 00/19] driver core: count references of the platform device's fwnode, not OF node Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox