summaryrefslogtreecommitdiffstats
path: root/drivers/thermal/thermal_core.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-02-22 19:09:16 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-02-27 12:04:38 +0100
commit4a62d588a84e13c68017bd16bc9c2531a2cde08f (patch)
tree0b530ffe284e6789a6848b75819a32a0047dc2f9 /drivers/thermal/thermal_core.c
parent83c2d444ed9da7dd3536abb7596de309b8a9991f (diff)
downloadlinux-stable-4a62d588a84e13c68017bd16bc9c2531a2cde08f.tar.gz
linux-stable-4a62d588a84e13c68017bd16bc9c2531a2cde08f.tar.bz2
linux-stable-4a62d588a84e13c68017bd16bc9c2531a2cde08f.zip
thermal: core: Eliminate writable trip points masks
All of the thermal_zone_device_register_with_trips() callers pass zero writable trip points masks to it, so drop the mask argument from that function and update all of its callers accordingly. This also removes the artificial trip points per zone limit of 32, related to using writable trip points masks. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/thermal/thermal_core.c')
-rw-r--r--drivers/thermal/thermal_core.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 2ab495220c6e..f7a7d43809e7 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1248,7 +1248,6 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_crit_temp);
* @type: the thermal zone device type
* @trips: a pointer to an array of thermal trips
* @num_trips: the number of trip points the thermal zone support
- * @mask: a bit string indicating the writeablility of trip points
* @devdata: private device data
* @ops: standard thermal zone device callbacks
* @tzp: thermal zone platform parameters
@@ -1271,14 +1270,12 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_crit_temp);
struct thermal_zone_device *
thermal_zone_device_register_with_trips(const char *type,
const struct thermal_trip *trips,
- int num_trips, int mask,
- void *devdata,
+ int num_trips, void *devdata,
const struct thermal_zone_device_ops *ops,
const struct thermal_zone_params *tzp,
int passive_delay, int polling_delay)
{
struct thermal_zone_device *tz;
- struct thermal_trip *trip;
int id;
int result;
struct thermal_governor *governor;
@@ -1294,20 +1291,7 @@ thermal_zone_device_register_with_trips(const char *type,
return ERR_PTR(-EINVAL);
}
- /*
- * Max trip count can't exceed 31 as the "mask >> num_trips" condition.
- * For example, shifting by 32 will result in compiler warning:
- * warning: right shift count >= width of type [-Wshift-count- overflow]
- *
- * Also "mask >> num_trips" will always be true with 32 bit shift.
- * E.g. mask = 0x80000000 for trip id 31 to be RW. Then
- * mask >> 32 = 0x80000000
- * This will result in failure for the below condition.
- *
- * Check will be true when the bit 31 of the mask is set.
- * 32 bit shift will cause overflow of 4 byte integer.
- */
- if (num_trips > (BITS_PER_TYPE(int) - 1) || num_trips < 0 || mask >> num_trips) {
+ if (num_trips < 0) {
pr_err("Incorrect number of thermal trips\n");
return ERR_PTR(-EINVAL);
}
@@ -1357,12 +1341,6 @@ thermal_zone_device_register_with_trips(const char *type,
tz->devdata = devdata;
tz->num_trips = num_trips;
memcpy(tz->trips, trips, num_trips * sizeof(*trips));
- for_each_trip(tz, trip) {
- if (mask & 1)
- trip->flags |= THERMAL_TRIP_FLAG_RW_TEMP;
-
- mask >>= 1;
- }
thermal_set_delay_jiffies(&tz->passive_delay_jiffies, passive_delay);
thermal_set_delay_jiffies(&tz->polling_delay_jiffies, polling_delay);
@@ -1447,7 +1425,7 @@ struct thermal_zone_device *thermal_tripless_zone_device_register(
const struct thermal_zone_device_ops *ops,
const struct thermal_zone_params *tzp)
{
- return thermal_zone_device_register_with_trips(type, NULL, 0, 0, devdata,
+ return thermal_zone_device_register_with_trips(type, NULL, 0, devdata,
ops, tzp, 0, 0);
}
EXPORT_SYMBOL_GPL(thermal_tripless_zone_device_register);