Re: [PATCH v2 05/17] drm/tests: helpers: Create the device in another function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/28/22 11:53, Maxime Ripard wrote:
> We'll need in some tests to control when the device needs to be added
> and removed, so let's split the device creation from the DRM device
> creation function.
> 
> Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>

Just a small nit below,

Reviewed-by: Maíra Canal <mcanal@xxxxxxxxxx>

>  
> diff --git a/drivers/gpu/drm/tests/drm_probe_helper_test.c b/drivers/gpu/drm/tests/drm_probe_helper_test.c
> index be61a92b79d2..438b1d42b843 100644
> --- a/drivers/gpu/drm/tests/drm_probe_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_probe_helper_test.c
> @@ -17,6 +17,7 @@
>  
>  struct drm_probe_helper_test_priv {
>  	struct drm_device *drm;
> +	struct device *dev;
>  	struct drm_connector connector;
>  };
>  
> @@ -39,7 +40,10 @@ static int drm_probe_helper_test_init(struct kunit *test)
>  	KUNIT_ASSERT_NOT_NULL(test, priv);
>  	test->priv = priv;
>  
> -	priv->drm = drm_kunit_helper_alloc_drm_device(test,
> +	priv->dev = drm_kunit_helper_alloc_device(test);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->dev);
> +
> +	priv->drm = drm_kunit_helper_alloc_drm_device(test, priv->dev,
>  						      DRIVER_MODESET | DRIVER_ATOMIC);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
>  
> @@ -55,6 +59,13 @@ static int drm_probe_helper_test_init(struct kunit *test)
>  	return 0;
>  }
>  
> +static void drm_probe_helper_test_exit(struct kunit *test)
> +{
> +	struct drm_probe_helper_test_priv *priv = test->priv;;

There are two semicolons by the end of this statement.

Best Regards,
- Maíra Canal

> +
> +	drm_kunit_helper_free_device(test, priv->dev);
> +}
> +
>  typedef struct drm_display_mode *(*expected_mode_func_t)(struct drm_device *);
>  
>  struct drm_connector_helper_tv_get_modes_test {
> @@ -195,6 +206,7 @@ static struct kunit_case drm_test_connector_helper_tv_get_modes_tests[] = {
>  static struct kunit_suite drm_test_connector_helper_tv_get_modes_suite = {
>  	.name = "drm_connector_helper_tv_get_modes",
>  	.init = drm_probe_helper_test_init,
> +	.exit = drm_probe_helper_test_exit,
>  	.test_cases = drm_test_connector_helper_tv_get_modes_tests,
>  };
>  
> diff --git a/include/drm/drm_kunit_helpers.h b/include/drm/drm_kunit_helpers.h
> index 6c12b1426ba0..b4277fe92c38 100644
> --- a/include/drm/drm_kunit_helpers.h
> +++ b/include/drm/drm_kunit_helpers.h
> @@ -6,8 +6,11 @@
>  struct drm_device;
>  struct kunit;
>  
> +struct device *drm_kunit_helper_alloc_device(struct kunit *test);
> +void drm_kunit_helper_free_device(struct kunit *test, struct device *dev);
> +
>  struct drm_device *
> -drm_kunit_helper_alloc_drm_device(struct kunit *test,
> +drm_kunit_helper_alloc_drm_device(struct kunit *test, struct device *dev,
>  				  u32 features);
>  
>  #endif // DRM_KUNIT_HELPERS_H_
> 



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux