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>
Cc: brgl@kernel.org, driver-core@lists.linux.dev,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kunit-dev@googlegroups.com,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
Andy Shevchenko <andriy.shevchenko@intel.com>
Subject: [PATCH v4 0/3] driver core: remove software node from platform devices on device release
Date: Thu, 30 Apr 2026 09:46:03 +0200 [thread overview]
Message-ID: <20260430-swnode-remove-on-dev-unreg-v4-0-01574da0aed3@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().
The second patch adds a new kunit helper which is used in patch 3/3 that
adds a test-case that can be used to reproduce the problem and prove that
the fix works as well as another making sure a corner case of using a
software node as the primary firmware node works too.
Merging strategy: patch 1/3 should go into v7.1. Once it's upstream, the
first tag containing it should be pulled into the driver core tree and
the remaining patches applied on top with an ack from the kunit
maintainers.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@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 (3):
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 | 19 +++-
drivers/base/test/platform-device-test.c | 168 +++++++++++++++++++++++++++++++
include/kunit/fwnode.h | 19 ++++
lib/kunit/Makefile | 3 +-
lib/kunit/fwnode.c | 52 ++++++++++
5 files changed, 259 insertions(+), 2 deletions(-)
---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260410-swnode-remove-on-dev-unreg-42bfc4b23ba8
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
next reply other threads:[~2026-04-30 7:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 7:46 Bartosz Golaszewski [this message]
2026-04-30 7:46 ` [PATCH v4 1/3] driver core: platform: remove software node on release() Bartosz Golaszewski
2026-04-30 12:02 ` Andy Shevchenko
2026-04-30 12:38 ` Bartosz Golaszewski
2026-05-11 7:33 ` Bartosz Golaszewski
2026-05-11 14:00 ` Danilo Krummrich
2026-05-11 14:17 ` Bartosz Golaszewski
2026-05-11 14:31 ` Danilo Krummrich
2026-05-11 14:50 ` Bartosz Golaszewski
2026-05-11 15:04 ` Danilo Krummrich
2026-05-11 16:08 ` Bartosz Golaszewski
2026-04-30 7:46 ` [PATCH v4 2/3] kunit: provide kunit_software_node_register() Bartosz Golaszewski
2026-04-30 7:46 ` [PATCH v4 3/3] driver core: platform: tests: add test cases for correct swnode removal Bartosz Golaszewski
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=20260430-swnode-remove-on-dev-unreg-v4-0-01574da0aed3@oss.qualcomm.com \
--to=bartosz.golaszewski@oss.qualcomm.com \
--cc=andriy.shevchenko@intel.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=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=raemoar63@gmail.com \
--cc=rafael@kernel.org \
/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
all inboxes | Powered by JetHome®