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. Signed-off-by: Bartosz Golaszewski <[email protected]> --- 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 | 3 + drivers/base/test/swnode-devlink-test.c | 336 ++++++++++++++++++++++++++++++++ drivers/gpio/gpiolib-kunit.c | 272 +++++++++++++++++++++++++- include/kunit/fwnode.h | 26 +++ lib/kunit/Makefile | 1 + lib/kunit/fwnode.c | 116 +++++++++++ 9 files changed, 833 insertions(+), 7 deletions(-) --- base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482 change-id: 20260609-swnode-fw-devlink-cdc8dc4e5cb4 Best regards, -- Bartosz Golaszewski <[email protected]>

