Loading drivers/thermal/thermal_core.c +14 −12 Original line number Diff line number Diff line Loading @@ -520,7 +520,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) if (!ret && *temp < crit_temp) *temp = tz->emul_temperature; } mutex_unlock(&tz->lock); exit: return ret; Loading Loading @@ -1220,8 +1219,7 @@ thermal_cooling_device_cur_state_store(struct device *dev, const char *buf, size_t count) { struct thermal_cooling_device *cdev = to_cooling_device(dev); unsigned long state; int result; long state; if (!sscanf(buf, "%ld\n", &state)) return -EINVAL; Loading @@ -1229,9 +1227,11 @@ thermal_cooling_device_cur_state_store(struct device *dev, if ((long)state < 0) return -EINVAL; result = cdev->ops->set_cur_state(cdev, state); if (result) return result; cdev->sysfs_cur_state_req = state; cdev->updated = false; thermal_cdev_update(cdev); return count; } Loading Loading @@ -1555,6 +1555,7 @@ __thermal_cooling_device_register(struct device_node *np, cdev->device.class = &thermal_class; cdev->device.groups = cooling_device_attr_groups; cdev->devdata = devdata; cdev->sysfs_cur_state_req = 0; dev_set_name(&cdev->device, "cooling_device%d", cdev->id); result = device_register(&cdev->device); if (result) { Loading Loading @@ -1689,7 +1690,7 @@ EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister); void thermal_cdev_update(struct thermal_cooling_device *cdev) { struct thermal_instance *instance; unsigned long target = 0; unsigned long current_target = 0; mutex_lock(&cdev->lock); /* cooling device is updated*/ Loading @@ -1699,19 +1700,20 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev) } /* Make sure cdev enters the deepest cooling state */ current_target = cdev->sysfs_cur_state_req; list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) { dev_dbg(&cdev->device, "zone%d->target=%lu\n", instance->tz->id, instance->target); if (instance->target == THERMAL_NO_TARGET) continue; if (instance->target > target) target = instance->target; if (instance->target > current_target) current_target = instance->target; } cdev->ops->set_cur_state(cdev, target); cdev->ops->set_cur_state(cdev, current_target); cdev->updated = true; mutex_unlock(&cdev->lock); trace_cdev_update(cdev, target); dev_dbg(&cdev->device, "set to state %lu\n", target); trace_cdev_update(cdev, current_target); dev_dbg(&cdev->device, "set to state %lu\n", current_target); } EXPORT_SYMBOL(thermal_cdev_update); Loading include/linux/thermal.h +2 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,8 @@ struct thermal_cooling_device { struct mutex lock; /* protect thermal_instances list */ struct list_head thermal_instances; struct list_head node; unsigned long sysfs_cur_state_req; unsigned long sysfs_min_state_req; }; struct thermal_attr { Loading Loading
drivers/thermal/thermal_core.c +14 −12 Original line number Diff line number Diff line Loading @@ -520,7 +520,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) if (!ret && *temp < crit_temp) *temp = tz->emul_temperature; } mutex_unlock(&tz->lock); exit: return ret; Loading Loading @@ -1220,8 +1219,7 @@ thermal_cooling_device_cur_state_store(struct device *dev, const char *buf, size_t count) { struct thermal_cooling_device *cdev = to_cooling_device(dev); unsigned long state; int result; long state; if (!sscanf(buf, "%ld\n", &state)) return -EINVAL; Loading @@ -1229,9 +1227,11 @@ thermal_cooling_device_cur_state_store(struct device *dev, if ((long)state < 0) return -EINVAL; result = cdev->ops->set_cur_state(cdev, state); if (result) return result; cdev->sysfs_cur_state_req = state; cdev->updated = false; thermal_cdev_update(cdev); return count; } Loading Loading @@ -1555,6 +1555,7 @@ __thermal_cooling_device_register(struct device_node *np, cdev->device.class = &thermal_class; cdev->device.groups = cooling_device_attr_groups; cdev->devdata = devdata; cdev->sysfs_cur_state_req = 0; dev_set_name(&cdev->device, "cooling_device%d", cdev->id); result = device_register(&cdev->device); if (result) { Loading Loading @@ -1689,7 +1690,7 @@ EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister); void thermal_cdev_update(struct thermal_cooling_device *cdev) { struct thermal_instance *instance; unsigned long target = 0; unsigned long current_target = 0; mutex_lock(&cdev->lock); /* cooling device is updated*/ Loading @@ -1699,19 +1700,20 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev) } /* Make sure cdev enters the deepest cooling state */ current_target = cdev->sysfs_cur_state_req; list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) { dev_dbg(&cdev->device, "zone%d->target=%lu\n", instance->tz->id, instance->target); if (instance->target == THERMAL_NO_TARGET) continue; if (instance->target > target) target = instance->target; if (instance->target > current_target) current_target = instance->target; } cdev->ops->set_cur_state(cdev, target); cdev->ops->set_cur_state(cdev, current_target); cdev->updated = true; mutex_unlock(&cdev->lock); trace_cdev_update(cdev, target); dev_dbg(&cdev->device, "set to state %lu\n", target); trace_cdev_update(cdev, current_target); dev_dbg(&cdev->device, "set to state %lu\n", current_target); } EXPORT_SYMBOL(thermal_cdev_update); Loading
include/linux/thermal.h +2 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,8 @@ struct thermal_cooling_device { struct mutex lock; /* protect thermal_instances list */ struct list_head thermal_instances; struct list_head node; unsigned long sysfs_cur_state_req; unsigned long sysfs_min_state_req; }; struct thermal_attr { Loading