thermal: core: Drop trips_disabled bitmask
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 19 Sep 2023 18:54:37 +0000 (20:54 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 25 Sep 2023 09:46:19 +0000 (11:46 +0200)
After recent changes, thermal_zone_get_trip() cannot fail, as invoked
from thermal_zone_device_register_with_trips(), so the only role of
the trips_disabled bitmask is struct thermal_zone_device is to make
handle_thermal_trip() skip trip points whose temperature was initially
zero.  However, since the unit of temperature in the thermal core is
millicelsius, zero may very well be a valid temperature value at least
in some usage scenarios and the trip temperature may as well change
later.  Thus there is no reason to permanently disable trip points
with initial temperature equal to zero.

Accordingly, drop the trips_disabled bitmask along with the code
related to it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/thermal/thermal_core.c
include/linux/thermal.h

index 58533ea75cd92563a19acd07e37f9095031eb9a7..38d393f139d809d1964dd66557c5712743066c99 100644 (file)
@@ -347,10 +347,6 @@ 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))
-               return;
-
        __thermal_zone_get_trip(tz, trip_id, &trip);
 
        if (trip.temperature == THERMAL_TEMP_INVALID)
@@ -1231,7 +1227,6 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
        struct thermal_zone_device *tz;
        int id;
        int result;
-       int count;
        struct thermal_governor *governor;
 
        if (!type || strlen(type) == 0) {
@@ -1328,14 +1323,6 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
        if (result)
                goto release_device;
 
-       for (count = 0; count < num_trips; count++) {
-               struct thermal_trip trip;
-
-               result = thermal_zone_get_trip(tz, count, &trip);
-               if (result || !trip.temperature)
-                       set_bit(count, &tz->trips_disabled);
-       }
-
        /* Update 'this' zone's governor information */
        mutex_lock(&thermal_governor_lock);
 
index a5ae4af955ff926f9b9d49c30cab61a4f0f9f45e..6cfcae22ba123acd6c14de5a16c2340b0adb1b35 100644 (file)
@@ -122,7 +122,6 @@ struct thermal_cooling_device {
  * @devdata:   private pointer for device private data
  * @trips:     an array of struct thermal_trip
  * @num_trips: number of trip points the thermal zone supports
- * @trips_disabled;    bitmap for disabled trips
  * @passive_delay_jiffies: number of jiffies to wait between polls when
  *                     performing passive cooling.
  * @polling_delay_jiffies: number of jiffies to wait between polls when
@@ -163,7 +162,6 @@ struct thermal_zone_device {
        void *devdata;
        struct thermal_trip *trips;
        int num_trips;
-       unsigned long trips_disabled;   /* bitmap for disabled trips */
        unsigned long passive_delay_jiffies;
        unsigned long polling_delay_jiffies;
        int temperature;