video: tegra: host: fix deadlock in pod_scaling
Ilan Aelion [Thu, 4 Apr 2013 19:59:08 +0000 (13:59 -0600)]
podgov_set_user_ctl to call cancel_work_sync after relinquishing lock.

Bug 1266380

Change-Id: I52ba57cfedca7d861e34810a933297790202fadc
Signed-off-by: Ilan Aelion <iaelion@nvidia.com>
Reviewed-on: http://git-master/r/216625
(cherry picked from commit 14f0f26dac55a68a2ef80a51999128874f2c6bc8)
Reviewed-on: http://git-master/r/218588
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Simo Melenius <smelenius@nvidia.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>

drivers/video/tegra/host/gr3d/pod_scaling.c

index 4c68751..9ac2564 100644 (file)
@@ -333,6 +333,7 @@ static void podgov_set_user_ctl(struct device *dev, int user)
        struct nvhost_device_data *pdata = platform_get_drvdata(d);
        struct devfreq *df = pdata->power_manager;
        struct podgov_info_rec *podgov;
+       int cancel = 0;
 
        if (!df)
                return;
@@ -343,7 +344,7 @@ static void podgov_set_user_ctl(struct device *dev, int user)
        trace_podgov_set_user_ctl(user);
 
        if (podgov->enable && user && !podgov->p_user) {
-               cancel_work_sync(&podgov->work);
+               cancel = 1;
                cancel_delayed_work(&podgov->idle_timer);
 
                podgov->adjustment_frequency = podgov->p_freq_request;
@@ -354,6 +355,8 @@ static void podgov_set_user_ctl(struct device *dev, int user)
        podgov->p_user = user;
 
        mutex_unlock(&df->lock);
+       if (cancel)
+               cancel_work_sync(&podgov->work);
 }
 
 /*******************************************************************************