drm/tests: helpers: Remove the name parameter
authorMaxime Ripard <maxime@cerno.tech>
Thu, 1 Dec 2022 15:11:37 +0000 (16:11 +0100)
committerMaxime Ripard <maxime@cerno.tech>
Thu, 8 Dec 2022 08:56:55 +0000 (09:56 +0100)
The device name isn't really useful, we can just define it instead of
exposing it in the API.

Reviewed-by: MaĆ­ra Canal <mcanal@igalia.com>
Link: https://lore.kernel.org/r/20221123-rpi-kunit-tests-v3-6-4615a663a84a@cerno.tech
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/gpu/drm/tests/drm_client_modeset_test.c
drivers/gpu/drm/tests/drm_kunit_helpers.c
drivers/gpu/drm/tests/drm_modes_test.c
drivers/gpu/drm/tests/drm_probe_helper_test.c
include/drm/drm_kunit_helpers.h

index 6cdf08f582ced4e4a80b7a4bdaf24230c09b7529..4d475ae6dbb6756848375fdf78fd035a69d3f399 100644 (file)
@@ -59,8 +59,7 @@ static int drm_client_modeset_test_init(struct kunit *test)
 
        test->priv = priv;
 
-       priv->drm = drm_kunit_helper_alloc_drm_device(test, DRIVER_MODESET,
-                                                     "drm-client-modeset-test");
+       priv->drm = drm_kunit_helper_alloc_drm_device(test, DRIVER_MODESET);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
 
        ret = drmm_connector_init(priv->drm, &priv->connector,
index e718073ba6e9a42cab6929a7b0836ddf7c878567..ec33fcbd092d10feaa51254fd654f3de42436a36 100644 (file)
@@ -8,6 +8,8 @@
 
 #include <linux/device.h>
 
+#define KUNIT_DEVICE_NAME      "drm-kunit-mock-device"
+
 struct kunit_dev {
        struct drm_device base;
 };
@@ -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
  * @test: The test context object
  * @features: Mocked DRM device driver features
- * @name: Name of the struct &device to allocate
  *
  * This function allocates a new struct &device, creates a struct
  * &drm_driver and will create a struct &drm_device using both.
@@ -54,7 +55,7 @@ static void dev_free(struct kunit_resource *res)
  */
 struct drm_device *
 drm_kunit_helper_alloc_drm_device(struct kunit *test,
-                                 u32 features, char *name)
+                                 u32 features)
 {
        struct kunit_dev *kdev;
        struct drm_device *drm;
@@ -62,7 +63,7 @@ drm_kunit_helper_alloc_drm_device(struct kunit *test,
        struct device *dev;
        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)
                return ERR_PTR(-ENOMEM);
 
index 6723089dff9fbb67f4849860522e744b44da17c0..35965ad86188fcac73769b93e8c97e0beccedc22 100644 (file)
@@ -22,8 +22,7 @@ static int drm_test_modes_init(struct kunit *test)
        priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
        KUNIT_ASSERT_NOT_NULL(test, priv);
 
-       priv->drm = drm_kunit_helper_alloc_drm_device(test, DRIVER_MODESET,
-                                                     "drm-modes-test");
+       priv->drm = drm_kunit_helper_alloc_drm_device(test, DRIVER_MODESET);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
 
        test->priv = priv;
index b44768100ed5dfb7aead95bc0396d46e44e984a3..86ea988e14be00b20c90e88da5060a18caafda55 100644 (file)
@@ -40,8 +40,7 @@ static int drm_probe_helper_test_init(struct kunit *test)
        test->priv = priv;
 
        priv->drm = drm_kunit_helper_alloc_drm_device(test,
-                                                     DRIVER_MODESET | DRIVER_ATOMIC,
-                                                     "drm-probe-helper-test");
+                                                     DRIVER_MODESET | DRIVER_ATOMIC);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
 
        connector = &priv->connector;
index e9870c7911fe2c746777b5e76180ccd5a577c0ab..6c12b1426ba0328c6cb4b70b57435c429dc560f1 100644 (file)
@@ -8,7 +8,6 @@ struct kunit;
 
 struct drm_device *
 drm_kunit_helper_alloc_drm_device(struct kunit *test,
-                                 u32 features,
-                                 char *name);
+                                 u32 features);
 
 #endif // DRM_KUNIT_HELPERS_H_