]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/stm: drv: fix suspend/resume
authorYannick Fertré <yannick.fertre@st.com>
Mon, 17 Jun 2019 07:18:17 +0000 (09:18 +0200)
committerBenjamin Gaignard <benjamin.gaignard@linaro.org>
Thu, 20 Jun 2019 15:03:24 +0000 (17:03 +0200)
Without this fix, the system can not go in "suspend" mode
due to an error in drv_suspend function.

Fixes: f35f5404acdb ("drm/stm: support runtime power management")
Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1560755897-5002-1-git-send-email-yannick.fertre@st.com
drivers/gpu/drm/stm/drv.c

index 5659572151a8ced4866af5c0d7782d9c07de76de..9dee4e430de514217999d15a2a3d02a9b9ca58b4 100644 (file)
@@ -136,8 +136,7 @@ static __maybe_unused int drv_suspend(struct device *dev)
        struct ltdc_device *ldev = ddev->dev_private;
        struct drm_atomic_state *state;
 
-       if (WARN_ON(!ldev->suspend_state))
-               return -ENOENT;
+       WARN_ON(ldev->suspend_state);
 
        state = drm_atomic_helper_suspend(ddev);
        if (IS_ERR(state))
@@ -155,15 +154,17 @@ static __maybe_unused int drv_resume(struct device *dev)
        struct ltdc_device *ldev = ddev->dev_private;
        int ret;
 
+       if (WARN_ON(!ldev->suspend_state))
+               return -ENOENT;
+
        pm_runtime_force_resume(dev);
        ret = drm_atomic_helper_resume(ddev, ldev->suspend_state);
-       if (ret) {
+       if (ret)
                pm_runtime_force_suspend(dev);
-               ldev->suspend_state = NULL;
-               return ret;
-       }
 
-       return 0;
+       ldev->suspend_state = NULL;
+
+       return ret;
 }
 
 static __maybe_unused int drv_runtime_suspend(struct device *dev)