diff mbox series

[1/6] drm: vkms: Replace the deprecated drm_mode_config_init

Message ID 20211005201637.58563-2-igormtorrente@gmail.com (mailing list archive)
State New, archived
Headers show
Series Refactor the vkms to accept new formats | expand

Commit Message

Igor Matheus Andrade Torrente Oct. 5, 2021, 8:16 p.m. UTC
The `drm_mode_config_init` was deprecated since c3b790e commit, and it's
being replaced by the `drmm_mode_config_init`.

Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
---
 drivers/gpu/drm/vkms/vkms_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Thomas Zimmermann Oct. 18, 2021, 10:02 a.m. UTC | #1
Hi

Am 05.10.21 um 22:16 schrieb Igor Matheus Andrade Torrente:
> The `drm_mode_config_init` was deprecated since c3b790e commit, and it's
> being replaced by the `drmm_mode_config_init`.
> 
> Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
> ---
>   drivers/gpu/drm/vkms/vkms_drv.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> index 0ffe5f0e33f7..828868920494 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.c
> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> @@ -140,8 +140,11 @@ static const struct drm_mode_config_helper_funcs vkms_mode_config_helpers = {
>   static int vkms_modeset_init(struct vkms_device *vkmsdev)
>   {
>   	struct drm_device *dev = &vkmsdev->drm;
> +	int ret = drmm_mode_config_init(dev);
> +
> +	if (ret < 0)
> +		return ret;

The style looks awkward IMHO. Rather use

  int ret

  ret = drmm_mode_config_init()
  if (ret)
     return ret;

>   
> -	drm_mode_config_init(dev);
>   	dev->mode_config.funcs = &vkms_mode_funcs;
>   	dev->mode_config.min_width = XRES_MIN;
>   	dev->mode_config.min_height = YRES_MIN;
>
Igor Matheus Andrade Torrente Oct. 18, 2021, 6:21 p.m. UTC | #2
Hi Thomas,

On 10/18/21 7:02 AM, Thomas Zimmermann wrote:
> Hi
> 
> Am 05.10.21 um 22:16 schrieb Igor Matheus Andrade Torrente:
>> The `drm_mode_config_init` was deprecated since c3b790e commit, and it's
>> being replaced by the `drmm_mode_config_init`.
>>
>> Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
>> ---
>>   drivers/gpu/drm/vkms/vkms_drv.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c 
>> b/drivers/gpu/drm/vkms/vkms_drv.c
>> index 0ffe5f0e33f7..828868920494 100644
>> --- a/drivers/gpu/drm/vkms/vkms_drv.c
>> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
>> @@ -140,8 +140,11 @@ static const struct drm_mode_config_helper_funcs 
>> vkms_mode_config_helpers = {
>>   static int vkms_modeset_init(struct vkms_device *vkmsdev)
>>   {
>>       struct drm_device *dev = &vkmsdev->drm;
>> +    int ret = drmm_mode_config_init(dev);
>> +
>> +    if (ret < 0)
>> +        return ret;
> 
> The style looks awkward IMHO. Rather use
I don't think it's awkward. But I don't mind change it anyway.

> 
>   int ret
> 
>   ret = drmm_mode_config_init()
>   if (ret)
>      return ret;
> 
>> -    drm_mode_config_init(dev);
>>       dev->mode_config.funcs = &vkms_mode_funcs;
>>       dev->mode_config.min_width = XRES_MIN;
>>       dev->mode_config.min_height = YRES_MIN;
>>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 0ffe5f0e33f7..828868920494 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -140,8 +140,11 @@  static const struct drm_mode_config_helper_funcs vkms_mode_config_helpers = {
 static int vkms_modeset_init(struct vkms_device *vkmsdev)
 {
 	struct drm_device *dev = &vkmsdev->drm;
+	int ret = drmm_mode_config_init(dev);
+
+	if (ret < 0)
+		return ret;
 
-	drm_mode_config_init(dev);
 	dev->mode_config.funcs = &vkms_mode_funcs;
 	dev->mode_config.min_width = XRES_MIN;
 	dev->mode_config.min_height = YRES_MIN;