driver core: remove software node from platform devices on device release
Subsystems (8)
v6 cover driver core: remove software node from platform devices on device release
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.
---
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,
Signature · 1 line
Bartosz Golaszewski <[email protected]>
PATCH v6 1/6 driver core: platform: remove software node on release()
If we pass a software node to a newly created device using struct platform_device_info, it will not be removed when the device is released. This may happen when a module creating the device is removed or on failure in platform_device_add().
When we try to reuse that software node in a subsequent call to platform_device_register_full(), it will fail with -EBUSY.
Provide a wrapper around the existing platform_device_release() that additonally calls device_remove_software_node() and use it to replace the former if we end up adding a software node.
While at it: check all three possible situations in which two software nodes for a single platform device can be created/assigned in platform_device_register_full() and bail-out early.
--- drivers/base/platform.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/base/platform.c +15 -1
@@ -606,6 +606,12 @@ static void platform_device_release(struct device *dev)kfree (pa); } +static void platform_device_release_full (struct device *dev) +{ +device_remove_software_node (dev); +platform_device_release (dev); +} +/** * platform_device_alloc - create a platform device * @name: base name of the device we're adding
@@ -848,7 +854,13 @@ struct platform_device *platform_device_register_full(const struct platform_deviint ret;struct platform_device *pdev; -if (pdevinfo->swnode && pdevinfo->properties) +/* +* Only one software node per device is allowed. Make sure we don't +* accept or create two. +*/ +if ((pdevinfo->swnode && pdevinfo->properties) || + (pdevinfo->swnode &&is_software_node (pdevinfo->fwnode)) || + (pdevinfo->properties &&is_software_node (pdevinfo->fwnode)))return ERR_PTR (-EINVAL ); pdev =platform_device_alloc (pdevinfo->name, pdevinfo->id);
@@ -878,6 +890,8 @@ struct platform_device *platform_device_register_full(const struct platform_devi ret =device_add_software_node (&pdev->dev, pdevinfo->swnode);if (ret) goto err; + + pdev->dev.release = platform_device_release_full; }else if (pdevinfo->properties) { ret =device_create_managed_software_node (&pdev->dev, pdevinfo->properties,NULL );
Signature · 1 line
2.47.3
PATCH v6 2/6 platform/surface: gpe: use platform_device_register_full()
In reply to Bartosz GolaszewskiCreating a software node for a given set of properties and adding it to a platform device can be achieved with a single call to platform_device_register_full(). There's nothing in this driver that suggests using the more fine-grained interfaces was intentional so switch to using the high-level helper.
--- drivers/platform/surface/surface_gpe.c | 36 +++++++++++----------------------- 1 file changed, 11 insertions(+), 25 deletions(-)
drivers/platform/surface/surface_gpe.c +11 -25
@@ -290,9 +290,9 @@ static struct platform_device *surface_gpe_device;static int __init surface_gpe_init (void ) { +struct platform_device_info pdevinfo;const struct dmi_system_id *match;struct platform_device *pdev; -struct fwnode_handle *fwnode;int status; match =dmi_first_match (dmi_lid_device_table);
@@ -305,34 +305,20 @@ static int __init surface_gpe_init(void)if (status)return status; - fwnode =fwnode_create_software_node (match->driver_data,NULL ); -if (IS_ERR (fwnode)) { - status =PTR_ERR (fwnode); - goto err_node; - } - - pdev =platform_device_alloc ("surface_gpe" ,PLATFORM_DEVID_NONE ); -if (!pdev) { - status = -ENOMEM ; - goto err_alloc; + pdevinfo = (struct platform_device_info ){ + .name ="surface_gpe" , + .id =PLATFORM_DEVID_NONE , + .properties = match->driver_data, + }; + + pdev =platform_device_register_full (&pdevinfo); +if (IS_ERR (pdev)) { +platform_driver_unregister (&surface_gpe_driver); +return PTR_ERR (pdev); } - pdev->dev.fwnode = fwnode; - - status =platform_device_add (pdev); -if (status) - goto err_add; - surface_gpe_device = pdev;return 0 ; - -err_add: -platform_device_put (pdev); -err_alloc: -fwnode_remove_software_node (fwnode); -err_node: -platform_driver_unregister (&surface_gpe_driver); -return status; }module_init (surface_gpe_init);
Signature · 1 line
2.47.3
Re: [PATCH v6 2/6] platform/surface: gpe: use platform_device_register_full()
Quoted 60 lines · Bartosz Golaszewski
Creating a software node for a given set of properties and adding it to a platform device can be achieved with a single call to
platform_device_register_full(). There's nothing in this driver that suggests using the more fine-grained interfaces was intentional so switch to using the high-level helper.Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/platform/surface/surface_gpe.c | 36 +++++++++++----------------------- 1 file changed, 11 insertions(+), 25 deletions(-)drivers/platform/surface/surface_gpe.c +11
-17@@ -290,9 +290,9 @@ static struct platform_device *surface_gpe_device;static int __init surface_gpe_init (void ) { +struct platform_device_info pdevinfo;const struct dmi_system_id *match;struct platform_device *pdev; -struct fwnode_handle *fwnode;int status; match =dmi_first_match (dmi_lid_device_table);@@ -305,34 +305,20 @@ static int __init surface_gpe_init(void)if (status)return status; - fwnode =fwnode_create_software_node (match->driver_data,NULL ); -if (IS_ERR (fwnode)) { - status =PTR_ERR (fwnode); - goto err_node; - } - - pdev =platform_device_alloc ("surface_gpe" ,PLATFORM_DEVID_NONE ); -if (!pdev) { - status = -ENOMEM ; - goto err_alloc; + pdevinfo = (struct platform_device_info ){ + .name ="surface_gpe" , + .id =PLATFORM_DEVID_NONE , + .properties = match->driver_data, + }; + + pdev =platform_device_register_full (&pdevinfo); +if (IS_ERR (pdev)) { +platform_driver_unregister (&surface_gpe_driver); +return PTR_ERR (pdev); } - pdev->dev.fwnode = fwnode; - - status =platform_device_add (pdev); -if (status) - goto err_add; - surface_gpe_device = pdev;return 0 ;
drivers/platform/surface/surface_gpe.c static int __init surface_gpe_init(void) · line 323
Quoted 10 lines
drivers/platform/surface/surface_gpe.c +0
-8- -err_add: -platform_device_put (pdev); -err_alloc: -fwnode_remove_software_node (fwnode); -err_node: -platform_driver_unregister (&surface_gpe_driver); -return status; }module_init (surface_gpe_init);
Signature · 1 line
i.
Re: [PATCH v6 2/6] platform/surface: gpe: use platform_device_register_full()
Quoted 66 lines · Ilpo Järvinen
Quoted 64 lines · Bartosz Golaszewski
Creating a software node for a given set of properties and adding it to a platform device can be achieved with a single call to
platform_device_register_full(). There's nothing in this driver that suggests using the more fine-grained interfaces was intentional so switch to using the high-level helper.Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/platform/surface/surface_gpe.c | 36 +++++++++++----------------------- 1 file changed, 11 insertions(+), 25 deletions(-)drivers/platform/surface/surface_gpe.c +11
-21@@ -290,9 +290,9 @@ static struct platform_device *surface_gpe_device;static int __init surface_gpe_init (void ) { +struct platform_device_info pdevinfo;const struct dmi_system_id *match;struct platform_device *pdev; -struct fwnode_handle *fwnode;int status; match =dmi_first_match (dmi_lid_device_table);@@ -305,34 +305,20 @@ static int __init surface_gpe_init(void)if (status)return status; - fwnode =fwnode_create_software_node (match->driver_data,NULL ); -if (IS_ERR (fwnode)) { - status =PTR_ERR (fwnode); - goto err_node; - } - - pdev =platform_device_alloc ("surface_gpe" ,PLATFORM_DEVID_NONE ); -if (!pdev) { - status = -ENOMEM ; - goto err_alloc; + pdevinfo = (struct platform_device_info ){ + .name ="surface_gpe" , + .id =PLATFORM_DEVID_NONE , + .properties = match->driver_data, + }; + + pdev =platform_device_register_full (&pdevinfo); +if (IS_ERR (pdev)) { +platform_driver_unregister (&surface_gpe_driver); +return PTR_ERR (pdev); } - pdev->dev.fwnode = fwnode; - - status =platform_device_add (pdev); -if (status) - goto err_add; - surface_gpe_device = pdev;return 0 ; - -err_add: -platform_device_put (pdev); -err_alloc:
Quoted 9 lines
drivers/platform/surface/surface_gpe.c static int __init surface_gpe_init(void) · line 323
Quoted 6 lines
drivers/platform/surface/surface_gpe.c +0
-4-fwnode_remove_software_node (fwnode); -err_node: -platform_driver_unregister (&surface_gpe_driver); -return status; }module_init (surface_gpe_init);Acked-by Ilpo Järvinen <[email protected]>
Hi!
Thanks but FYI: I will replace this series with a different approach once the rework of node assignment for platform devices lands upstream.
Bart
PATCH v6 3/6 drm/xe/i2c: use device_create_managed_software_node()
In reply to Bartosz GolaszewskiThis driver intentionally uses the fine-grained approach to creating platform devices. It assigns a software node as the primary firmware node of the device it creates. Ahead of improving the reference counting of platform device software nodes, switch to using device_create_managed_software_node(). This way, we create a dynamic software node whose life-time is tied to the device to which it's assigned.
--- drivers/gpu/drm/xe/xe_i2c.c | 22 ++++++++-------------- drivers/gpu/drm/xe/xe_i2c.h | 1 - 2 files changed, 8 insertions(+), 15 deletions(-)
drivers/gpu/drm/xe/xe_i2c.c +8 -14
@@ -93,13 +93,8 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c) {struct pci_dev *pci =to_pci_dev (i2c->drm_dev);struct platform_device *pdev; -struct fwnode_handle *fwnode;int ret; - fwnode =fwnode_create_software_node (xe_i2c_adapter_properties,NULL ); -if (IS_ERR (fwnode)) -return PTR_ERR (fwnode); -/* * Not using platform_device_register_full() here because we don't have * a handle to the platform_device before it returns. xe_i2c_notifier()
@@ -107,10 +102,14 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c)* platform_device_register_full() is done. */ pdev =platform_device_alloc (adapter_name,pci_dev_id (pci)); -if (!pdev) { - ret = -ENOMEM ; - goto err_fwnode_remove; - } +if (!pdev) +return -ENOMEM ; + + ret =device_create_managed_software_node (&pdev->dev, + xe_i2c_adapter_properties, +NULL ); +if (ret) + goto err_pdev_put;if (i2c->adapter_irq) {struct resource res;
@@ -123,8 +122,6 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c) } pdev->dev.parent = i2c->drm_dev; - pdev->dev.fwnode = fwnode; - i2c->adapter_node = fwnode; i2c->pdev = pdev; ret =platform_device_add (pdev);
@@ -135,8 +132,6 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c) err_pdev_put:platform_device_put (pdev); -err_fwnode_remove: -fwnode_remove_software_node (fwnode);return ret; }
@@ -144,7 +139,6 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c)static void xe_i2c_unregister_adapter (struct xe_i2c *i2c) {platform_device_unregister (i2c->pdev); -fwnode_remove_software_node (i2c->adapter_node); }/**
drivers/gpu/drm/xe/xe_i2c.h +0 -1
@@ -30,7 +30,6 @@ struct xe_i2c_endpoint { };struct xe_i2c { -struct fwnode_handle *adapter_node;struct platform_device *pdev;struct i2c_adapter *adapter;struct i2c_client *client[XE_I2C_MAX_CLIENTS ];
Signature · 1 line
2.47.3
PATCH v6 4/6 driver core: platform: unify release path
In reply to Bartosz GolaszewskiWith no drivers that manually assign software nodes to platform devices created with platform_device_alloc(), we can now unify the release path and remove platform_device_release_full().
--- drivers/base/platform.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/base/platform.c +11 -8
@@ -599,6 +599,7 @@ static void platform_device_release(struct device *dev) struct platform_object *pa = container_of(dev, struct platform_object, pdev.dev); +device_remove_software_node (dev);of_node_put (pa->pdev.dev.of_node);kfree (pa->pdev.dev.platform_data);kfree (pa->pdev.mfd_cell);
@@ -606,12 +607,6 @@ static void platform_device_release(struct device *dev)kfree (pa); } -static void platform_device_release_full (struct device *dev) -{ -device_remove_software_node (dev); -platform_device_release (dev); -} -/** * platform_device_alloc - create a platform device * @name: base name of the device we're adding
@@ -878,6 +873,16 @@ struct platform_device *platform_device_register_full(const struct platform_devi pdev->dev.coherent_dma_mask = pdevinfo->dma_mask; } +/* +* If the primary firmware node is a software node and there's no +* secondary firmware node, the primary will be affected by the call +* to device_remove_software_node() in platform_device_release() and +* its reference count will be dropped by one. Take another reference +* here to make it have no effect. +*/ +if (is_software_node (pdevinfo->fwnode)) +fwnode_handle_get (pdevinfo->fwnode); + ret =platform_device_add_resources (pdev, pdevinfo->res, pdevinfo->num_res);if (ret) goto err;
@@ -890,8 +895,6 @@ struct platform_device *platform_device_register_full(const struct platform_devi ret =device_add_software_node (&pdev->dev, pdevinfo->swnode);if (ret) goto err; - - pdev->dev.release = platform_device_release_full; }else if (pdevinfo->properties) { ret =device_create_managed_software_node (&pdev->dev, pdevinfo->properties,NULL );
Signature · 1 line
2.47.3
PATCH v6 5/6 kunit: provide kunit_software_node_register()
In reply to Bartosz GolaszewskiImplement a helper for registering kunit test-managed software nodes.
--- include/kunit/fwnode.h | 19 ++++++++++++++++++ lib/kunit/Makefile | 3 ++- lib/kunit/fwnode.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-)
include/kunit/fwnode.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* KUnit resource management helpers for firmware nodes. +* +* Copyright (C) Qualcomm Technologies, Inc. and/or its subsidiaries +*/ + +#ifndef _KUNIT_FWNODE_H +#define _KUNIT_FWNODE_H + +struct kunit ; +struct fwnode_handle ; +struct software_node ; + +struct fwnode_handle * +kunit_software_node_register (struct kunit *test, +const struct software_node *node); + +#endif /* _KUNIT_FWNODE_H */
lib/kunit/Makefile +2 -1
@@ -10,7 +10,8 @@ kunit-objs += test.o \ executor.o \ attributes.o \ device.o \ - platform.o + platform.o \ + fwnode.o ifeq ($(CONFIG_KUNIT_DEBUGFS),y) kunit-objs += debugfs.o
lib/kunit/fwnode.c new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
2.47.3
PATCH v6 6/6 driver core: platform: tests: add test cases for correct swnode removal
In reply to Bartosz GolaszewskiExtend the kunit module for platform devices with test cases verifying that the same software node can be added to platform devices repeatedly.
--- drivers/base/test/platform-device-test.c | 166 +++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+)
drivers/base/test/platform-device-test.c +166 -0
@@ -1,12 +1,15 @@// SPDX-License-Identifier: GPL-2.0 +#include <kunit/fwnode.h> #include <kunit/platform_device.h> #include <kunit/resource.h> #include <linux/device.h> #include <linux/device/bus.h> +#include <linux/fwnode.h> #include <linux/of_platform.h> #include <linux/platform_device.h> +#include <linux/property.h> #define DEVICE_NAME "test"
@@ -253,9 +256,172 @@ static struct kunit_suite platform_device_match_test_suite = { .test_cases = platform_device_match_tests, }; +static int platform_device_swnode_test_probe (struct platform_device *pdev) +{ +return 0 ; +} + +static struct platform_driver platform_swnode_test_driver = { + .probe = platform_device_swnode_test_probe, + .driver = { + .name =DEVICE_NAME , + }, +}; + +static const struct software_node platform_device_test_swnode = { }; + +/* +* Check that reusing a software node works correctly. If the call to +* platform_device_register_full() fails after adding the secondary firmware +* node, the software node must be unregistered in the device's release() +* callback or the subsequent call to platform_device_register_full() will fail +* with -EBUSY due to the software node already having been registered. +*/ +static void platform_device_swnode_add_twice (struct kunit *test) +{ +struct platform_device_info pdevinfo; +struct platform_device *pdev; +struct fwnode_handle fwnode; +int ret; + + ret =kunit_platform_driver_register (test, &platform_swnode_test_driver); +KUNIT_ASSERT_EQ (test, ret,0 ); + +fwnode_init (&fwnode,NULL ); + pdevinfo = (struct platform_device_info ){ + .name =DEVICE_NAME , + .id =PLATFORM_DEVID_NONE , + .fwnode = &fwnode, + .swnode = &platform_device_test_swnode, + }; + + pdev =platform_device_register_full (&pdevinfo); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, pdev); + +wait_for_device_probe (); +KUNIT_ASSERT_TRUE (test,device_is_bound (&pdev->dev)); + +platform_device_unregister (pdev); + + pdev =platform_device_register_full (&pdevinfo); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, pdev); + +wait_for_device_probe (); +KUNIT_ASSERT_TRUE (test,device_is_bound (&pdev->dev)); + +platform_device_unregister (pdev); +} + +/* +* Check that passing a software node as the primary firmware node of the +* platform device does not result in it being unregistered by the call to +* device_remove_software_node() in its release path. +*/ +static void platform_device_swnode_as_primary (struct kunit *test) +{ +struct platform_device_info pdevinfo; +struct platform_device *pdev; +struct fwnode_handle *fwnode; +int ret; + + ret =kunit_platform_driver_register (test, &platform_swnode_test_driver); +KUNIT_ASSERT_EQ (test, ret,0 ); + + fwnode =kunit_software_node_register (test, &platform_device_test_swnode); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, fwnode); + + pdevinfo = (struct platform_device_info ){ + .name =DEVICE_NAME , + .id =PLATFORM_DEVID_NONE , + .fwnode = fwnode, + }; + + pdev =platform_device_register_full (&pdevinfo); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, pdev); + +wait_for_device_probe (); +KUNIT_ASSERT_TRUE (test,device_is_bound (&pdev->dev)); + +platform_device_unregister (pdev); + +KUNIT_ASSERT_NOT_ERR_OR_NULL (test,software_node_fwnode (&platform_device_test_swnode)); +} + +/* +* Check that passing two software nodes to platform_device_register_full() +* fails. +*/ +static void platform_device_two_swnodes (struct kunit *test) +{ +static const struct property_entry properties[] = { +PROPERTY_ENTRY_U32 ("foo" ,42 ), + { } + }; + +struct platform_device_info pdevinfo; +struct platform_device *pdev; +struct fwnode_handle *fwnode; +int ret; + + ret =kunit_platform_driver_register (test, &platform_swnode_test_driver); +KUNIT_ASSERT_EQ (test, ret,0 ); + + fwnode =kunit_software_node_register (test, &platform_device_test_swnode); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, fwnode); + + pdevinfo = (struct platform_device_info ){ + .name =DEVICE_NAME , + .id =PLATFORM_DEVID_NONE , + .fwnode = fwnode, + .swnode = &platform_device_test_swnode, + }; + + pdev =platform_device_register_full (&pdevinfo); +KUNIT_ASSERT_TRUE (test,IS_ERR (pdev)); +KUNIT_ASSERT_EQ_MSG (test,PTR_ERR (pdev), -EINVAL , +"Expected errno == -EINVAL, got: %pe" , pdev); + + pdevinfo = (struct platform_device_info ){ + .name =DEVICE_NAME , + .id =PLATFORM_DEVID_NONE , + .swnode = &platform_device_test_swnode, + .properties = properties, + }; + + pdev =platform_device_register_full (&pdevinfo); +KUNIT_ASSERT_TRUE (test,IS_ERR (pdev)); +KUNIT_ASSERT_EQ_MSG (test,PTR_ERR (pdev), -EINVAL , +"Expected errno == -EINVAL, got: %pe" , pdev); + + pdevinfo = (struct platform_device_info ){ + .name =DEVICE_NAME , + .id =PLATFORM_DEVID_NONE , + .fwnode = fwnode, + .properties = properties, + }; + + pdev =platform_device_register_full (&pdevinfo); +KUNIT_ASSERT_TRUE (test,IS_ERR (pdev)); +KUNIT_ASSERT_EQ_MSG (test,PTR_ERR (pdev), -EINVAL , +"Expected errno == -EINVAL, got: %pe" , pdev); +} + +static struct kunit_case platform_device_swnode_tests[] = { +KUNIT_CASE (platform_device_swnode_add_twice), +KUNIT_CASE (platform_device_swnode_as_primary), +KUNIT_CASE (platform_device_two_swnodes), + {} +}; + +static struct kunit_suite platform_device_swnode_test_suite = { + .name ="platform-device-swnode" , + .test_cases = platform_device_swnode_tests, +}; +kunit_test_suites ( &platform_device_devm_test_suite, &platform_device_match_test_suite, + &platform_device_swnode_test_suite, );MODULE_DESCRIPTION ("Test module for platform devices" );
Signature · 1 line
2.47.3
Re: (subset) [PATCH v6 0/6] driver core: remove software node from platform devices on device release
In reply to Bartosz GolaszewskiQuoted 1 line · Bartosz Golaszewski
[PATCH v6 0/6] driver core: remove software node from platform devices on device release
Applied, thanks!
Branch: driver-core-linus
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
[1/6] driver core: platform: remove software node on release()
commit: 50030d63b4d3
The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).
The patch is queued up for Linus's tree and should land in the next -rc release.