diff options
author | Maxime Ripard <maxime@cerno.tech> | 2022-12-01 16:11:42 +0100 |
---|---|---|
committer | Maxime Ripard <maxime@cerno.tech> | 2022-12-08 09:56:55 +0100 |
commit | d98780310719bf4076d975c2ff65c44c7c0d929e (patch) | |
tree | a7b11c2b84e0e3f7f4f886c905fa2d3d9eeb0a8a /drivers/gpu/drm/tests | |
parent | a9143c5852a7a13d60ef685d27f9617f2a52338b (diff) | |
download | linux-stable-d98780310719bf4076d975c2ff65c44c7c0d929e.tar.gz linux-stable-d98780310719bf4076d975c2ff65c44c7c0d929e.tar.bz2 linux-stable-d98780310719bf4076d975c2ff65c44c7c0d929e.zip |
drm/tests: helpers: Allow to pass a custom drm_driver
Some tests will need to provide their own drm_driver instead of relying
on the dumb one in the helpers, so let's create a helper that allows to
do so.
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://lore.kernel.org/r/20221123-rpi-kunit-tests-v3-11-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 | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c index b5485ab8fbf9..e98b4150f556 100644 --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c @@ -82,20 +82,15 @@ void drm_kunit_helper_free_device(struct kunit *test, struct device *dev) EXPORT_SYMBOL_GPL(drm_kunit_helper_free_device); struct drm_device * -__drm_kunit_helper_alloc_drm_device(struct kunit *test, struct device *dev, - size_t size, size_t offset, - u32 features) +__drm_kunit_helper_alloc_drm_device_with_driver(struct kunit *test, + struct device *dev, + size_t size, size_t offset, + const struct drm_driver *driver) { struct drm_device *drm; - struct drm_driver *driver; void *container; int ret; - driver = kunit_kzalloc(test, sizeof(*driver), GFP_KERNEL); - if (!driver) - return ERR_PTR(-ENOMEM); - - driver->driver_features = features; container = __devm_drm_dev_alloc(dev, driver, size, offset); if (IS_ERR(container)) return ERR_CAST(container); @@ -109,7 +104,7 @@ __drm_kunit_helper_alloc_drm_device(struct kunit *test, struct device *dev, return drm; } -EXPORT_SYMBOL_GPL(__drm_kunit_helper_alloc_drm_device); +EXPORT_SYMBOL_GPL(__drm_kunit_helper_alloc_drm_device_with_driver); MODULE_AUTHOR("Maxime Ripard <maxime@cerno.tech>"); MODULE_LICENSE("GPL"); |