mbox series

[0/4] drivers: base: Don't match device with NULL of_node/fwnode/etc + tests

Message ID 20241210191353.533801-1-briannorris@chromium.org
Headers show
Series drivers: base: Don't match device with NULL of_node/fwnode/etc + tests | expand

Message

Brian Norris Dec. 10, 2024, 7:13 p.m. UTC
This series:
1. makes the behavior of_find_device_by_node(),
   bus_find_device_by_of_node(), bus_find_device_by_fwnode(), etc., more
   consistent when provided with a NULL node/handle;
2. adds kunit tests to validate the new NULL-argument behavior; and
3. makes some related improvements and refactoring for the drivers/base/
   kunit tests.

This series aims to prevent problems like the ones resolved in commit
5c8418cf4025 ("PCI/pwrctrl: Unregister platform device only if one
actually exists").


Brian Norris (4):
  drivers: base: Don't match devices with NULL of_node/fwnode/etc
  drivers: base: test: Enable device model tests with KUNIT_ALL_TESTS
  drivers: base: test: Drop "devm" from platform-device-test names
  drivers: base: test: Add ...find_device_by...(... NULL) tests

 drivers/base/core.c                      |  8 ++---
 drivers/base/test/Kconfig                |  1 +
 drivers/base/test/platform-device-test.c | 42 ++++++++++++++++++++----
 3 files changed, 40 insertions(+), 11 deletions(-)

Comments

Rob Herring (Arm) Dec. 11, 2024, 1:57 p.m. UTC | #1
On Tue, Dec 10, 2024 at 1:14 PM Brian Norris <briannorris@chromium.org> wrote:
>
> This series:
> 1. makes the behavior of_find_device_by_node(),
>    bus_find_device_by_of_node(), bus_find_device_by_fwnode(), etc., more
>    consistent when provided with a NULL node/handle;
> 2. adds kunit tests to validate the new NULL-argument behavior; and
> 3. makes some related improvements and refactoring for the drivers/base/
>    kunit tests.
>
> This series aims to prevent problems like the ones resolved in commit
> 5c8418cf4025 ("PCI/pwrctrl: Unregister platform device only if one
> actually exists").
>
>
> Brian Norris (4):
>   drivers: base: Don't match devices with NULL of_node/fwnode/etc
>   drivers: base: test: Enable device model tests with KUNIT_ALL_TESTS
>   drivers: base: test: Drop "devm" from platform-device-test names
>   drivers: base: test: Add ...find_device_by...(... NULL) tests
>
>  drivers/base/core.c                      |  8 ++---
>  drivers/base/test/Kconfig                |  1 +
>  drivers/base/test/platform-device-test.c | 42 ++++++++++++++++++++----
>  3 files changed, 40 insertions(+), 11 deletions(-)

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>