Skip to content

Commit

Permalink
Merge branches 'thermal-intel' and 'thermal-core' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhang Rui committed Aug 8, 2016
2 parents 70c50ee + 165989a commit 1577ddf
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions drivers/thermal/clock_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ clock_cooling_register(struct device *dev, const char *clock_name)
if (!ccdev)
return ERR_PTR(-ENOMEM);

mutex_init(&ccdev->lock);
ccdev->dev = dev;
ccdev->clk = devm_clk_get(dev, clock_name);
if (IS_ERR(ccdev->clk))
Expand Down
2 changes: 2 additions & 0 deletions drivers/thermal/fair_share.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
instance->target = get_target_state(tz, cdev, percentage,
cur_trip_level);

mutex_lock(&instance->cdev->lock);
instance->cdev->updated = false;
mutex_unlock(&instance->cdev->lock);
thermal_cdev_update(cdev);
}
return 0;
Expand Down
2 changes: 2 additions & 0 deletions drivers/thermal/gov_bang_bang.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
dev_dbg(&instance->cdev->device, "target=%d\n",
(int)instance->target);

mutex_lock(&instance->cdev->lock);
instance->cdev->updated = false; /* cdev needs update */
mutex_unlock(&instance->cdev->lock);
}

mutex_unlock(&tz->lock);
Expand Down
2 changes: 2 additions & 0 deletions drivers/thermal/power_allocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,9 @@ static void allow_maximum_power(struct thermal_zone_device *tz)
continue;

instance->target = 0;
mutex_lock(&instance->cdev->lock);
instance->cdev->updated = false;
mutex_unlock(&instance->cdev->lock);
thermal_cdev_update(instance->cdev);
}
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/thermal/step_wise.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
update_passive_instance(tz, trip_type, -1);

instance->initialized = true;
mutex_lock(&instance->cdev->lock);
instance->cdev->updated = false; /* cdev needs update */
mutex_unlock(&instance->cdev->lock);
}

mutex_unlock(&tz->lock);
Expand Down
10 changes: 7 additions & 3 deletions drivers/thermal/thermal_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand All @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/thermal/thermal_hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)

return result;
}
EXPORT_SYMBOL_GPL(thermal_add_hwmon_sysfs);

void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
{
Expand Down Expand Up @@ -270,3 +271,4 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
hwmon_device_unregister(hwmon->device);
kfree(hwmon);
}
EXPORT_SYMBOL_GPL(thermal_remove_hwmon_sysfs);

0 comments on commit 1577ddf

Please sign in to comment.