diff options
author | Zhang Rui <rui.zhang@intel.com> | 2016-08-08 10:59:35 +0800 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2016-08-08 10:59:35 +0800 |
commit | 1577ddfac75ff9690ebd0d210bc7f1345c9d29ef (patch) | |
tree | af9d348ccc26df846c7c69e62624465f42205745 /drivers/thermal/thermal_core.c | |
parent | 70c50ee72eebb3d1e3aae7450269fd8d8074c610 (diff) | |
parent | 165989a5b667b90589f21c8affe496ad21f08591 (diff) | |
download | talos-obmc-linux-1577ddfac75ff9690ebd0d210bc7f1345c9d29ef.tar.gz talos-obmc-linux-1577ddfac75ff9690ebd0d210bc7f1345c9d29ef.zip |
Merge branches 'thermal-intel' and 'thermal-core' into next
Diffstat (limited to 'drivers/thermal/thermal_core.c')
-rw-r--r-- | drivers/thermal/thermal_core.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 5133cd1e10b7..e2fc6161dded 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1093,7 +1093,9 @@ int power_actor_set_power(struct thermal_cooling_device *cdev, return ret; instance->target = state; + mutex_lock(&cdev->lock); cdev->updated = false; + mutex_unlock(&cdev->lock); thermal_cdev_update(cdev); return 0; @@ -1623,11 +1625,13 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev) struct thermal_instance *instance; unsigned long target = 0; + mutex_lock(&cdev->lock); /* cooling device is updated*/ - if (cdev->updated) + if (cdev->updated) { + mutex_unlock(&cdev->lock); return; + } - mutex_lock(&cdev->lock); /* Make sure cdev enters the deepest cooling state */ list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) { dev_dbg(&cdev->device, "zone%d->target=%lu\n", @@ -1637,9 +1641,9 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev) if (instance->target > target) target = instance->target; } - mutex_unlock(&cdev->lock); cdev->ops->set_cur_state(cdev, target); cdev->updated = true; + mutex_unlock(&cdev->lock); trace_cdev_update(cdev, target); dev_dbg(&cdev->device, "set to state %lu\n", target); } |