summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnshul Jain <anshulj@nvidia.com>2013-10-15 20:15:36 -0700
committerMandar Padmawar <mpadmawar@nvidia.com>2013-10-17 00:52:14 -0700
commitfb944bd73a9936e3e46b016c2cc14e8badbcefe3 (patch)
tree42d562043e8020816043e39d011b06e90f4fe547
parent4de3651f005b9102cdbcc316f4301daa88cb1b9c (diff)
misc: therm_fan_est: Fix for suspend/resume race
Now trip index will be nullified after cancelling the work. Bug 1388303 Change-Id: Icda3e232e98b4f504c1bebcd340b49749d1ebbc3 Signed-off-by: Anshul Jain <anshulj@nvidia.com> Reviewed-on: http://git-master/r/299755 Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com> GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/misc/therm_fan_est.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/misc/therm_fan_est.c b/drivers/misc/therm_fan_est.c
index 7bb6b4744cc5..6b8815e383a3 100644
--- a/drivers/misc/therm_fan_est.c
+++ b/drivers/misc/therm_fan_est.c
@@ -1,7 +1,7 @@
/*
* drivers/misc/therm_fan_est.c
*
- * Copyright (C) 2010-2012 NVIDIA Corporation.
+ * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -66,7 +66,7 @@ static void fan_set_trip_temp_hyst(struct therm_fan_estimator *est, int trip,
static void therm_fan_est_work_func(struct work_struct *work)
{
int i, j, index, trip_index, sum = 0;
- long temp;
+ long temp = 0;
struct delayed_work *dwork = container_of(work,
struct delayed_work, work);
struct therm_fan_estimator *est = container_of(
@@ -97,13 +97,15 @@ static void therm_fan_est_work_func(struct work_struct *work)
}
if (est->current_trip_index != (trip_index - 1)) {
- if (!((trip_index - 1) % 2) || (!est->current_trip_index))
+ if (!((trip_index - 1) % 2) || (!est->current_trip_index)) {
+ pr_info("%s, cur_temp:%ld, cur_trip_index:%d",
+ __func__, est->cur_temp, est->current_trip_index);
thermal_zone_device_update(est->thz);
+ }
est->current_trip_index = trip_index - 1;
}
est->ntemp++;
-
queue_delayed_work(est->workqueue, &est->therm_fan_est_work,
msecs_to_jiffies(est->polling_period));
}
@@ -408,8 +410,9 @@ static int therm_fan_est_suspend(struct platform_device *pdev,
if (!est)
return -EINVAL;
- est->current_trip_index = 0;
+ pr_info("therm-fan-est: %s, cur_temp:%ld", __func__, est->cur_temp);
cancel_delayed_work(&est->therm_fan_est_work);
+ est->current_trip_index = 0;
return 0;
}
@@ -420,6 +423,7 @@ static int therm_fan_est_resume(struct platform_device *pdev)
if (!est)
return -EINVAL;
+ pr_info("therm-fan-est: %s, cur_temp:%ld", __func__, est->cur_temp);
queue_delayed_work(est->workqueue,
&est->therm_fan_est_work,