Commit 1d041a46 authored by Maxime Ripard's avatar Maxime Ripard

drm/tests: helpers: Remove the name parameter

The device name isn't really useful, we can just define it instead of
exposing it in the API.
Reviewed-by: default avatarMaíra Canal <mcanal@igalia.com>
Link: https://lore.kernel.org/r/20221123-rpi-kunit-tests-v3-6-4615a663a84a@cerno.techSigned-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
parent 83ee69a8
...@@ -59,8 +59,7 @@ static int drm_client_modeset_test_init(struct kunit *test) ...@@ -59,8 +59,7 @@ static int drm_client_modeset_test_init(struct kunit *test)
test->priv = priv; test->priv = priv;
priv->drm = drm_kunit_helper_alloc_drm_device(test, DRIVER_MODESET, 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,
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <linux/device.h> #include <linux/device.h>
#define KUNIT_DEVICE_NAME "drm-kunit-mock-device"
struct kunit_dev { struct kunit_dev {
struct drm_device base; struct drm_device base;
}; };
...@@ -39,7 +41,6 @@ static void dev_free(struct kunit_resource *res) ...@@ -39,7 +41,6 @@ static void dev_free(struct kunit_resource *res)
* drm_kunit_helper_alloc_drm_device - 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
* *
* This function allocates a new struct &device, creates a struct * This function allocates a new struct &device, creates a struct
* &drm_driver and will create a struct &drm_device using both. * &drm_driver and will create a struct &drm_device using both.
...@@ -54,7 +55,7 @@ static void dev_free(struct kunit_resource *res) ...@@ -54,7 +55,7 @@ static void dev_free(struct kunit_resource *res)
*/ */
struct drm_device * struct drm_device *
drm_kunit_helper_alloc_drm_device(struct kunit *test, drm_kunit_helper_alloc_drm_device(struct kunit *test,
u32 features, char *name) u32 features)
{ {
struct kunit_dev *kdev; struct kunit_dev *kdev;
struct drm_device *drm; struct drm_device *drm;
...@@ -62,7 +63,7 @@ drm_kunit_helper_alloc_drm_device(struct kunit *test, ...@@ -62,7 +63,7 @@ drm_kunit_helper_alloc_drm_device(struct kunit *test,
struct device *dev; struct device *dev;
int ret; int ret;
dev = kunit_alloc_resource(test, dev_init, dev_free, GFP_KERNEL, name); dev = kunit_alloc_resource(test, dev_init, dev_free, GFP_KERNEL, KUNIT_DEVICE_NAME);
if (!dev) if (!dev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
...@@ -22,8 +22,7 @@ static int drm_test_modes_init(struct kunit *test) ...@@ -22,8 +22,7 @@ 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_helper_alloc_drm_device(test, DRIVER_MODESET, 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;
......
...@@ -40,8 +40,7 @@ static int drm_probe_helper_test_init(struct kunit *test) ...@@ -40,8 +40,7 @@ static int drm_probe_helper_test_init(struct kunit *test)
test->priv = priv; test->priv = priv;
priv->drm = drm_kunit_helper_alloc_drm_device(test, priv->drm = drm_kunit_helper_alloc_drm_device(test,
DRIVER_MODESET | DRIVER_ATOMIC, 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;
......
...@@ -8,7 +8,6 @@ struct kunit; ...@@ -8,7 +8,6 @@ struct kunit;
struct drm_device * struct drm_device *
drm_kunit_helper_alloc_drm_device(struct kunit *test, drm_kunit_helper_alloc_drm_device(struct kunit *test,
u32 features, 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