mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
UPSTREAM: thermal: consistently use int for trip temp
The commit17e8351a77consistently use int for temperature, however it missed a few in trip temperature and thermal_core. In current codes, the trip->temperature used "unsigned long" and zone->temperature used"int", if the temperature is negative value, it will get wrong result when compare temperature with trip temperature. This patch can fix it. Change-Id: I4b31f577a6142bc02f8e0deae79ab2ff7c8bd978 Signed-off-by: Wei Ni <wni@nvidia.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com> (cherry picked from commit1d0fd42fa3)
This commit is contained in:
@@ -727,7 +727,7 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr,
|
||||
{
|
||||
struct thermal_zone_device *tz = to_thermal_zone(dev);
|
||||
int trip, ret;
|
||||
unsigned long temperature;
|
||||
int temperature;
|
||||
|
||||
if (!tz->ops->set_trip_temp)
|
||||
return -EPERM;
|
||||
@@ -735,7 +735,7 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr,
|
||||
if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip))
|
||||
return -EINVAL;
|
||||
|
||||
if (kstrtoul(buf, 10, &temperature))
|
||||
if (kstrtoint(buf, 10, &temperature))
|
||||
return -EINVAL;
|
||||
|
||||
ret = tz->ops->set_trip_temp(tz, trip, temperature);
|
||||
@@ -940,9 +940,9 @@ emul_temp_store(struct device *dev, struct device_attribute *attr,
|
||||
{
|
||||
struct thermal_zone_device *tz = to_thermal_zone(dev);
|
||||
int ret = 0;
|
||||
unsigned long temperature;
|
||||
int temperature;
|
||||
|
||||
if (kstrtoul(buf, 10, &temperature))
|
||||
if (kstrtoint(buf, 10, &temperature))
|
||||
return -EINVAL;
|
||||
|
||||
if (!tz->ops->set_emul_temp) {
|
||||
|
||||
@@ -358,8 +358,8 @@ struct thermal_zone_of_device_ops {
|
||||
|
||||
struct thermal_trip {
|
||||
struct device_node *np;
|
||||
unsigned long int temperature;
|
||||
unsigned long int hysteresis;
|
||||
int temperature;
|
||||
int hysteresis;
|
||||
enum thermal_trip_type type;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user