Re: [PATCH 05/13] drm/vkms: Set device name from vkms_config

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

 



On 29/01/25 - 12:00, José Expósito wrote:
> In order to be able to create multiple devices, the device name needs to
> be unique.
> 
> Allow to set it in the VKMS configuration.
> 
> Signed-off-by: José Expósito <jose.exposito89@xxxxxxxxx>

[...]

> diff --git a/drivers/gpu/drm/vkms/tests/vkms_config_test.c b/drivers/gpu/drm/vkms/tests/vkms_config_test.c
> index d8644a1e3e18..526800b1afb4 100644
> --- a/drivers/gpu/drm/vkms/tests/vkms_config_test.c
> +++ b/drivers/gpu/drm/vkms/tests/vkms_config_test.c
> @@ -15,10 +15,15 @@ struct default_config_case {
>  static void vkms_config_test_empty_config(struct kunit *test)
>  {
>  	struct vkms_config *config;
> +	const char *dev_name = "test";
>  
> -	config = vkms_config_create();
> +	config = vkms_config_create(dev_name);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
>  
> +	/* The dev_name string and the config have different live times */

s/live times/lifetimes/

> +	dev_name = NULL;
> +	KUNIT_EXPECT_STREQ(test, vkms_config_get_device_name(config), "test");
> +
>  	vkms_config_destroy(config);
>  }
>  

[...]

> diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
> index d0868750826a..3e4f39cbe2e2 100644
> --- a/drivers/gpu/drm/vkms/vkms_config.h
> +++ b/drivers/gpu/drm/vkms/vkms_config.h
> @@ -10,12 +10,14 @@

[...]

> +/**
> + * vkms_config_get_device_name() - Return the name of the device
> + * @config: Configuration to get the device name from

Can you add here that the pointer is only valid while vkms_config is 
valid?

> + */
> +static inline const char *
> +vkms_config_get_device_name(struct vkms_config *config)
> +{
> +	return config->dev_name;
> +}
> +

With those modifications:

Reviewed-by: Louis Chauvet <louis.chauvet@xxxxxxxxxxx>



[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