hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/thermal/thermal_helpers.c
....@@ -12,11 +12,12 @@
1212
1313 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1414
15
-#include <linux/sysfs.h>
1615 #include <linux/device.h>
1716 #include <linux/err.h>
17
+#include <linux/export.h>
1818 #include <linux/slab.h>
1919 #include <linux/string.h>
20
+#include <linux/sysfs.h>
2021
2122 #include <trace/events/thermal.h>
2223
....@@ -113,6 +114,18 @@
113114 }
114115 EXPORT_SYMBOL_GPL(thermal_zone_get_temp);
115116
117
+/**
118
+ * thermal_zone_set_trips - Computes the next trip points for the driver
119
+ * @tz: a pointer to a thermal zone device structure
120
+ *
121
+ * The function computes the next temperature boundaries by browsing
122
+ * the trip points. The result is the closer low and high trip points
123
+ * to the current temperature. These values are passed to the backend
124
+ * driver to let it set its own notification mechanism (usually an
125
+ * interrupt).
126
+ *
127
+ * It does not return a value
128
+ */
116129 void thermal_zone_set_trips(struct thermal_zone_device *tz)
117130 {
118131 int low = -INT_MAX;
....@@ -161,7 +174,16 @@
161174 exit:
162175 mutex_unlock(&tz->lock);
163176 }
164
-EXPORT_SYMBOL_GPL(thermal_zone_set_trips);
177
+
178
+static void thermal_cdev_set_cur_state(struct thermal_cooling_device *cdev,
179
+ int target)
180
+{
181
+ if (cdev->ops->set_cur_state(cdev, target))
182
+ return;
183
+
184
+ thermal_notify_cdev_state_update(cdev->id, target);
185
+ thermal_cooling_device_stats_update(cdev, target);
186
+}
165187
166188 void thermal_cdev_update(struct thermal_cooling_device *cdev)
167189 {
....@@ -185,8 +207,7 @@
185207 target = instance->target;
186208 }
187209
188
- if (!cdev->ops->set_cur_state(cdev, target))
189
- thermal_cooling_device_stats_update(cdev, target);
210
+ thermal_cdev_set_cur_state(cdev, target);
190211
191212 cdev->updated = true;
192213 mutex_unlock(&cdev->lock);