From patchwork Tue Mar 28 03:16:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiangshan Yi X-Patchwork-Id: 668172 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2000EC76196 for ; Tue, 28 Mar 2023 03:17:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232345AbjC1DR2 (ORCPT ); Mon, 27 Mar 2023 23:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbjC1DR1 (ORCPT ); Mon, 27 Mar 2023 23:17:27 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65ED41A6; Mon, 27 Mar 2023 20:17:24 -0700 (PDT) X-UUID: 772770d80c7d4fd38ba61bfec402c8de-20230328 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20, REQID:f8a37e21-fb75-4c37-b66e-8dd682e4175d, IP:10, URL:0,TC:0,Content:-5,EDM:25,RT:0,SF:1,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:31 X-CID-INFO: VERSION:1.1.20, REQID:f8a37e21-fb75-4c37-b66e-8dd682e4175d, IP:10, UR L:0,TC:0,Content:-5,EDM:25,RT:0,SF:1,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:31 X-CID-META: VersionHash:25b5999, CLOUDID:ea98ae29-564d-42d9-9875-7c868ee415ec, B ulkID:230328111721W4Q58S1F,BulkQuantity:0,Recheck:0,SF:24|17|19|43|102,TC: nil,Content:0,EDM:5,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI :0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: 772770d80c7d4fd38ba61bfec402c8de-20230328 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 505668487; Tue, 28 Mar 2023 11:17:18 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 93F94E0084A1; Tue, 28 Mar 2023 11:17:18 +0800 (CST) X-ns-mid: postfix-64225C3E-350120133 Received: from localhost.localdomain (unknown [172.20.125.154]) by mail.kylinos.cn (NSMail) with ESMTPA id CCA28E0084A1; Tue, 28 Mar 2023 11:17:17 +0800 (CST) From: Jiangshan Yi To: rafael@kernel.org Cc: rui.zhang@intel.com, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, 13667453960@163.com, Jiangshan Yi Subject: [PATCH] ACPI: thermal: replace ternary operator with min_t() Date: Tue, 28 Mar 2023 11:16:29 +0800 Message-Id: <20230328031629.202268-1-yijiangshan@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Fix the following 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 --- drivers/acpi/thermal.c | 7 +++---- 1 file 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 {