diff mbox series

[1/2] drm/exynos: Fix locking in the suspend/resume paths

Message ID 1505390461-14211-2-git-send-email-m.szyprowski@samsung.com
State Accepted
Commit 5baf6bb0fd2388742a0846cc7bcacee6dec78235
Headers show
Series [1/2] drm/exynos: Fix locking in the suspend/resume paths | expand

Commit Message

Marek Szyprowski Sept. 14, 2017, 12:01 p.m. UTC
Commit 48a92916729b ("drm/exynos: use drm_for_each_connector_iter()")
replaced unsafe drm_for_each_connector() with drm_for_each_connector_iter()
and removed surrounding drm_modeset_lock calls. However, that lock was
there not only to protect unsafe drm_for_each_connector(), but it was also
required to be held by the dpms code which was called from the loop body.
This patch restores those drm_modeset_lock calls to fix broken suspend
and resume of Exynos DRM subsystem in v4.13 kernel.

Fixes: 48a92916729b ("drm/exynos: use drm_for_each_connector_iter()")
CC: stable@vger.kernel.org # v4.13
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
1.9.1

Comments

Krzysztof Kozlowski Sept. 19, 2017, 6:34 a.m. UTC | #1
On Thu, Sep 14, 2017 at 2:01 PM, Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
> Commit 48a92916729b ("drm/exynos: use drm_for_each_connector_iter()")

> replaced unsafe drm_for_each_connector() with drm_for_each_connector_iter()

> and removed surrounding drm_modeset_lock calls. However, that lock was

> there not only to protect unsafe drm_for_each_connector(), but it was also

> required to be held by the dpms code which was called from the loop body.

> This patch restores those drm_modeset_lock calls to fix broken suspend

> and resume of Exynos DRM subsystem in v4.13 kernel.

>

> Fixes: 48a92916729b ("drm/exynos: use drm_for_each_connector_iter()")

> CC: stable@vger.kernel.org # v4.13

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---

>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 ++++

>  1 file changed, 4 insertions(+)


Acked-by: Krzysztof Kozlowski <krzk@kernel.org>


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index b1f7299600f0..7f3cfc5dd320 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -174,6 +174,7 @@  static int exynos_drm_suspend(struct device *dev)
 	if (pm_runtime_suspended(dev) || !drm_dev)
 		return 0;
 
+	drm_modeset_lock_all(drm_dev);
 	drm_connector_list_iter_begin(drm_dev, &conn_iter);
 	drm_for_each_connector_iter(connector, &conn_iter) {
 		int old_dpms = connector->dpms;
@@ -185,6 +186,7 @@  static int exynos_drm_suspend(struct device *dev)
 		connector->dpms = old_dpms;
 	}
 	drm_connector_list_iter_end(&conn_iter);
+	drm_modeset_unlock_all(drm_dev);
 
 	return 0;
 }
@@ -198,6 +200,7 @@  static int exynos_drm_resume(struct device *dev)
 	if (pm_runtime_suspended(dev) || !drm_dev)
 		return 0;
 
+	drm_modeset_lock_all(drm_dev);
 	drm_connector_list_iter_begin(drm_dev, &conn_iter);
 	drm_for_each_connector_iter(connector, &conn_iter) {
 		if (connector->funcs->dpms) {
@@ -208,6 +211,7 @@  static int exynos_drm_resume(struct device *dev)
 		}
 	}
 	drm_connector_list_iter_end(&conn_iter);
+	drm_modeset_unlock_all(drm_dev);
 
 	return 0;
 }