Thermal control updates for 6.6-rc2

- 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).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmUEoRMSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxfVsP/RxIkKsn7YcypovlS2Wvu3T8TqqFaI/T
 jFiYuue3MFnOds4fKva6gG4Y9GO32EnO+zwbtcDhlgjHcWZcBk44ZleyaGE3zyTZ
 f39L8QcYKe7zbE90taj8F8jKq831i2tuhOMrOZlbu+gLc+i+M06uB7CdMp1RCR9J
 7k5IdFkscU5cB6arrtpV87K/YUaHvYih4O0aVkRws0X4pIpnE87w59CgAUVPY31d
 eFSfnxyO2nQFOYNvBNehNoWzCNnhkHCeJjnXNrrC7r9fkKrALmPc7Zg5m0Lqlb5r
 2baGg9E3MnY52tAU6isWmEhRx6MNHmKH5oh9eKgdkGyFtUF3RyH0M4jDnpzkUHre
 7higm6mS0gDCefmDQ5n++bvVBOEoR59ZkgOXs7V87P0Epr+qT3hm6MLuKenamCsm
 M8LfJnssHsQwXaN5/p6nfsGzJrAlm6+eJhffjAl1LNfJPg1HE79saJgK8ZR2thKG
 9lz9xkZOzx1/gYZCaEt71JHwox8y2xLqyqj2dt+vRmdBGV3AUgFyi4uaj4d25YOP
 K2xCPR0BQhbxqiw1v+dm0oY1tOWdI4AOGPxPfIgnaBkomWFvZYcbiiqwew75Ek54
 /fggciBPMNiohQ9SnjxpehZMKY3tzJ9jOrGhYw2oBoduyc5iL5COY4bUYPxXe8XL
 ho4gfJ01tGcV
 =D9SO
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Linus Torvalds 2023-09-15 14:52:59 -07:00
commit e2dd7a1683
5 changed files with 15 additions and 8 deletions

View File

@ -492,7 +492,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
}
static int thermal_get_trend(struct thermal_zone_device *thermal,
struct thermal_trip *trip,
const struct thermal_trip *trip,
enum thermal_trend *trend)
{
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);

View File

@ -348,12 +348,14 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip_id)
struct thermal_trip trip;
/* Ignore disabled trip points */
if (test_bit(trip_id, &tz->trips_disabled) ||
trip.temperature == THERMAL_TEMP_INVALID)
if (test_bit(trip_id, &tz->trips_disabled))
return;
__thermal_zone_get_trip(tz, trip_id, &trip);
if (trip.temperature == THERMAL_TEMP_INVALID)
return;
if (tz->last_temperature != THERMAL_TEMP_INVALID) {
if (tz->last_temperature < trip.temperature &&
tz->temperature >= trip.temperature)

View File

@ -37,8 +37,10 @@ static int of_find_trip_id(struct device_node *np, struct device_node *trip)
*/
for_each_child_of_node(trips, t) {
if (t == trip)
if (t == trip) {
of_node_put(t);
goto out;
}
i++;
}
@ -401,8 +403,10 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz,
for_each_child_of_node(cm_np, child) {
ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action);
if (ret)
if (ret) {
of_node_put(child);
break;
}
}
of_node_put(cm_np);

View File

@ -110,7 +110,8 @@ static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *tem
}
static int __ti_thermal_get_trend(struct thermal_zone_device *tz,
struct thermal_trip *trip, enum thermal_trend *trend)
const struct thermal_trip *trip,
enum thermal_trend *trend)
{
struct ti_thermal_data *data = thermal_zone_device_priv(tz);
struct ti_bandgap *bgp;

View File

@ -80,8 +80,8 @@ struct thermal_zone_device_ops {
int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
int (*get_crit_temp) (struct thermal_zone_device *, int *);
int (*set_emul_temp) (struct thermal_zone_device *, int);
int (*get_trend) (struct thermal_zone_device *, struct thermal_trip *,
enum thermal_trend *);
int (*get_trend) (struct thermal_zone_device *,
const struct thermal_trip *, enum thermal_trend *);
void (*hot)(struct thermal_zone_device *);
void (*critical)(struct thermal_zone_device *);
};