|
13 | 13 |
|
14 | 14 | #include "thermal_core.h"
|
15 | 15 |
|
16 |
| -static void thermal_zone_trip_update(struct thermal_zone_device *tz, |
17 |
| - const struct thermal_trip *trip, |
18 |
| - bool crossed_up) |
19 |
| -{ |
20 |
| - struct thermal_instance *instance; |
21 |
| - |
22 |
| - dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n", |
23 |
| - thermal_zone_trip_id(tz, trip), trip->temperature, |
24 |
| - tz->temperature, trip->hysteresis); |
25 |
| - |
26 |
| - list_for_each_entry(instance, &tz->thermal_instances, tz_node) { |
27 |
| - if (instance->trip != trip) |
28 |
| - continue; |
29 |
| - |
30 |
| - if (instance->target == THERMAL_NO_TARGET) |
31 |
| - instance->target = 0; |
32 |
| - |
33 |
| - if (instance->target != 0 && instance->target != 1) { |
34 |
| - pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n", |
35 |
| - instance->target, instance->name); |
36 |
| - |
37 |
| - instance->target = 1; |
38 |
| - } |
39 |
| - |
40 |
| - /* |
41 |
| - * Enable the fan when the trip is crossed on the way up and |
42 |
| - * disable it when the trip is crossed on the way down. |
43 |
| - */ |
44 |
| - if (instance->target == 0 && crossed_up) |
45 |
| - instance->target = 1; |
46 |
| - else if (instance->target == 1 && !crossed_up) |
47 |
| - instance->target = 0; |
48 |
| - |
49 |
| - dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target); |
50 |
| - |
51 |
| - mutex_lock(&instance->cdev->lock); |
52 |
| - instance->cdev->updated = false; /* cdev needs update */ |
53 |
| - mutex_unlock(&instance->cdev->lock); |
54 |
| - } |
55 |
| -} |
56 |
| - |
57 | 16 | /**
|
58 | 17 | * bang_bang_control - controls devices associated with the given zone
|
59 | 18 | * @tz: thermal_zone_device
|
@@ -90,7 +49,39 @@ static void bang_bang_control(struct thermal_zone_device *tz,
|
90 | 49 |
|
91 | 50 | lockdep_assert_held(&tz->lock);
|
92 | 51 |
|
93 |
| - thermal_zone_trip_update(tz, trip, crossed_up); |
| 52 | + dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n", |
| 53 | + thermal_zone_trip_id(tz, trip), trip->temperature, |
| 54 | + tz->temperature, trip->hysteresis); |
| 55 | + |
| 56 | + list_for_each_entry(instance, &tz->thermal_instances, tz_node) { |
| 57 | + if (instance->trip != trip) |
| 58 | + continue; |
| 59 | + |
| 60 | + if (instance->target == THERMAL_NO_TARGET) |
| 61 | + instance->target = 0; |
| 62 | + |
| 63 | + if (instance->target != 0 && instance->target != 1) { |
| 64 | + pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n", |
| 65 | + instance->target, instance->name); |
| 66 | + |
| 67 | + instance->target = 1; |
| 68 | + } |
| 69 | + |
| 70 | + /* |
| 71 | + * Enable the fan when the trip is crossed on the way up and |
| 72 | + * disable it when the trip is crossed on the way down. |
| 73 | + */ |
| 74 | + if (instance->target == 0 && crossed_up) |
| 75 | + instance->target = 1; |
| 76 | + else if (instance->target == 1 && !crossed_up) |
| 77 | + instance->target = 0; |
| 78 | + |
| 79 | + dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target); |
| 80 | + |
| 81 | + mutex_lock(&instance->cdev->lock); |
| 82 | + instance->cdev->updated = false; /* cdev needs update */ |
| 83 | + mutex_unlock(&instance->cdev->lock); |
| 84 | + } |
94 | 85 |
|
95 | 86 | list_for_each_entry(instance, &tz->thermal_instances, tz_node)
|
96 | 87 | thermal_cdev_update(instance->cdev);
|
|
0 commit comments