From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Brendan Higgins <brendan.higgins@linux.dev>,
David Gow <david@davidgow.net>, Rae Moar <raemoar63@gmail.com>,
Andy Shevchenko <andy@kernel.org>,
Maximilian Luz <luzmaximilian@gmail.com>,
Hans de Goede <hansg@kernel.org>,
Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>,
Matthew Brost <matthew.brost@intel.com>,
Thomas Hellström <thomas.hellstrom@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: brgl@kernel.org, driver-core@lists.linux.dev,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kunit-dev@googlegroups.com, platform-driver-x86@vger.kernel.org,
intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: [PATCH v6 0/6] driver core: remove software node from platform devices on device release
Date: Wed, 13 May 2026 17:04:47 +0200 [thread overview]
Message-ID: <20260513-swnode-remove-on-dev-unreg-v6-0-f9c58939df27@oss.qualcomm.com> (raw)
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().
In this approach we first provide a fix to an existing problem in v7.1
which requires a specialized release() variant, then address issues in
drivers where a unified approach would cause a regression and then merge
the two release() callbacks into one.
Merging strategy: patch 1 is a self-contained fix and should land in
v7.1. The rest of the commits can wait until patch 1 is upstream.
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 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-0035eff63812@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 (6):
driver core: platform: remove software node on release()
platform/surface: gpe: use platform_device_register_full()
drm/xe/i2c: use device_create_managed_software_node()
driver core: platform: unify release path
kunit: provide kunit_software_node_register()
driver core: platform: tests: add test cases for correct swnode removal
drivers/base/platform.c | 19 +++-
drivers/base/test/platform-device-test.c | 166 +++++++++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_i2c.c | 22 ++--
drivers/gpu/drm/xe/xe_i2c.h | 1 -
drivers/platform/surface/surface_gpe.c | 36 ++-----
include/kunit/fwnode.h | 19 ++++
lib/kunit/Makefile | 3 +-
lib/kunit/fwnode.c | 52 ++++++++++
8 files changed, 276 insertions(+), 42 deletions(-)
---
base-commit: 5d6919055dec134de3c40167a490f33c74c12581
change-id: 20260410-swnode-remove-on-dev-unreg-42bfc4b23ba8
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
next reply other threads:[~2026-05-13 15:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 15:04 Bartosz Golaszewski [this message]
2026-05-13 15:04 ` [PATCH v6 1/6] driver core: platform: remove software node on release() Bartosz Golaszewski
2026-05-16 1:52 ` Claude review: " Claude Code Review Bot
2026-05-13 15:04 ` [PATCH v6 2/6] platform/surface: gpe: use platform_device_register_full() Bartosz Golaszewski
2026-05-16 1:52 ` Claude review: " Claude Code Review Bot
2026-05-13 15:04 ` [PATCH v6 3/6] drm/xe/i2c: use device_create_managed_software_node() Bartosz Golaszewski
2026-05-16 1:52 ` Claude review: " Claude Code Review Bot
2026-05-13 15:04 ` [PATCH v6 4/6] driver core: platform: unify release path Bartosz Golaszewski
2026-05-16 1:52 ` Claude review: " Claude Code Review Bot
2026-05-13 15:04 ` [PATCH v6 5/6] kunit: provide kunit_software_node_register() Bartosz Golaszewski
2026-05-16 1:52 ` Claude review: " Claude Code Review Bot
2026-05-13 15:04 ` [PATCH v6 6/6] driver core: platform: tests: add test cases for correct swnode removal Bartosz Golaszewski
2026-05-16 1:52 ` Claude review: " Claude Code Review Bot
2026-05-14 0:24 ` (subset) [PATCH v6 0/6] driver core: remove software node from platform devices on device release Danilo Krummrich
2026-05-16 1:52 ` Claude review: " Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260513-swnode-remove-on-dev-unreg-v6-0-f9c58939df27@oss.qualcomm.com \
--to=bartosz.golaszewski@oss.qualcomm.com \
--cc=airlied@gmail.com \
--cc=andy@kernel.org \
--cc=brendan.higgins@linux.dev \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=david@davidgow.net \
--cc=dmitry.torokhov@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luzmaximilian@gmail.com \
--cc=matthew.brost@intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=raemoar63@gmail.com \
--cc=rafael@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=thomas.hellstrom@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox