aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/thermal_core.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-09-01 12:33:46 -0400
committerThomas Gleixner <tglx@linutronix.de>2016-09-01 12:33:46 -0400
commit0cb7bf61b1e9f05027de58c80f9b46a714d24e35 (patch)
tree41fb55cf62d07b425122f9a8b96412c0d8eb99c5 /drivers/thermal/thermal_core.c
parentaa877175e7a9982233ed8f10cb4bfddd78d82741 (diff)
parent3eab887a55424fc2c27553b7bfe32330df83f7b8 (diff)
Merge branch 'linus' into smp/hotplug
Apply upstream changes to avoid conflicts with pending patches.
Diffstat (limited to 'drivers/thermal/thermal_core.c')
-rw-r--r--drivers/thermal/thermal_core.c10
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,
1093 return ret; 1093 return ret;
1094 1094
1095 instance->target = state; 1095 instance->target = state;
1096 mutex_lock(&cdev->lock);
1096 cdev->updated = false; 1097 cdev->updated = false;
1098 mutex_unlock(&cdev->lock);
1097 thermal_cdev_update(cdev); 1099 thermal_cdev_update(cdev);
1098 1100
1099 return 0; 1101 return 0;
@@ -1623,11 +1625,13 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev)
1623 struct thermal_instance *instance; 1625 struct thermal_instance *instance;
1624 unsigned long target = 0; 1626 unsigned long target = 0;
1625 1627
1628 mutex_lock(&cdev->lock);
1626 /* cooling device is updated*/ 1629 /* cooling device is updated*/
1627 if (cdev->updated) 1630 if (cdev->updated) {
1631 mutex_unlock(&cdev->lock);
1628 return; 1632 return;
1633 }
1629 1634
1630 mutex_lock(&cdev->lock);
1631 /* Make sure cdev enters the deepest cooling state */ 1635 /* Make sure cdev enters the deepest cooling state */
1632 list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) { 1636 list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) {
1633 dev_dbg(&cdev->device, "zone%d->target=%lu\n", 1637 dev_dbg(&cdev->device, "zone%d->target=%lu\n",
@@ -1637,9 +1641,9 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev)
1637 if (instance->target > target) 1641 if (instance->target > target)
1638 target = instance->target; 1642 target = instance->target;
1639 } 1643 }
1640 mutex_unlock(&cdev->lock);
1641 cdev->ops->set_cur_state(cdev, target); 1644 cdev->ops->set_cur_state(cdev, target);
1642 cdev->updated = true; 1645 cdev->updated = true;
1646 mutex_unlock(&cdev->lock);
1643 trace_cdev_update(cdev, target); 1647 trace_cdev_update(cdev, target);
1644 dev_dbg(&cdev->device, "set to state %lu\n", target); 1648 dev_dbg(&cdev->device, "set to state %lu\n", target);
1645} 1649}