From 2caa0b46c7b180a9895a765478ff65603eba6066 Mon Sep 17 00:00:00 2001 From: Kuogee Hsieh Date: Wed, 3 Dec 2014 09:27:50 -0800 Subject: msm: mdss: spin lock is necessary when reset rdptr_enabled At cmd_stop, spin lock protection is necessary when reset rdptr_enabled to 1. Otherwise race condition may happen and cause timeout. CRs-Fixed: 766216 Change-Id: I128f73a069d3068c852f4b25c6515ec834e82162 Signed-off-by: Kuogee Hsieh --- drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c b/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c index e43137fd7cd5..e7fb1f660286 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c +++ b/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c @@ -859,6 +859,7 @@ int mdss_mdp_cmd_intfs_stop(struct mdss_mdp_ctl *ctl, int session, struct mdss_mdp_cmd_ctx *sctx = NULL; struct mdss_mdp_cmd_ctx *ctx; unsigned long flags; + unsigned long sflags; int need_wait = 0; int ret = 0; int hz; @@ -894,8 +895,12 @@ int mdss_mdp_cmd_intfs_stop(struct mdss_mdp_ctl *ctl, int session, * next vsync if there has no kickoff pending */ ctx->rdptr_enabled = 1; - if (sctx && sctx->rdptr_enabled) - sctx->rdptr_enabled = 1; + if (sctx) { + spin_lock_irqsave(&sctx->clk_lock, sflags); + if (sctx->rdptr_enabled) + sctx->rdptr_enabled = 1; + spin_unlock_irqrestore(&sctx->clk_lock, sflags); + } } spin_unlock_irqrestore(&ctx->clk_lock, flags); -- cgit v1.2.3