Skip to content

Commit e2dd7a1

Browse files
committed
Merge tag 'thermal-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control fixes from Rafael Wysocki: "These fix a thermal core breakage introduced by one of the recent changes, amend those changes by adding 'const' to a new callback argument and fix two memory leaks. Specifics: - Unbreak disabled trip point check in handle_thermal_trip() that may cause it to skip enabled trip points (Rafael Wysocki) - Add missing of_node_put() to of_find_trip_id() and thermal_of_for_each_cooling_maps() that each break out of a for_each_child_of_node() loop without dropping the reference to the child object (Julia Lawall) - Constify the recently added trip argument of the .get_trend() thermal zone callback (Rafael Wysocki)" * tag 'thermal-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: thermal: core: Fix disabled trip point check in handle_thermal_trip() thermal: Constify the trip argument of the .get_trend() zone callback thermal/of: add missing of_node_put()
2 parents e39bfb5 + fb2c102 commit e2dd7a1

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

drivers/acpi/thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
492492
}
493493

494494
static int thermal_get_trend(struct thermal_zone_device *thermal,
495-
struct thermal_trip *trip,
495+
const struct thermal_trip *trip,
496496
enum thermal_trend *trend)
497497
{
498498
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);

drivers/thermal/thermal_core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,14 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip_id)
348348
struct thermal_trip trip;
349349

350350
/* Ignore disabled trip points */
351-
if (test_bit(trip_id, &tz->trips_disabled) ||
352-
trip.temperature == THERMAL_TEMP_INVALID)
351+
if (test_bit(trip_id, &tz->trips_disabled))
353352
return;
354353

355354
__thermal_zone_get_trip(tz, trip_id, &trip);
356355

356+
if (trip.temperature == THERMAL_TEMP_INVALID)
357+
return;
358+
357359
if (tz->last_temperature != THERMAL_TEMP_INVALID) {
358360
if (tz->last_temperature < trip.temperature &&
359361
tz->temperature >= trip.temperature)

drivers/thermal/thermal_of.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ static int of_find_trip_id(struct device_node *np, struct device_node *trip)
3737
*/
3838
for_each_child_of_node(trips, t) {
3939

40-
if (t == trip)
40+
if (t == trip) {
41+
of_node_put(t);
4142
goto out;
43+
}
4244
i++;
4345
}
4446

@@ -401,8 +403,10 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz,
401403

402404
for_each_child_of_node(cm_np, child) {
403405
ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action);
404-
if (ret)
406+
if (ret) {
407+
of_node_put(child);
405408
break;
409+
}
406410
}
407411

408412
of_node_put(cm_np);

drivers/thermal/ti-soc-thermal/ti-thermal-common.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *tem
110110
}
111111

112112
static int __ti_thermal_get_trend(struct thermal_zone_device *tz,
113-
struct thermal_trip *trip, enum thermal_trend *trend)
113+
const struct thermal_trip *trip,
114+
enum thermal_trend *trend)
114115
{
115116
struct ti_thermal_data *data = thermal_zone_device_priv(tz);
116117
struct ti_bandgap *bgp;

include/linux/thermal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ struct thermal_zone_device_ops {
8080
int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
8181
int (*get_crit_temp) (struct thermal_zone_device *, int *);
8282
int (*set_emul_temp) (struct thermal_zone_device *, int);
83-
int (*get_trend) (struct thermal_zone_device *, struct thermal_trip *,
84-
enum thermal_trend *);
83+
int (*get_trend) (struct thermal_zone_device *,
84+
const struct thermal_trip *, enum thermal_trend *);
8585
void (*hot)(struct thermal_zone_device *);
8686
void (*critical)(struct thermal_zone_device *);
8787
};

0 commit comments

Comments
 (0)