[1/8] drm/exynos: use drm_for_each_connector_iter()
diff mbox

Message ID 20170511191049.28944-2-gustavo@padovan.org
State New
Headers show

Commit Message

Gustavo Padovan May 11, 2017, 7:10 p.m. UTC
From: Gustavo Padovan <gustavo.padovan@collabora.com>

Drop legacy drm_for_each_connector() in favor of the race-free
drm_for_each_connector_iter()

Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>

---
only built-tested!
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Daniel Vetter May 12, 2017, 7:38 a.m. UTC | #1
On Thu, May 11, 2017 at 04:10:42PM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.com>
> 
> Drop legacy drm_for_each_connector() in favor of the race-free
> drm_for_each_connector_iter()
> 
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Joonyoung Shim <jy0922.shim@samsung.com>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
> 
> ---
> only built-tested!
> ---

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 09d3c4c..db6ef2d 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -177,12 +177,13 @@ static int exynos_drm_suspend(struct device *dev)
>  {
>  	struct drm_device *drm_dev = dev_get_drvdata(dev);
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  
>  	if (pm_runtime_suspended(dev) || !drm_dev)
>  		return 0;
>  
> -	drm_modeset_lock_all(drm_dev);
> -	drm_for_each_connector(connector, drm_dev) {
> +	drm_connector_list_iter_begin(drm_dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		int old_dpms = connector->dpms;
>  
>  		if (connector->funcs->dpms)
> @@ -191,7 +192,7 @@ static int exynos_drm_suspend(struct device *dev)
>  		/* Set the old mode back to the connector for resume */
>  		connector->dpms = old_dpms;
>  	}
> -	drm_modeset_unlock_all(drm_dev);
> +	drm_connector_list_iter_end(&conn_iter);
>  
>  	return 0;
>  }
> @@ -200,12 +201,13 @@ static int exynos_drm_resume(struct device *dev)
>  {
>  	struct drm_device *drm_dev = dev_get_drvdata(dev);
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  
>  	if (pm_runtime_suspended(dev) || !drm_dev)
>  		return 0;
>  
> -	drm_modeset_lock_all(drm_dev);
> -	drm_for_each_connector(connector, drm_dev) {
> +	drm_connector_list_iter_begin(drm_dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		if (connector->funcs->dpms) {
>  			int dpms = connector->dpms;
>  
> @@ -213,7 +215,7 @@ static int exynos_drm_resume(struct device *dev)
>  			connector->funcs->dpms(connector, dpms);
>  		}
>  	}
> -	drm_modeset_unlock_all(drm_dev);
> +	drm_connector_list_iter_end(&conn_iter);
>  
>  	return 0;
>  }
> -- 
> 2.9.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae May 30, 2017, 12:22 a.m. UTC | #2
2017년 05월 12일 04:10에 Gustavo Padovan 이(가) 쓴 글:
> From: Gustavo Padovan <gustavo.padovan@collabora.com>
> 
> Drop legacy drm_for_each_connector() in favor of the race-free
> drm_for_each_connector_iter()
> 
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Joonyoung Shim <jy0922.shim@samsung.com>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>

Seems this patch with other could go to drm-misc.

Signed-off-by : Inki Dae <inki.dae@samsung.com>

Thanks,
Inki Dae

> 
> ---
> only built-tested!
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 09d3c4c..db6ef2d 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -177,12 +177,13 @@ static int exynos_drm_suspend(struct device *dev)
>  {
>  	struct drm_device *drm_dev = dev_get_drvdata(dev);
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  
>  	if (pm_runtime_suspended(dev) || !drm_dev)
>  		return 0;
>  
> -	drm_modeset_lock_all(drm_dev);
> -	drm_for_each_connector(connector, drm_dev) {
> +	drm_connector_list_iter_begin(drm_dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		int old_dpms = connector->dpms;
>  
>  		if (connector->funcs->dpms)
> @@ -191,7 +192,7 @@ static int exynos_drm_suspend(struct device *dev)
>  		/* Set the old mode back to the connector for resume */
>  		connector->dpms = old_dpms;
>  	}
> -	drm_modeset_unlock_all(drm_dev);
> +	drm_connector_list_iter_end(&conn_iter);
>  
>  	return 0;
>  }
> @@ -200,12 +201,13 @@ static int exynos_drm_resume(struct device *dev)
>  {
>  	struct drm_device *drm_dev = dev_get_drvdata(dev);
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  
>  	if (pm_runtime_suspended(dev) || !drm_dev)
>  		return 0;
>  
> -	drm_modeset_lock_all(drm_dev);
> -	drm_for_each_connector(connector, drm_dev) {
> +	drm_connector_list_iter_begin(drm_dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		if (connector->funcs->dpms) {
>  			int dpms = connector->dpms;
>  
> @@ -213,7 +215,7 @@ static int exynos_drm_resume(struct device *dev)
>  			connector->funcs->dpms(connector, dpms);
>  		}
>  	}
> -	drm_modeset_unlock_all(drm_dev);
> +	drm_connector_list_iter_end(&conn_iter);
>  
>  	return 0;
>  }
>

Patch
diff mbox

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 09d3c4c..db6ef2d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -177,12 +177,13 @@  static int exynos_drm_suspend(struct device *dev)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(dev);
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 
 	if (pm_runtime_suspended(dev) || !drm_dev)
 		return 0;
 
-	drm_modeset_lock_all(drm_dev);
-	drm_for_each_connector(connector, drm_dev) {
+	drm_connector_list_iter_begin(drm_dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		int old_dpms = connector->dpms;
 
 		if (connector->funcs->dpms)
@@ -191,7 +192,7 @@  static int exynos_drm_suspend(struct device *dev)
 		/* Set the old mode back to the connector for resume */
 		connector->dpms = old_dpms;
 	}
-	drm_modeset_unlock_all(drm_dev);
+	drm_connector_list_iter_end(&conn_iter);
 
 	return 0;
 }
@@ -200,12 +201,13 @@  static int exynos_drm_resume(struct device *dev)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(dev);
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 
 	if (pm_runtime_suspended(dev) || !drm_dev)
 		return 0;
 
-	drm_modeset_lock_all(drm_dev);
-	drm_for_each_connector(connector, drm_dev) {
+	drm_connector_list_iter_begin(drm_dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		if (connector->funcs->dpms) {
 			int dpms = connector->dpms;
 
@@ -213,7 +215,7 @@  static int exynos_drm_resume(struct device *dev)
 			connector->funcs->dpms(connector, dpms);
 		}
 	}
-	drm_modeset_unlock_all(drm_dev);
+	drm_connector_list_iter_end(&conn_iter);
 
 	return 0;
 }