[RFC,4/8] thermal: core: Introduce THERMAL_DEVICE_INITIAL

Message ID 20200407174926.23971-5-andrzej.p@collabora.com
State New
Headers show
Series
  • Stop monitoring disabled devices
Related show

Commit Message

Andrzej Pietrasiewicz April 7, 2020, 5:49 p.m.
Add a new mode: THERMAL_DEVICE_INITIAL. It is dedicated to handle devices
which must be initially DISABLED, but which are polled at startup
nonetheless. THERMAL_DEVICE_INITIAL shall be reported as "enabled" in
sysfs to keep the userspace interface intact.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 drivers/thermal/thermal_sysfs.c | 4 ++--
 include/linux/thermal.h         | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index aa99edb4dff7..6bfef21abce4 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -59,8 +59,8 @@  mode_show(struct device *dev, struct device_attribute *attr, char *buf)
 	if (result)
 		return result;
 
-	return sprintf(buf, "%s\n", mode == THERMAL_DEVICE_ENABLED ? "enabled"
-		       : "disabled");
+	return sprintf(buf, "%s\n", mode == THERMAL_DEVICE_DISABLED ? "disabled"
+		       : "enabled");
 }
 
 static ssize_t
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 126913c6a53b..1bc6b7998093 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -48,8 +48,9 @@  struct thermal_cooling_device;
 struct thermal_instance;
 
 enum thermal_device_mode {
-	THERMAL_DEVICE_DISABLED = 0,
+	THERMAL_DEVICE_INITIAL = 0,
 	THERMAL_DEVICE_ENABLED,
+	THERMAL_DEVICE_DISABLED,
 };
 
 enum thermal_trip_type {