]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: dsi: fix deadlock in host suspend/resume
authorAllen Yu <alleny@nvidia.com>
Fri, 4 Apr 2014 05:41:13 +0000 (13:41 +0800)
committerMrutyunjay Sawant <msawant@nvidia.com>
Fri, 11 Apr 2014 14:58:48 +0000 (07:58 -0700)
tegra_dsi_host_resume() may be called with dc->lock acquired. In this
case, if tegra_dsi_host_suspend() happens to be scheduled and trying
to acquired dc->lock while tegra_dsi_host_resume() is waiting for the
idle work to be cancelled, the deadlock would happen.

bug 1493581

Change-Id: I52ee435cb2d49523b323e2866db5c12ba02e1895
Signed-off-by: Allen Yu <alleny@nvidia.com>
Reviewed-on: http://git-master/r/392215
(cherry picked from commit 40cc3cd27218ccc20162bea73d01e25a97c42da7)
Reviewed-on: http://git-master/r/393779
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
drivers/video/tegra/dc/dsi.c

index 4a5ff9b655e00c18c76523fa78d9ca1e6c757b54..25bd0c3c70cff20cbe3113e8b06d060996e25103 100644 (file)
@@ -4579,7 +4579,7 @@ static int tegra_dsi_host_suspend(struct tegra_dc *dc)
        while (!tegra_dsi_host_suspend_trylock(dc, dsi))
                cond_resched();
 
-       if (dsi->host_suspended) {
+       if (dsi->host_suspended || atomic_read(&dsi->host_ref)) {
                tegra_dsi_host_suspend_unlock(dc, dsi);
                return 0;
        }
@@ -4712,7 +4712,7 @@ static int tegra_dsi_host_resume(struct tegra_dc *dc)
        if (!dsi->enabled)
                return -EINVAL;
 
-       cancel_delayed_work_sync(&dsi->idle_work);
+       cancel_delayed_work(&dsi->idle_work);
 
        mutex_lock(&dsi->host_lock);
        if (!dsi->host_suspended) {