Commit 83ee69a8 authored by Maxime Ripard's avatar Maxime Ripard

drm/tests: helpers: Rename the device init helper

The name doesn't really fit the conventions for the other helpers in
DRM/KMS, so let's rename it to make it obvious that we allocate a new
DRM device.
Reviewed-by: default avatarMaíra Canal <mcanal@igalia.com>
Link: https://lore.kernel.org/r/20221123-rpi-kunit-tests-v3-5-4615a663a84a@cerno.techSigned-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
parent 642ef3fb
...@@ -59,7 +59,8 @@ static int drm_client_modeset_test_init(struct kunit *test) ...@@ -59,7 +59,8 @@ static int drm_client_modeset_test_init(struct kunit *test)
test->priv = priv; test->priv = priv;
priv->drm = drm_kunit_device_init(test, DRIVER_MODESET, "drm-client-modeset-test"); priv->drm = drm_kunit_helper_alloc_drm_device(test, DRIVER_MODESET,
"drm-client-modeset-test");
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
ret = drmm_connector_init(priv->drm, &priv->connector, ret = drmm_connector_init(priv->drm, &priv->connector,
......
...@@ -36,7 +36,7 @@ static void dev_free(struct kunit_resource *res) ...@@ -36,7 +36,7 @@ static void dev_free(struct kunit_resource *res)
} }
/** /**
* drm_kunit_device_init - Allocates a mock DRM device for KUnit tests * drm_kunit_helper_alloc_drm_device - Allocates a mock DRM device for KUnit tests
* @test: The test context object * @test: The test context object
* @features: Mocked DRM device driver features * @features: Mocked DRM device driver features
* @name: Name of the struct &device to allocate * @name: Name of the struct &device to allocate
...@@ -52,7 +52,9 @@ static void dev_free(struct kunit_resource *res) ...@@ -52,7 +52,9 @@ static void dev_free(struct kunit_resource *res)
* Returns: * Returns:
* A pointer to the new drm_device, or an ERR_PTR() otherwise. * 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 drm_device *
drm_kunit_helper_alloc_drm_device(struct kunit *test,
u32 features, char *name)
{ {
struct kunit_dev *kdev; struct kunit_dev *kdev;
struct drm_device *drm; struct drm_device *drm;
...@@ -82,7 +84,7 @@ struct drm_device *drm_kunit_device_init(struct kunit *test, u32 features, char ...@@ -82,7 +84,7 @@ struct drm_device *drm_kunit_device_init(struct kunit *test, u32 features, char
return drm; return drm;
} }
EXPORT_SYMBOL_GPL(drm_kunit_device_init); EXPORT_SYMBOL_GPL(drm_kunit_helper_alloc_drm_device);
MODULE_AUTHOR("Maxime Ripard <maxime@cerno.tech>"); MODULE_AUTHOR("Maxime Ripard <maxime@cerno.tech>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -22,7 +22,8 @@ static int drm_test_modes_init(struct kunit *test) ...@@ -22,7 +22,8 @@ static int drm_test_modes_init(struct kunit *test)
priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL); priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
KUNIT_ASSERT_NOT_NULL(test, priv); KUNIT_ASSERT_NOT_NULL(test, priv);
priv->drm = drm_kunit_device_init(test, DRIVER_MODESET, "drm-modes-test"); priv->drm = drm_kunit_helper_alloc_drm_device(test, DRIVER_MODESET,
"drm-modes-test");
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
test->priv = priv; test->priv = priv;
......
...@@ -39,8 +39,9 @@ static int drm_probe_helper_test_init(struct kunit *test) ...@@ -39,8 +39,9 @@ static int drm_probe_helper_test_init(struct kunit *test)
KUNIT_ASSERT_NOT_NULL(test, priv); KUNIT_ASSERT_NOT_NULL(test, priv);
test->priv = priv; test->priv = priv;
priv->drm = drm_kunit_device_init(test, DRIVER_MODESET | DRIVER_ATOMIC, priv->drm = drm_kunit_helper_alloc_drm_device(test,
"drm-probe-helper-test"); DRIVER_MODESET | DRIVER_ATOMIC,
"drm-probe-helper-test");
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
connector = &priv->connector; connector = &priv->connector;
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
struct drm_device; struct drm_device;
struct kunit; struct kunit;
struct drm_device *drm_kunit_device_init(struct kunit *test, u32 features, char *name); struct drm_device *
drm_kunit_helper_alloc_drm_device(struct kunit *test,
u32 features,
char *name);
#endif // DRM_KUNIT_HELPERS_H_ #endif // DRM_KUNIT_HELPERS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment