summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorDiwakar Tundlam <dtundlam@nvidia.com>2014-03-13 18:32:38 -0700
committerDiwakar Tundlam <dtundlam@nvidia.com>2014-03-20 11:34:10 -0700
commit2b09991b79396355361bcaca1310211fda3a1f6c (patch)
tree7d924d2eb172ddced4ecd118e6685f2ea4e5d630 /drivers/thermal
parenta75152ce05117e5472c80c39538cf758a14bc481 (diff)
Revert "thermal: core: use cancel delayed work sync"
This reverts commit 918fa5def9fb9ec2ba608c95e06299debd2d9d89. The reverted commit seems to cause this new bug noted below. Bug 1478989 Signed-off-by: Diwakar Tundlam <dtundlam@nvidia.com> Change-Id: Icf937aab9089ea68f397b25cf40fa2494e31686a Reviewed-on: http://git-master/r/381789 Reviewed-by: Seema Khowala <seemaj@nvidia.com> Tested-by: Seema Khowala <seemaj@nvidia.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/thermal_core.c45
1 files changed, 12 insertions, 33 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 3f038b1e4864..72ac8a7770f6 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -327,49 +327,28 @@ exit:
static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
int delay)
{
- int jiffies;
-
- if (delay <= 0)
- return;
-
if (delay > 1000)
- jiffies = round_jiffies(msecs_to_jiffies(delay));
+ mod_delayed_work(system_freezable_wq, &tz->poll_queue,
+ round_jiffies(msecs_to_jiffies(delay)));
+ else if (delay)
+ mod_delayed_work(system_freezable_wq, &tz->poll_queue,
+ msecs_to_jiffies(delay));
else
- jiffies = msecs_to_jiffies(delay);
-
- mod_delayed_work(system_freezable_wq, &tz->poll_queue, jiffies);
-}
-
-/**
- * thermal_zone_device_cancel_polling() - cancels polling of thermal zone.
- * @tz: a valid pointer to a struct thermal_zone_device
- *
- * We should never call this routine while holding thermal zone mutex,
- * or else it can potentially deadlock.
- */
-static void thermal_zone_device_cancel_polling(struct thermal_zone_device *tz)
-{
- cancel_delayed_work_sync(&tz->poll_queue);
+ cancel_delayed_work(&tz->poll_queue);
}
static void monitor_thermal_zone(struct thermal_zone_device *tz)
{
- int delay = 0;
-
mutex_lock(&tz->lock);
if (tz->passive)
- delay = tz->passive_delay;
+ thermal_zone_device_set_polling(tz, tz->passive_delay);
+ else if (tz->polling_delay)
+ thermal_zone_device_set_polling(tz, tz->polling_delay);
else
- delay = tz->polling_delay;
-
- if (delay > 0)
- thermal_zone_device_set_polling(tz, delay);
+ thermal_zone_device_set_polling(tz, 0);
mutex_unlock(&tz->lock);
-
- if (delay <= 0)
- thermal_zone_device_cancel_polling(tz);
}
static void handle_non_critical_trips(struct thermal_zone_device *tz,
@@ -1735,7 +1714,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
INIT_DELAYED_WORK(&(tz->poll_queue), thermal_zone_device_check);
if (!tz->ops->get_temp)
- thermal_zone_device_cancel_polling(tz);
+ thermal_zone_device_set_polling(tz, 0);
thermal_zone_device_update(tz);
@@ -1801,7 +1780,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
mutex_unlock(&thermal_list_lock);
- thermal_zone_device_cancel_polling(tz);
+ thermal_zone_device_set_polling(tz, 0);
if (tz->type[0])
device_remove_file(&tz->device, &dev_attr_type);