The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v5 0/7] driver core: remove software node from platform devices on device release
@ 2026-05-12 11:59 Bartosz Golaszewski
  2026-05-12 11:59 ` [PATCH v5 1/7] platform/surface: gpe: use platform_device_register_full() Bartosz Golaszewski
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Bartosz Golaszewski @ 2026-05-12 11:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Dmitry Torokhov, Brendan Higgins, David Gow, Rae Moar,
	Andy Shevchenko, Maximilian Luz, Hans de Goede,
	Ilpo Järvinen, Matthew Brost, Thomas Hellström,
	Rodrigo Vivi, David Airlie, Simona Vetter
  Cc: brgl, driver-core, linux-kernel, linux-kselftest, kunit-dev,
	platform-driver-x86, intel-xe, dri-devel, Bartosz Golaszewski,
	Andy Shevchenko

This fixes an issue in platform device code where, if we specify a
software node for a platform device using struct platform_device_info,
it will not be removed on device .release().

This is an extended approach from v4 where we also first introduce
necessary changes in drivers where the fix may cause a regression.

Merging strategy: Danilo suggested that the new interface we add in this
series as well as prerequisite driver changes can still land in v7.1 so I
think the entire series should go upstream through the driver core. The first
5 patches are part of the fix and the remaining two add tests which
can't really do harm.

DRM and platform maintainers: please Ack the two driver patches in this
series.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
Changes in v5:
- Provide a helper for users of platform_device_alloc() that wish to
  assign a software node to a platform device
- Rework drivers that could regress after the swnode leak fix
- Split the series into several patches as necessary
- Link to v4: https://patch.msgid.link/20260430-swnode-remove-on-dev-unreg-v4-0-01574da0aed3@oss.qualcomm.com

Changes in v4:
- Drop redundant !pdevinfo->swnode check in
  platform_device_register_full()
- Handle all three combinations with which two software nodes can be
  assigned to a platform device
- Extend the new kunit test to verify all three combinations
- Link to v3: https://patch.msgid.link/20260428-swnode-remove-on-dev-unreg-v3-0-533bdc71b22e@oss.qualcomm.com

Changes in v3:
- Make sure the reference of the primary software node we possibly take,
  is always released by moving the get() before calls that may fail
- Don't allow passing two software nodes
- Add a test case for that situation
- Link to v2: https://patch.msgid.link/20260423-swnode-remove-on-dev-unreg-v2-0-0e5213cde2ed@oss.qualcomm.com

Changes in v2:
- Change the order between removing the software node and dropping the
  reference to the device's OF node
- Address a situation where a software node is used as the primary
  firmware node
- Add a patch adding a new kunit helper
- Add another test case
- Link to v1: https://patch.msgid.link/20260410-swnode-remove-on-dev-unreg-v1-0-cd7d305f3db2@oss.qualcomm.com

---
Bartosz Golaszewski (7):
      platform/surface: gpe: use platform_device_register_full()
      driver core: platform: make the swnode check stricter
      driver core: platform: provide platform_device_add_software_node()
      drm/xe/i2c: use platform_device_add_software_node()
      driver core: platform: remove software node on release()
      kunit: provide kunit_software_node_register()
      driver core: platform: tests: add test cases for correct swnode removal

 drivers/base/platform.c                  |  44 +++++++-
 drivers/base/test/platform-device-test.c | 168 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_i2c.c              |  21 ++--
 drivers/platform/surface/surface_gpe.c   |  36 ++-----
 include/kunit/fwnode.h                   |  19 ++++
 include/linux/platform_device.h          |   3 +
 lib/kunit/Makefile                       |   3 +-
 lib/kunit/fwnode.c                       |  52 ++++++++++
 8 files changed, 307 insertions(+), 39 deletions(-)
---
base-commit: 5d6919055dec134de3c40167a490f33c74c12581
change-id: 20260410-swnode-remove-on-dev-unreg-42bfc4b23ba8

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


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

end of thread, other threads:[~2026-05-12 18:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 11:59 [PATCH v5 0/7] driver core: remove software node from platform devices on device release Bartosz Golaszewski
2026-05-12 11:59 ` [PATCH v5 1/7] platform/surface: gpe: use platform_device_register_full() Bartosz Golaszewski
2026-05-12 11:59 ` [PATCH v5 2/7] driver core: platform: make the swnode check stricter Bartosz Golaszewski
2026-05-12 11:59 ` [PATCH v5 3/7] driver core: platform: provide platform_device_add_software_node() Bartosz Golaszewski
2026-05-12 16:31   ` Danilo Krummrich
2026-05-12 18:15     ` Dmitry Torokhov
2026-05-12 11:59 ` [PATCH v5 4/7] drm/xe/i2c: use platform_device_add_software_node() Bartosz Golaszewski
2026-05-12 16:24   ` Danilo Krummrich
2026-05-12 11:59 ` [PATCH v5 5/7] driver core: platform: remove software node on release() Bartosz Golaszewski
2026-05-12 11:59 ` [PATCH v5 6/7] kunit: provide kunit_software_node_register() Bartosz Golaszewski
2026-05-12 15:28   ` Andy Shevchenko
2026-05-12 11:59 ` [PATCH v5 7/7] driver core: platform: tests: add test cases for correct swnode removal Bartosz Golaszewski
2026-05-12 15:07 ` [PATCH v5 0/7] driver core: remove software node from platform devices on device release Danilo Krummrich

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