diff mbox series

drm/imx: Convert drm_atomic_helper_suspend/resume()

Message ID 20180728130521.GA6336@jordon-HP-15-Notebook-PC (mailing list archive)
State New, archived
Headers show
Series drm/imx: Convert drm_atomic_helper_suspend/resume() | expand

Commit Message

Souptick Joarder July 28, 2018, 1:05 p.m. UTC
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
---
 drivers/gpu/drm/imx/imx-drm-core.c | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

Comments

Philipp Zabel July 31, 2018, 8:29 a.m. UTC | #1
Hi Souptick,

On Sat, 2018-07-28 at 18:35 +0530, Souptick Joarder wrote:
> convert drm_atomic_helper_suspend/resume() to use
> drm_mode_config_helper_suspend/resume().
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>

Leonard pointed out earlier [1] that this makes the struct
imx_drm_device superfluous, since imxdrm->state is the only remaining
field and here you are removing its use. Could you remove struct
imx_drm_device as well?

[1] https://patchwork.kernel.org/patch/10531473/

regards
Philipp

> ---
>  drivers/gpu/drm/imx/imx-drm-core.c | 26 ++------------------------
>  1 file changed, 2 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index 1d053bb..cdd83ea 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -355,37 +355,15 @@ static int imx_drm_platform_remove(struct platform_device *pdev)
>  static int imx_drm_suspend(struct device *dev)
>  {
>  	struct drm_device *drm_dev = dev_get_drvdata(dev);
> -	struct imx_drm_device *imxdrm;
> -
> -	/* The drm_dev is NULL before .load hook is called */
> -	if (drm_dev == NULL)
> -		return 0;
> -
> -	drm_kms_helper_poll_disable(drm_dev);
> -
> -	imxdrm = drm_dev->dev_private;
> -	imxdrm->state = drm_atomic_helper_suspend(drm_dev);
> -	if (IS_ERR(imxdrm->state)) {
> -		drm_kms_helper_poll_enable(drm_dev);
> -		return PTR_ERR(imxdrm->state);
> -	}
>  
> -	return 0;
> +	return drm_mode_config_helper_suspend(drm_dev);
>  }
>  
>  static int imx_drm_resume(struct device *dev)
>  {
>  	struct drm_device *drm_dev = dev_get_drvdata(dev);
> -	struct imx_drm_device *imx_drm;
> -
> -	if (drm_dev == NULL)
> -		return 0;
>  
> -	imx_drm = drm_dev->dev_private;
> -	drm_atomic_helper_resume(drm_dev, imx_drm->state);
> -	drm_kms_helper_poll_enable(drm_dev);
> -
> -	return 0;
> +	return drm_mode_config_helper_resume(drm_dev);
>  }
>  #endif
>
Souptick Joarder July 31, 2018, 9:23 a.m. UTC | #2
On Tue, Jul 31, 2018 at 1:59 PM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> Hi Souptick,
>
> On Sat, 2018-07-28 at 18:35 +0530, Souptick Joarder wrote:
>> convert drm_atomic_helper_suspend/resume() to use
>> drm_mode_config_helper_suspend/resume().
>>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
>
> Leonard pointed out earlier [1] that this makes the struct
> imx_drm_device superfluous, since imxdrm->state is the only remaining
> field and here you are removing its use. Could you remove struct
> imx_drm_device as well?

Sure, Will remove it in v2.
>
> [1] https://patchwork.kernel.org/patch/10531473/
>
> regards
> Philipp
>
>> ---
>>  drivers/gpu/drm/imx/imx-drm-core.c | 26 ++------------------------
>>  1 file changed, 2 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
>> index 1d053bb..cdd83ea 100644
>> --- a/drivers/gpu/drm/imx/imx-drm-core.c
>> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
>> @@ -355,37 +355,15 @@ static int imx_drm_platform_remove(struct platform_device *pdev)
>>  static int imx_drm_suspend(struct device *dev)
>>  {
>>       struct drm_device *drm_dev = dev_get_drvdata(dev);
>> -     struct imx_drm_device *imxdrm;
>> -
>> -     /* The drm_dev is NULL before .load hook is called */
>> -     if (drm_dev == NULL)
>> -             return 0;
>> -
>> -     drm_kms_helper_poll_disable(drm_dev);
>> -
>> -     imxdrm = drm_dev->dev_private;
>> -     imxdrm->state = drm_atomic_helper_suspend(drm_dev);
>> -     if (IS_ERR(imxdrm->state)) {
>> -             drm_kms_helper_poll_enable(drm_dev);
>> -             return PTR_ERR(imxdrm->state);
>> -     }
>>
>> -     return 0;
>> +     return drm_mode_config_helper_suspend(drm_dev);
>>  }
>>
>>  static int imx_drm_resume(struct device *dev)
>>  {
>>       struct drm_device *drm_dev = dev_get_drvdata(dev);
>> -     struct imx_drm_device *imx_drm;
>> -
>> -     if (drm_dev == NULL)
>> -             return 0;
>>
>> -     imx_drm = drm_dev->dev_private;
>> -     drm_atomic_helper_resume(drm_dev, imx_drm->state);
>> -     drm_kms_helper_poll_enable(drm_dev);
>> -
>> -     return 0;
>> +     return drm_mode_config_helper_resume(drm_dev);
>>  }
>>  #endif
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 1d053bb..cdd83ea 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -355,37 +355,15 @@  static int imx_drm_platform_remove(struct platform_device *pdev)
 static int imx_drm_suspend(struct device *dev)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(dev);
-	struct imx_drm_device *imxdrm;
-
-	/* The drm_dev is NULL before .load hook is called */
-	if (drm_dev == NULL)
-		return 0;
-
-	drm_kms_helper_poll_disable(drm_dev);
-
-	imxdrm = drm_dev->dev_private;
-	imxdrm->state = drm_atomic_helper_suspend(drm_dev);
-	if (IS_ERR(imxdrm->state)) {
-		drm_kms_helper_poll_enable(drm_dev);
-		return PTR_ERR(imxdrm->state);
-	}
 
-	return 0;
+	return drm_mode_config_helper_suspend(drm_dev);
 }
 
 static int imx_drm_resume(struct device *dev)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(dev);
-	struct imx_drm_device *imx_drm;
-
-	if (drm_dev == NULL)
-		return 0;
 
-	imx_drm = drm_dev->dev_private;
-	drm_atomic_helper_resume(drm_dev, imx_drm->state);
-	drm_kms_helper_poll_enable(drm_dev);
-
-	return 0;
+	return drm_mode_config_helper_resume(drm_dev);
 }
 #endif