2022-11-25 14:23:07

by Maira Canal

[permalink] [raw]
Subject: Re: [PATCH 01/24] drm/tests: helpers: Rename the device init helper

On 11/23/22 12:25, Maxime Ripard wrote:
> 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.
>
> Signed-off-by: Maxime Ripard <[email protected]>

Although I believe using "drm_device" on the function name is a bit
redundant (maybe drm_kunit_helper_alloc_dev or
drm_kunit_helper_alloc_device would be cleaner),

Reviewed-by: Maíra Canal <[email protected]>

Best Regards,
- Maíra Canal

> ---
> drivers/gpu/drm/tests/drm_client_modeset_test.c | 2 +-
> drivers/gpu/drm/tests/drm_kunit_helpers.c | 4 +++-
> drivers/gpu/drm/tests/drm_kunit_helpers.h | 5 ++++-
> 3 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/tests/drm_client_modeset_test.c b/drivers/gpu/drm/tests/drm_client_modeset_test.c
> index 362a5fbd82f5..e469d1634e2d 100644
> --- a/drivers/gpu/drm/tests/drm_client_modeset_test.c
> +++ b/drivers/gpu/drm/tests/drm_client_modeset_test.c
> @@ -41,7 +41,7 @@ static int drm_client_modeset_test_init(struct kunit *test)
>
> 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);
>
> ret = drmm_connector_init(priv->drm, &priv->connector,
> diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c
> index f1662091f250..a4ad030ed101 100644
> --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c
> +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c
> @@ -36,7 +36,9 @@ static void dev_free(struct kunit_resource *res)
> root_device_unregister(dev);
> }
>
> -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 drm_device *drm;
> diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.h b/drivers/gpu/drm/tests/drm_kunit_helpers.h
> index 20ab6eec4c89..e9870c7911fe 100644
> --- a/drivers/gpu/drm/tests/drm_kunit_helpers.h
> +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.h
> @@ -6,6 +6,9 @@
> struct drm_device;
> 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_
>


2022-11-25 15:31:26

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH 01/24] drm/tests: helpers: Rename the device init helper

Hi,

On Fri, Nov 25, 2022 at 11:10:02AM -0300, Ma?ra Canal wrote:
> On 11/23/22 12:25, Maxime Ripard wrote:
> > 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.
> >
> > Signed-off-by: Maxime Ripard <[email protected]>
>
> Although I believe using "drm_device" on the function name is a bit
> redundant (maybe drm_kunit_helper_alloc_dev or drm_kunit_helper_alloc_device
> would be cleaner),

Yeah, I don't quite like the name either, but we'll need to also
allocate a struct device in the next few patches so we need to make the
distinction between a struct drm_device and a struct device.

Maxime


Attachments:
(No filename) (728.00 B)
signature.asc (235.00 B)
Download all attachments