diff options
author | Jiangshan Yi <yijiangshan@kylinos.cn> | 2023-03-28 05:16:29 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-03-30 19:09:49 +0200 |
commit | 0dc9a715578b041b6159714f23f94cf71a214411 (patch) | |
tree | f3ec40c1c576ccf270e6764223e81cfde1a25844 | |
parent | Linux 6.3-rc4 (diff) | |
download | linux-0dc9a715578b041b6159714f23f94cf71a214411.tar.xz linux-0dc9a715578b041b6159714f23f94cf71a214411.zip |
ACPI: thermal: Replace ternary operator with min_t()
Modify the code in accordance with the coccicheck warning:
drivers/acpi/thermal.c:422: WARNING opportunity for min().
min_t() macro is defined in include/linux/minmax.h. It avoids multiple
evaluations of the arguments when non-constant and performs strict
type-checking.
Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/thermal.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 0b4b844f9d4c..179f41196a9d 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -419,10 +419,9 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) * the next higher trip point */ tz->trips.active[i-1].temperature = - (tz->trips.active[i-2].temperature < - celsius_to_deci_kelvin(act) ? - tz->trips.active[i-2].temperature : - celsius_to_deci_kelvin(act)); + min_t(unsigned long, + tz->trips.active[i-2].temperature, + celsius_to_deci_kelvin(act)); break; } else { |