diff options
-rw-r--r-- | drivers/thermal/thermal_core.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index f19fe03e919f..d33b29a1553f 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
@@ -137,10 +137,15 @@ int thermal_register_governor(struct thermal_governor *governor) | |||
137 | 137 | ||
138 | err = -EBUSY; | 138 | err = -EBUSY; |
139 | if (!__find_governor(governor->name)) { | 139 | if (!__find_governor(governor->name)) { |
140 | bool match_default; | ||
141 | |||
140 | err = 0; | 142 | err = 0; |
141 | list_add(&governor->governor_list, &thermal_governor_list); | 143 | list_add(&governor->governor_list, &thermal_governor_list); |
142 | if (!def_governor && !strncmp(governor->name, | 144 | match_default = !strncmp(governor->name, |
143 | DEFAULT_THERMAL_GOVERNOR, THERMAL_NAME_LENGTH)) | 145 | DEFAULT_THERMAL_GOVERNOR, |
146 | THERMAL_NAME_LENGTH); | ||
147 | |||
148 | if (!def_governor && match_default) | ||
144 | def_governor = governor; | 149 | def_governor = governor; |
145 | } | 150 | } |
146 | 151 | ||
@@ -189,7 +194,7 @@ void thermal_unregister_governor(struct thermal_governor *governor) | |||
189 | 194 | ||
190 | list_for_each_entry(pos, &thermal_tz_list, node) { | 195 | list_for_each_entry(pos, &thermal_tz_list, node) { |
191 | if (!strncasecmp(pos->governor->name, governor->name, | 196 | if (!strncasecmp(pos->governor->name, governor->name, |
192 | THERMAL_NAME_LENGTH)) | 197 | THERMAL_NAME_LENGTH)) |
193 | thermal_set_governor(pos, NULL); | 198 | thermal_set_governor(pos, NULL); |
194 | } | 199 | } |
195 | 200 | ||
@@ -312,14 +317,15 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz) | |||
312 | } | 317 | } |
313 | 318 | ||
314 | static void handle_non_critical_trips(struct thermal_zone_device *tz, | 319 | static void handle_non_critical_trips(struct thermal_zone_device *tz, |
315 | int trip, enum thermal_trip_type trip_type) | 320 | int trip, |
321 | enum thermal_trip_type trip_type) | ||
316 | { | 322 | { |
317 | tz->governor ? tz->governor->throttle(tz, trip) : | 323 | tz->governor ? tz->governor->throttle(tz, trip) : |
318 | def_governor->throttle(tz, trip); | 324 | def_governor->throttle(tz, trip); |
319 | } | 325 | } |
320 | 326 | ||
321 | static void handle_critical_trips(struct thermal_zone_device *tz, | 327 | static void handle_critical_trips(struct thermal_zone_device *tz, |
322 | int trip, enum thermal_trip_type trip_type) | 328 | int trip, enum thermal_trip_type trip_type) |
323 | { | 329 | { |
324 | int trip_temp; | 330 | int trip_temp; |
325 | 331 | ||
@@ -797,7 +803,7 @@ static void thermal_release(struct device *dev) | |||
797 | tz = to_thermal_zone(dev); | 803 | tz = to_thermal_zone(dev); |
798 | kfree(tz); | 804 | kfree(tz); |
799 | } else if(!strncmp(dev_name(dev), "cooling_device", | 805 | } else if(!strncmp(dev_name(dev), "cooling_device", |
800 | sizeof("cooling_device") - 1)){ | 806 | sizeof("cooling_device") - 1)) { |
801 | cdev = to_cooling_device(dev); | 807 | cdev = to_cooling_device(dev); |
802 | kfree(cdev); | 808 | kfree(cdev); |
803 | } | 809 | } |
@@ -1131,11 +1137,11 @@ exit: | |||
1131 | * in case of error, an ERR_PTR. Caller must check return value with | 1137 | * in case of error, an ERR_PTR. Caller must check return value with |
1132 | * IS_ERR*() helpers. | 1138 | * IS_ERR*() helpers. |
1133 | */ | 1139 | */ |
1134 | struct thermal_zone_device *thermal_zone_device_register(const char *type, | 1140 | struct thermal_zone_device * |
1135 | int trips, int mask, void *devdata, | 1141 | thermal_zone_device_register(const char *type, int trips, int mask, |
1136 | struct thermal_zone_device_ops *ops, | 1142 | void *devdata, struct thermal_zone_device_ops *ops, |
1137 | struct thermal_zone_params *tzp, | 1143 | struct thermal_zone_params *tzp, int passive_delay, |
1138 | int passive_delay, int polling_delay) | 1144 | int polling_delay) |
1139 | { | 1145 | { |
1140 | struct thermal_zone_device *tz; | 1146 | struct thermal_zone_device *tz; |
1141 | enum thermal_trip_type trip_type; | 1147 | enum thermal_trip_type trip_type; |
@@ -1400,7 +1406,7 @@ static struct genl_family thermal_event_genl_family = { | |||
1400 | }; | 1406 | }; |
1401 | 1407 | ||
1402 | int thermal_generate_netlink_event(struct thermal_zone_device *tz, | 1408 | int thermal_generate_netlink_event(struct thermal_zone_device *tz, |
1403 | enum events event) | 1409 | enum events event) |
1404 | { | 1410 | { |
1405 | struct sk_buff *skb; | 1411 | struct sk_buff *skb; |
1406 | struct nlattr *attr; | 1412 | struct nlattr *attr; |
@@ -1477,7 +1483,7 @@ static inline void genetlink_exit(void) {} | |||
1477 | #endif /* !CONFIG_NET */ | 1483 | #endif /* !CONFIG_NET */ |
1478 | 1484 | ||
1479 | static int thermal_pm_notify(struct notifier_block *nb, | 1485 | static int thermal_pm_notify(struct notifier_block *nb, |
1480 | unsigned long mode, void *_unused) | 1486 | unsigned long mode, void *_unused) |
1481 | { | 1487 | { |
1482 | struct thermal_zone_device *tz; | 1488 | struct thermal_zone_device *tz; |
1483 | 1489 | ||