]> www.infradead.org Git - users/jedix/linux-maple.git/commit
platform: Add test managed platform_device/driver APIs
authorStephen Boyd <sboyd@kernel.org>
Thu, 18 Jul 2024 21:05:04 +0000 (14:05 -0700)
committerStephen Boyd <sboyd@kernel.org>
Mon, 29 Jul 2024 22:33:12 +0000 (15:33 -0700)
commit5ac79730324c6f37106ce397586020ffe6e8e234
tree0c8fec572ffdfea545dbd6cd4303965cf1a12e37
parent5c9dd72d8385c2b02c6e31a0f59f777d8a26a218
platform: Add test managed platform_device/driver APIs

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>
Reviewed-by: David Gow <davidgow@google.com>
Cc: Rae Moar <rmoar@google.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240718210513.3801024-6-sboyd@kernel.org
Documentation/dev-tools/kunit/api/index.rst
Documentation/dev-tools/kunit/api/platformdevice.rst [new file with mode: 0644]
drivers/base/dd.c
include/kunit/platform_device.h [new file with mode: 0644]
lib/kunit/Makefile
lib/kunit/platform-test.c [new file with mode: 0644]
lib/kunit/platform.c [new file with mode: 0644]