Commit ea310567 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

thermal: sysfs: Fix trip_point_hyst_store()

After commit 2e38a2a9 ("thermal/core: Add a generic thermal_zone_set_trip()
function") updating a trip point temperature doesn't actually work,
because the value supplied by user space is subsequently overwritten
with the current trip point hysteresis value.

Fix this by changing the code to parse the number string supplied by
user space after retrieving the current trip point data from the
thermal zone.

Also drop a redundant tab character from the code in question.

Fixes: 2e38a2a9 ("thermal/core: Add a generic thermal_zone_set_trip() function")
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: 6.3+ <stable@vger.kernel.org> # 6.3+
parent ce9ecca0
...@@ -185,9 +185,6 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr, ...@@ -185,9 +185,6 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr,
if (sscanf(attr->attr.name, "trip_point_%d_hyst", &trip_id) != 1) if (sscanf(attr->attr.name, "trip_point_%d_hyst", &trip_id) != 1)
return -EINVAL; return -EINVAL;
if (kstrtoint(buf, 10, &trip.hysteresis))
return -EINVAL;
mutex_lock(&tz->lock); mutex_lock(&tz->lock);
if (!device_is_registered(dev)) { if (!device_is_registered(dev)) {
...@@ -198,7 +195,11 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr, ...@@ -198,7 +195,11 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr,
ret = __thermal_zone_get_trip(tz, trip_id, &trip); ret = __thermal_zone_get_trip(tz, trip_id, &trip);
if (ret) if (ret)
goto unlock; goto unlock;
ret = kstrtoint(buf, 10, &trip.hysteresis);
if (ret)
goto unlock;
ret = thermal_zone_set_trip(tz, trip_id, &trip); ret = thermal_zone_set_trip(tz, trip_id, &trip);
unlock: unlock:
mutex_unlock(&tz->lock); mutex_unlock(&tz->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment