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

Greg Kroah-Hartman
2024-06-04T14:12:20Z

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@linux.dev>
> Cc: David Gow <davidgow@google.com>
> Cc: Rae Moar <rmoar@google.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---
> 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@linuxfoundation.org>