mirror of
https://github.com/torvalds/linux.git
synced 2026-04-27 11:02:31 -04:00
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>
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user