History

drm/stm: drv: fix suspend/resume

Without this fix, the system can not go in "suspend" mode due to an error in drv_suspend function. Fixes: 35ab6cfbf211 ("drm/stm: support runtime power management")

Yannick Fertré committed 7 years ago

Commit 2b5d74f1 parent 002c8451 file · +8 −7Browse files

Unified · Split

drivers/gpu/drm/stm/drv.c+8−7
@@ -136,8 +136,7 @@ static __maybe_unused int drv_suspend(struct device *dev) · 135 unmodified lines
136136 struct ltdc_device *ldev = ddev->dev_private;
137137 struct drm_atomic_state *state;
138138
139− if (WARN_ON(!ldev->suspend_state))
140− return -ENOENT;
139+ WARN_ON(ldev->suspend_state);
141140
142141 state = drm_atomic_helper_suspend(ddev);
143142 if (IS_ERR(state))
@@ -155,15 +154,17 @@ static __maybe_unused int drv_resume(struct device *dev) · 11 unmodified lines
155154 struct ltdc_device *ldev = ddev->dev_private;
156155 int ret;
157156
157+ if (WARN_ON(!ldev->suspend_state))
158+ return -ENOENT;
159+
158160 pm_runtime_force_resume(dev);
159161 ret = drm_atomic_helper_resume(ddev, ldev->suspend_state);
160− if (ret) {
162+ if (ret)
161163 pm_runtime_force_suspend(dev);
162− ldev->suspend_state = NULL;
163− return ret;
164− }
165164
166− return 0;
165+ ldev->suspend_state = NULL;
166+
167+ return ret;
167168 }
168169
169170 static __maybe_unused int drv_runtime_suspend(struct device *dev)