diff mbox

drm/rockchip: Fix up bug in psr state machine

Message ID 1473189146-12498-1-git-send-email-seanpaul@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Paul Sept. 6, 2016, 7:12 p.m. UTC
The ->set() callback would always be called when transitioning
from FLUSH->DISABLE since we assign state to psr->state right
above the skip condition.

Reported-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Daniel Kurtz Sept. 7, 2016, 4:07 a.m. UTC | #1
On Wed, Sep 7, 2016 at 3:12 AM, Sean Paul <seanpaul@chromium.org> wrote:
> The ->set() callback would always be called when transitioning
> from FLUSH->DISABLE since we assign state to psr->state right
> above the skip condition.
>
> Reported-by: Daniel Kurtz <djkurtz@chromium.org>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>


> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
> index c6ac5d0..cb17709 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
> @@ -74,11 +74,13 @@ static void psr_set_state_locked(struct psr_drv *psr, enum psr_state state)
>         if (state == PSR_FLUSH && psr->state == PSR_DISABLE)
>                 return;
>
> -       psr->state = state;
> -
>         /* Already disabled in flush, change the state, but not the hardware */
> -       if (state == PSR_DISABLE && psr->state == PSR_FLUSH)
> +       if (state == PSR_DISABLE && psr->state == PSR_FLUSH) {
> +               psr->state = state;
>                 return;
> +       }
> +
> +       psr->state = state;
>
>         /* Actually commit the state change to hardware */
>         switch (psr->state) {
> --
> 2.8.0.rc3.226.g39d4020
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
index c6ac5d0..cb17709 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
@@ -74,11 +74,13 @@  static void psr_set_state_locked(struct psr_drv *psr, enum psr_state state)
 	if (state == PSR_FLUSH && psr->state == PSR_DISABLE)
 		return;
 
-	psr->state = state;
-
 	/* Already disabled in flush, change the state, but not the hardware */
-	if (state == PSR_DISABLE && psr->state == PSR_FLUSH)
+	if (state == PSR_DISABLE && psr->state == PSR_FLUSH) {
+		psr->state = state;
 		return;
+	}
+
+	psr->state = state;
 
 	/* Actually commit the state change to hardware */
 	switch (psr->state) {