summaryrefslogtreecommitdiff
path: root/drivers/thermal/thermal_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal/thermal_sysfs.c')
-rw-r--r--drivers/thermal/thermal_sysfs.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 096370977068..c23d67c4dc4e 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -49,9 +49,9 @@ static ssize_t
mode_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct thermal_zone_device *tz = to_thermal_zone(dev);
+ int enabled = thermal_zone_device_is_enabled(tz);
- return sprintf(buf, "%s\n", tz->mode == THERMAL_DEVICE_ENABLED ?
- "enabled" : "disabled");
+ return sprintf(buf, "%s\n", enabled ? "enabled" : "disabled");
}
static ssize_t
@@ -61,13 +61,10 @@ mode_store(struct device *dev, struct device_attribute *attr,
struct thermal_zone_device *tz = to_thermal_zone(dev);
int result;
- if (!tz->ops->set_mode)
- return -EPERM;
-
if (!strncmp(buf, "enabled", sizeof("enabled") - 1))
- result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED);
+ result = thermal_zone_device_enable(tz);
else if (!strncmp(buf, "disabled", sizeof("disabled") - 1))
- result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED);
+ result = thermal_zone_device_disable(tz);
else
result = -EINVAL;