Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2445835rwl; Thu, 30 Mar 2023 10:21:30 -0700 (PDT) X-Google-Smtp-Source: AKy350YHgHCJq0fwOBmWtm0/Dzs3rnOZUDHwAqFC5gID09twOKhv+Gs6BfDLTr82mCZ1zAWNoCXx X-Received: by 2002:aa7:924e:0:b0:5e2:3086:f977 with SMTP id 14-20020aa7924e000000b005e23086f977mr3020432pfp.2.1680196890166; Thu, 30 Mar 2023 10:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680196890; cv=none; d=google.com; s=arc-20160816; b=GoyyHITqddi9ZtAe5W/e4Cmo7l/ybsgsO+LEs2TlYqs3Ke96OVuUYtSee7PjUrxN9k pLfwI63hZhM+fnTIU734InnEpNUEccerEUCrxpQC01ocQEaMWZTYzGeUSLeLVbMm0Tya iB5W88T4bilfBxXrBTOd+UhqSVerRcWVwoAZ9QySGLuD2Dt/nnGVpTFEa2pLBsgWJ0nV uBEBe9CJRshf0SPLGHzgZKpfVpRDhxXK8uOijPTBINWowOwhm+ofuo6FPoHx9713CxPF /VGlUHaRY0I/nbKbpEa7JGf2tHZ/PEy7qEDABgUqK3z9cE1EJgvZB1/IEGJUnADPMvy6 5uTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=ZBSUGTEFq4yUMonO+GxtTdAJ2ckIaAFNzi7AWw66TQA=; b=RE94FBYRJ4/Uz0er8Fk8oMGbSb6WRYdw2h3h52fsFq1QsG3rO+eD9By25Tj8b+13kT meLwMR6otE5HPv12P7VWbtKEzf8xBnpHQnw7TRoBrBI45As69M1P0IyIw2HfchHIVwR3 YYWlEuK9sn8cbnoC8kI+wMILzrs+YkBi/qCbvMPFvgIm6gM2CyQpcnMDNJudWTLpPlP3 o2q7b0td7wNswl/iPGnD/S2sRP7zbf7bLRBv+ZKhw1OWjGsK9HwLW4m0BJ05uzBOpaa/ v/VuwiF8EyGZ8cUXPndeGVCeSB2N1RGo3ReNet2hAchxvoFRJ8y1nrEqTNVfW+J2bDbV itSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a62cf05000000b00625e7f9b859si194482pfg.339.2023.03.30.10.21.10; Thu, 30 Mar 2023 10:21:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229760AbjC3RL6 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 30 Mar 2023 13:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbjC3RLy (ORCPT ); Thu, 30 Mar 2023 13:11:54 -0400 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96581EC43; Thu, 30 Mar 2023 10:11:45 -0700 (PDT) Received: by mail-ed1-f54.google.com with SMTP id x3so79163266edb.10; Thu, 30 Mar 2023 10:11:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680196304; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OCMgmjS8UFODcJkt3kQqePHkaAGXDwpBFfXsthPJWVE=; b=6AqLo7oyinTlwYtuBjkTD2rmHnp/tTidJhQQBP+82ypMWw6nkItfazgxyFEYxxB8Zc P/EkyO/Gk0kGNFUY7dFlGuevUhGsyJF//AOUvAghdh4qbWpg+J2NQuvdUL67sUUWjeKj TRSXJHCBpdg6MOJV6HOsu9/XobeynCoAvCLw36VbpyhJJOUd2Fc9VudIo/zRK3riWaoG UnOdsjcD/OveAiIwpk+3buDoDSljp6+SMIekoWvsJlkiv7hNAKMvitVnwP0XE2T7OjeJ Aa0w5i21JPPchL1K6t9BTpWDtOyQP+jZuxf75KvSKT6MZUKCa7ewPdH9PAwoaKFy9qXO 0QBA== X-Gm-Message-State: AAQBX9fqZ/blFWaFNYxEAtpPhFDG3/RLDxqDRF4JnapcUITyrZ0rTQAf G0qwwE60e+0ELgHhajhzxkx4g2OdjhmbtMmMH30= X-Received: by 2002:a50:9fe3:0:b0:502:62ba:865b with SMTP id c90-20020a509fe3000000b0050262ba865bmr3180693edf.3.1680196303944; Thu, 30 Mar 2023 10:11:43 -0700 (PDT) MIME-Version: 1.0 References: <20230328031629.202268-1-yijiangshan@kylinos.cn> In-Reply-To: <20230328031629.202268-1-yijiangshan@kylinos.cn> From: "Rafael J. Wysocki" Date: Thu, 30 Mar 2023 19:11:32 +0200 Message-ID: Subject: Re: [PATCH] ACPI: thermal: replace ternary operator with min_t() To: Jiangshan Yi Cc: rafael@kernel.org, rui.zhang@intel.com, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, 13667453960@163.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 28, 2023 at 5:17 AM Jiangshan Yi wrote: > > Fix the following coccicheck warning: This is not a fix, because the current code is correct AFAICS. It merely makes the code follow the coccicheck recommendation, which is a cleanup (although arguably a good one). But because the new code is way more readable, I've applied this as 6.4 material (with edits in the changelog). Thanks! > 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 { > -- > 2.25.1 >