kernel: bump 6.1 to 6.1.66
[openwrt/staging/stintel.git] / target / linux / bcm27xx / patches-6.1 / 950-0489-drm-tests-helpers-Document-drm_kunit_device_init.patch
1 From 1b723c252bbfb7abefd4bd866825a5385bfa5748 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Mon, 28 Nov 2022 13:50:58 +0100
4 Subject: [PATCH] drm/tests: helpers: Document drm_kunit_device_init()
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Commit 44a3928324e9 ("drm/tests: Add Kunit Helpers") introduced the
10 drm_kunit_device_init() function but didn't document it properly. Add
11 that documentation.
12
13 Reviewed-by: MaĆ­ra Canal <mcanal@igalia.com>
14 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
15 ---
16 drivers/gpu/drm/tests/drm_kunit_helpers.c | 17 +++++++++++++++++
17 1 file changed, 17 insertions(+)
18
19 --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c
20 +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c
21 @@ -35,6 +35,23 @@ static void dev_free(struct kunit_resour
22 root_device_unregister(dev);
23 }
24
25 +/**
26 + * drm_kunit_device_init - Allocates a mock DRM device for KUnit tests
27 + * @test: The test context object
28 + * @features: Mocked DRM device driver features
29 + * @name: Name of the struct &device to allocate
30 + *
31 + * This function allocates a new struct &device, creates a struct
32 + * &drm_driver and will create a struct &drm_device using both.
33 + *
34 + * The device and driver are tied to the @test context and will get
35 + * cleaned at the end of the test. The drm_device is allocated through
36 + * devm_drm_dev_alloc() and will thus be freed through a device-managed
37 + * resource.
38 + *
39 + * Returns:
40 + * A pointer to the new drm_device, or an ERR_PTR() otherwise.
41 + */
42 struct drm_device *drm_kunit_device_init(struct kunit *test, u32 features, char *name)
43 {
44 struct kunit_dev *kdev;