This is a follow-up to the fix in platform device code that introduced platform_device_release_full(). With the two prerequisite patch series applied and with the two last remaining offenders converted, we can finally unify the release path for platform devices using platform_device_register_full() as well as those using the split approach of platform_device_alloc() + platform_device_add().
With an ack from DRM and platform maintainers, this can go through the driver core tree. Signed-off-by: Bartosz Golaszewski <[email protected]> --- Changes in v7: - Drop patch 1/6 as it's already upstream - Drop patch 5/6 as its been replaced by another changeset sent upstream - Lock device when calling device_is_bound() in kunit tests - Fix invalid reference put of the firmware node in surface_gpe - Rebase on top of recent driver core changes - Link to v6: https://patch.msgid.link/20260513-swnode-remove-on-dev-unreg-v6-0-f9c58939d...@oss.qualcomm.com Changes in v6: - Make patch 1 a minimal fix that can go into v7.1 - Don't provide platform_device_add_software_node(), instead: rework drivers in question to use other existing interfaces instead - Fix life-time issues in the xe_i2c patch and remove unneeded fwnode removal - Fix typos and tweak commit messages - Link to v5: https://patch.msgid.link/20260512-swnode-remove-on-dev-unreg-v5-0-0035eff63...@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-01574da0a...@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-533bdc71b...@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-0e5213cde...@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-cd7d305f3...@oss.qualcomm.com --- Bartosz Golaszewski (4): platform/surface: gpe: use platform_device_register_full() drm/xe/i2c: use device_create_managed_software_node() driver core: platform: unify release path driver core: platform: tests: add test cases for correct swnode removal drivers/base/platform.c | 19 ++-- drivers/base/test/platform-device-test.c | 180 +++++++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_i2c.c | 22 ++-- drivers/gpu/drm/xe/xe_i2c.h | 1 - drivers/platform/surface/surface_gpe.c | 39 ++----- 5 files changed, 210 insertions(+), 51 deletions(-) --- base-commit: 28a74302c6acf69768804a279eeb9eb2d9124956 change-id: 20260410-swnode-remove-on-dev-unreg-42bfc4b23ba8 prerequisite-message-id: [email protected] prerequisite-patch-id: 76dea1205a0905915a03c0d7c9e94399c92501e5 prerequisite-patch-id: f6c074c48e5eb2f5e92c57fa1320b6b0fab3ce1d prerequisite-patch-id: 07a0c422cc3233e2fe87cb9bbd6baab608d0de82 prerequisite-patch-id: 5e980cccbfdc82adef1573f8a8a9639689836432 prerequisite-patch-id: bb193e0baf41714061b83b3925cc4e28036f2b9c prerequisite-patch-id: 5ff0ac2c7c4cc548692ed5f567db30e27e920786 prerequisite-patch-id: deb425beb85441169aad53c1282f35df513b8015 prerequisite-patch-id: b0e9e719c8daf30d97c110478a5c3c7af106472c prerequisite-patch-id: 9f118a7cdb92893ed4e913c7c98bbdb766ff18c4 prerequisite-patch-id: 1b2391d8295e80086182f55e5189b9aa588687f8 prerequisite-patch-id: 986a0f4f9a682a255f6eef0fe2128a86c595ece5 prerequisite-patch-id: aae63ceb82cbe6f65810751e596e542df0ff513b prerequisite-patch-id: 155601719d4f5c433fd7dce63842007f255bec81 prerequisite-patch-id: f9bebca5cd8f5ebf9b52e9c688a3c83ddc7efb7f prerequisite-patch-id: aff2299bcf258e4e6dd1f01c591141385f31fdff prerequisite-patch-id: 51cfbca3ab011688be133a259d598007289237c4 prerequisite-patch-id: 0e9bddaa83a1f5a99745c2f50f7c3213d7b17fbd prerequisite-patch-id: 7ca12b7bbf0168eadaece00587dad68e1ff3cbec prerequisite-patch-id: 8d483c4b391ed1b95897c951555e7ab6c5807e2a prerequisite-patch-id: 495173352a585bdfd0c58721c8be0558d06a5335 prerequisite-message-id: [email protected] prerequisite-patch-id: d7f936bb1eb8e9fdc0a6a35770e376d36a0b595e prerequisite-patch-id: 77b6a4eb67cd6bcb6fbc974a4d0368be6a2810ef prerequisite-patch-id: 744bdc8ea502dab2db13b1cbe963c1db49c951f0 prerequisite-patch-id: 185deea7fe874a7d4a70c93e0b60cc3bbc75ec25 prerequisite-patch-id: d9e41fb8f4070e53ac293db82ccbad83c8d2a40b Best regards, -- Bartosz Golaszewski <[email protected]>
