]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: dsi: Fix race condition in holding dsi host
authorAllen Yu <alleny@nvidia.com>
Tue, 25 Mar 2014 11:21:57 +0000 (19:21 +0800)
committerMrutyunjay Sawant <msawant@nvidia.com>
Fri, 28 Mar 2014 11:03:32 +0000 (04:03 -0700)
There is a race condition between tegra_dsi_host_resume() and
tegra_dsi_host_suspend(). If dsi idle work happens to be executing
while we are calling tegra_dsi_host_resume(), the idle work will
not be canceled. In this case, if resume routine acquires host_lock
before suspend routine, we will end up executing suspend routine.
As a result, DSI host will not be hold in fact. This could lead to
some undesirable problems like wait_for_vsync will never be waken up
since TE is turned off.

To fix this, use cancel_delayed_work_sync API in tegra_dsi_host_resume()
instead of cancel_delayed_work.

Bug 1473968
Bug 1475933

Change-Id: Ifee61efcce45bcefabc97d7ed922b44ecd148ff0
Signed-off-by: Allen Yu <alleny@nvidia.com>
Reviewed-on: http://git-master/r/386322
(cherry picked from commit 03ccbf46d4830ab38f470dd94bc9397f20147fe0)
Reviewed-on: http://git-master/r/386699
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>
drivers/video/tegra/dc/dsi.c

index 484b6108653a01e3ffec89cb4eb966a107bc91a7..4a5ff9b655e00c18c76523fa78d9ca1e6c757b54 100644 (file)
@@ -4712,7 +4712,7 @@ static int tegra_dsi_host_resume(struct tegra_dc *dc)
        if (!dsi->enabled)
                return -EINVAL;
 
-       cancel_delayed_work(&dsi->idle_work);
+       cancel_delayed_work_sync(&dsi->idle_work);
 
        mutex_lock(&dsi->host_lock);
        if (!dsi->host_suspended) {