forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maxime Ripard <[email protected]>
- Loading branch information
Showing
2 changed files
with
54 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>"); | ||
MODULE_LICENSE("GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters