summaryrefslogtreecommitdiff
path: root/Documentation/dev-tools
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@kernel.org>2024-07-18 14:05:04 -0700
committerStephen Boyd <sboyd@kernel.org>2024-07-29 15:33:12 -0700
commit5ac79730324c6f37106ce397586020ffe6e8e234 (patch)
tree0c8fec572ffdfea545dbd6cd4303965cf1a12e37 /Documentation/dev-tools
parent5c9dd72d8385c2b02c6e31a0f59f777d8a26a218 (diff)
downloadlinux-5ac79730324c6f37106ce397586020ffe6e8e234.tar.gz
linux-5ac79730324c6f37106ce397586020ffe6e8e234.tar.bz2
linux-5ac79730324c6f37106ce397586020ffe6e8e234.zip
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
Diffstat (limited to 'Documentation/dev-tools')
-rw-r--r--Documentation/dev-tools/kunit/api/index.rst5
-rw-r--r--Documentation/dev-tools/kunit/api/platformdevice.rst10
2 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/dev-tools/kunit/api/index.rst b/Documentation/dev-tools/kunit/api/index.rst
index 282befa17edf..02b26f5e8750 100644
--- a/Documentation/dev-tools/kunit/api/index.rst
+++ b/Documentation/dev-tools/kunit/api/index.rst
@@ -10,6 +10,7 @@ API Reference
resource
functionredirection
of
+ platformdevice
This page documents the KUnit kernel testing API. It is divided into the
@@ -36,3 +37,7 @@ Driver KUnit API
Documentation/dev-tools/kunit/api/of.rst
- Documents the KUnit device tree (OF) API
+
+Documentation/dev-tools/kunit/api/platformdevice.rst
+
+ - Documents the KUnit platform device API
diff --git a/Documentation/dev-tools/kunit/api/platformdevice.rst b/Documentation/dev-tools/kunit/api/platformdevice.rst
new file mode 100644
index 000000000000..49ddd5729003
--- /dev/null
+++ b/Documentation/dev-tools/kunit/api/platformdevice.rst
@@ -0,0 +1,10 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+===================
+Platform Device API
+===================
+
+The KUnit platform device API is used to test platform devices.
+
+.. kernel-doc:: lib/kunit/platform.c
+ :export: