MAINTAINERS | 2 + drivers/base/swnode.c | 79 ++++++++ drivers/base/test/Kconfig | 5 + drivers/base/test/Makefile | 2 + drivers/base/test/swnode-devlink-test.c | 337 ++++++++++++++++++++++++++++++++ drivers/gpio/gpiolib-kunit.c | 291 ++++++++++++++++++++++++++- include/kunit/fwnode.h | 29 +++ lib/kunit/Makefile | 1 + lib/kunit/fwnode.c | 146 ++++++++++++++ 9 files changed, 885 insertions(+), 7 deletions(-)
Currently only devicetree systems have their devices' probe ordered
against their suppliers automatically by fw_devlink. Software nodes have
lately been used extensively treewide to describe references to resource
suppliers: most notably, the GPIO subsystem uses it in many places. Now
that the conversion of "dangling" GPIO chip software nodes to using real
links is almost done, it makes sense to ensure no needless probe
deferrals by implementing the add_links() callback from the fwnode
interface.
This series extends software node support to use fw_devlink and adds test
coverage for the new behaviour.
Patch 1 adds new kunit helpers that will be used later on for test
cases.
Patch 2 implements software_node_add_links() modelled on
of_fwnode_add_links(): for every reference property it resolves the
supplier and links to it. There's no allowlist like in DT - a software
node only carries a reference when its author explicitly wants one, so
every reference is an intentional supplier dependency. Graph
"remote-endpoint" references, unregistered supplier software nodes and
self-references are skipped. It also mirrors the device pointer onto a
secondary software node so fw_devlink can find the supplier device, and
purges the fwnode links on release.
Patches 3 and 5 add the tests: a kunit suite for the add_links() op
itself and GPIO tests for a real-life use-case: a GPIO consumer
referencing its provider via a software node.
Patch 4 proposes to add myself as a reviewer of software nodes.
Caveats: a supplier software node must be registered before the consumer
device is added, If the swnode is registered after the consumer was added,
add_links() has already run and set FWNODE_FLAG_LINKS_ADDED, so the late
supplier is missed. Graph/remote- endpoint ordering is left out for now as
well as there are no known users.
Merging strategy: with an Ack from Kunit maintainers, the entire series
can go through the driver core tree.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
Changes in v4:
- Extend patch 1 with an additional kunit helper:
kunit_device_add_software_node() and use it in patch 3/5 to fix the
release ordering
- Fix a memory leak in GPIO test cases pointed out by Danilo
- Fix more possible device_link_mq races: extend the coverage of
device_link_wait_removal()
- Link to v3: https://patch.msgid.link/20260710-swnode-fw-devlink-v3-0-993f31874e40@oss.qualcomm.com
Changes in v3:
- Use device_match_fwnode() where applicable
- Fix a race between the actions on the device_link_mq and the GPIO
test cases' swnode management
- Link to v2: https://patch.msgid.link/20260706-swnode-fw-devlink-v2-0-f39b09d50112@oss.qualcomm.com
Changes in v2:
- Use loop-local variables where applicable
- Reformat a long comment
- Keep trailing commas on array initializations which may potentially be
extended in the future
- Add missing headers
- Update MAINTAINERS in commit adding a new file
- Initialize arrays at declaration
- Fix signedness of ints where needed
- Remove unneeded DISABLE_STRUCTLEAK_PLUGIN switch for swnode tests
- Link to v1: https://patch.msgid.link/20260629-swnode-fw-devlink-v1-0-b90058b41839@oss.qualcomm.com
---
Bartosz Golaszewski (5):
kunit: provide a set of fwnode-oriented helpers
software node: add fw_devlink support
software node: add kunit tests for fw_devlink support
MAINTAINERS: add myself as reviewer of software node support
gpio: kunit: add test cases verifying swnode devlink support
MAINTAINERS | 2 +
drivers/base/swnode.c | 79 ++++++++
drivers/base/test/Kconfig | 5 +
drivers/base/test/Makefile | 2 +
drivers/base/test/swnode-devlink-test.c | 337 ++++++++++++++++++++++++++++++++
drivers/gpio/gpiolib-kunit.c | 291 ++++++++++++++++++++++++++-
include/kunit/fwnode.h | 29 +++
lib/kunit/Makefile | 1 +
lib/kunit/fwnode.c | 146 ++++++++++++++
9 files changed, 885 insertions(+), 7 deletions(-)
---
base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa
change-id: 20260609-swnode-fw-devlink-cdc8dc4e5cb4
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
On Mon, 13 Jul 2026 13:14:43 +0200, Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> said: > Currently only devicetree systems have their devices' probe ordered > against their suppliers automatically by fw_devlink. Software nodes have > lately been used extensively treewide to describe references to resource > suppliers: most notably, the GPIO subsystem uses it in many places. Now > that the conversion of "dangling" GPIO chip software nodes to using real > links is almost done, it makes sense to ensure no needless probe > deferrals by implementing the add_links() callback from the fwnode > interface. > > This series extends software node support to use fw_devlink and adds test > coverage for the new behaviour. > > Patch 1 adds new kunit helpers that will be used later on for test > cases. > > Patch 2 implements software_node_add_links() modelled on > of_fwnode_add_links(): for every reference property it resolves the > supplier and links to it. There's no allowlist like in DT - a software > node only carries a reference when its author explicitly wants one, so > every reference is an intentional supplier dependency. Graph > "remote-endpoint" references, unregistered supplier software nodes and > self-references are skipped. It also mirrors the device pointer onto a > secondary software node so fw_devlink can find the supplier device, and > purges the fwnode links on release. > > Patches 3 and 5 add the tests: a kunit suite for the add_links() op > itself and GPIO tests for a real-life use-case: a GPIO consumer > referencing its provider via a software node. > > Patch 4 proposes to add myself as a reviewer of software nodes. > > Caveats: a supplier software node must be registered before the consumer > device is added, If the swnode is registered after the consumer was added, > add_links() has already run and set FWNODE_FLAG_LINKS_ADDED, so the late > supplier is missed. Graph/remote- endpoint ordering is left out for now as > well as there are no known users. > > Merging strategy: with an Ack from Kunit maintainers, the entire series > can go through the driver core tree. > Just a clarification: patch 5/5 will conflict with current gpio/for-next so this one would have to go through the GPIO tree. An immutable branch with commits 1-4 would be great. Bart
On Mon, 13 Jul 2026 13:14:43 +0200, Bartosz Golaszewski wrote:
> [PATCH v4 0/5] software node: provide support for fw_devlink
Applied, thanks!
Branch: topic/swnode
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
[1/5] kunit: provide a set of fwnode-oriented helpers
commit: 9fdbdb528488
[2/5] software node: add fw_devlink support
commit: 37e586675993
[3/5] software node: add kunit tests for fw_devlink support
commit: eecba5978729
[4/5] MAINTAINERS: add myself as reviewer of software node support
commit: 122630406245
The patches are in the topic/swnode topic branch and will be merged into the
corresponding target branch soon.
On Wed Jul 15, 2026 at 11:28 PM CEST, Danilo Krummrich wrote: > On Mon, 13 Jul 2026 13:14:43 +0200, Bartosz Golaszewski wrote: >> [PATCH v4 0/5] software node: provide support for fw_devlink > > Applied, thanks! > > Branch: topic/swnode > Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git > > [1/5] kunit: provide a set of fwnode-oriented helpers > commit: 9fdbdb528488 > [2/5] software node: add fw_devlink support > commit: 37e586675993 > [3/5] software node: add kunit tests for fw_devlink support > commit: eecba5978729 > [4/5] MAINTAINERS: add myself as reviewer of software node support > commit: 122630406245 > > The patches are in the topic/swnode topic branch and will be merged into the > corresponding target branch soon. I will provide a signed tag once I have the 0-day result. Thanks, Danilo
On Wed Jul 15, 2026 at 11:30 PM CEST, Danilo Krummrich wrote: > On Wed Jul 15, 2026 at 11:28 PM CEST, Danilo Krummrich wrote: >> On Mon, 13 Jul 2026 13:14:43 +0200, Bartosz Golaszewski wrote: >>> [PATCH v4 0/5] software node: provide support for fw_devlink >> >> Applied, thanks! >> >> Branch: topic/swnode >> Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git >> >> [1/5] kunit: provide a set of fwnode-oriented helpers >> commit: 9fdbdb528488 >> [2/5] software node: add fw_devlink support >> commit: 37e586675993 >> [3/5] software node: add kunit tests for fw_devlink support >> commit: eecba5978729 >> [4/5] MAINTAINERS: add myself as reviewer of software node support >> commit: 122630406245 >> >> The patches are in the topic/swnode topic branch and will be merged into the >> corresponding target branch soon. > > I will provide a signed tag once I have the 0-day result. https://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git/tag/?h=swnode-7.3-rc1 The changes are also in driver-core-next now, thanks!
On Fri, 17 Jul 2026 15:49:55 +0200, Danilo Krummrich <dakr@kernel.org> said: > On Wed Jul 15, 2026 at 11:30 PM CEST, Danilo Krummrich wrote: >> On Wed Jul 15, 2026 at 11:28 PM CEST, Danilo Krummrich wrote: >>> On Mon, 13 Jul 2026 13:14:43 +0200, Bartosz Golaszewski wrote: >>>> [PATCH v4 0/5] software node: provide support for fw_devlink >>> >>> Applied, thanks! >>> >>> Branch: topic/swnode >>> Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git >>> >>> [1/5] kunit: provide a set of fwnode-oriented helpers >>> commit: 9fdbdb528488 >>> [2/5] software node: add fw_devlink support >>> commit: 37e586675993 >>> [3/5] software node: add kunit tests for fw_devlink support >>> commit: eecba5978729 >>> [4/5] MAINTAINERS: add myself as reviewer of software node support >>> commit: 122630406245 >>> >>> The patches are in the topic/swnode topic branch and will be merged into the >>> corresponding target branch soon. >> >> I will provide a signed tag once I have the 0-day result. > > https://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git/tag/?h=swnode-7.3-rc1 > > The changes are also in driver-core-next now, thanks! > Pulled, thanks! Bartosz
© 2016 - 2026 Red Hat, Inc.