mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-24 15:56:49 +00:00
45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
|
From 1b723c252bbfb7abefd4bd866825a5385bfa5748 Mon Sep 17 00:00:00 2001
|
||
|
From: Maxime Ripard <maxime@cerno.tech>
|
||
|
Date: Mon, 28 Nov 2022 13:50:58 +0100
|
||
|
Subject: [PATCH] drm/tests: helpers: Document drm_kunit_device_init()
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Commit 44a3928324e9 ("drm/tests: Add Kunit Helpers") introduced the
|
||
|
drm_kunit_device_init() function but didn't document it properly. Add
|
||
|
that documentation.
|
||
|
|
||
|
Reviewed-by: Maíra Canal <mcanal@igalia.com>
|
||
|
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||
|
---
|
||
|
drivers/gpu/drm/tests/drm_kunit_helpers.c | 17 +++++++++++++++++
|
||
|
1 file changed, 17 insertions(+)
|
||
|
|
||
|
--- a/drivers/gpu/drm/tests/drm_kunit_helpers.c
|
||
|
+++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c
|
||
|
@@ -35,6 +35,23 @@ static void dev_free(struct kunit_resour
|
||
|
root_device_unregister(dev);
|
||
|
}
|
||
|
|
||
|
+/**
|
||
|
+ * drm_kunit_device_init - Allocates a mock DRM device for KUnit tests
|
||
|
+ * @test: The test context object
|
||
|
+ * @features: Mocked DRM device driver features
|
||
|
+ * @name: Name of the struct &device to allocate
|
||
|
+ *
|
||
|
+ * This function allocates a new struct &device, creates a struct
|
||
|
+ * &drm_driver and will create a struct &drm_device using both.
|
||
|
+ *
|
||
|
+ * The device and driver are tied to the @test context and will get
|
||
|
+ * cleaned at the end of the test. The drm_device is allocated through
|
||
|
+ * devm_drm_dev_alloc() and will thus be freed through a device-managed
|
||
|
+ * resource.
|
||
|
+ *
|
||
|
+ * Returns:
|
||
|
+ * A pointer to the new drm_device, or an ERR_PTR() otherwise.
|
||
|
+ */
|
||
|
struct drm_device *drm_kunit_device_init(struct kunit *test, u32 features, char *name)
|
||
|
{
|
||
|
struct kunit_dev *kdev;
|