Re: [PATCH v5 06/11] platform: Add test managed platform_device/driver APIs

From: Greg Kroah-Hartman
Date: Tue Jun 04 2024 - 10:14:54 EST


On Mon, Jun 03, 2024 at 03:38:03PM -0700, Stephen Boyd wrote:
> Introduce KUnit resource wrappers around platform_driver_register(),
> platform_device_alloc(), and platform_device_add() so that test authors
> can register platform drivers/devices from their tests and have the
> drivers/devices automatically be unregistered when the test is done.
>
> This makes test setup code simpler when a platform driver or platform
> device is needed. Add a few test cases at the same time to make sure the
> APIs work as intended.
>
> Cc: Brendan Higgins <brendan.higgins@xxxxxxxxx>
> Cc: David Gow <davidgow@xxxxxxxxxx>
> Cc: Rae Moar <rmoar@xxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
> Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx>
> ---
> Documentation/dev-tools/kunit/api/index.rst | 5 +
> .../dev-tools/kunit/api/platformdevice.rst | 10 +
> include/kunit/platform_device.h | 20 ++
> lib/kunit/Makefile | 4 +-
> lib/kunit/platform-test.c | 223 +++++++++++++
> lib/kunit/platform.c | 302 ++++++++++++++++++
> 6 files changed, 563 insertions(+), 1 deletion(-)
> create mode 100644 Documentation/dev-tools/kunit/api/platformdevice.rst
> create mode 100644 include/kunit/platform_device.h
> create mode 100644 lib/kunit/platform-test.c
> create mode 100644 lib/kunit/platform.c

Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>