diff options
author | Maxime Ripard <maxime@cerno.tech> | 2022-12-01 16:11:34 +0100 |
---|---|---|
committer | Maxime Ripard <maxime@cerno.tech> | 2022-12-08 09:41:27 +0100 |
commit | cee6ec3bee55976762bcf1b3bf959575f323cc9e (patch) | |
tree | 18af4b0398d34dbaff26f9d97f498b48d02c3e51 /drivers/gpu/drm/tests | |
parent | b85be04294ffa49574a0e662e626066320349ef3 (diff) | |
download | linux-cee6ec3bee55976762bcf1b3bf959575f323cc9e.tar.gz |
drm/tests: helpers: Document drm_kunit_device_init()
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>
Link: https://lore.kernel.org/r/20221123-rpi-kunit-tests-v3-3-4615a663a84a@cerno.tech
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Diffstat (limited to 'drivers/gpu/drm/tests')
-rw-r--r-- | drivers/gpu/drm/tests/drm_kunit_helpers.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c index 6600a4db3158..9ed3cfc2ac03 100644 --- 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_resource *res) 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; |