Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2062147rdh; Tue, 26 Sep 2023 11:06:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSt2ztib1qxckiXzh3VUIGhRN28xJLgdGP07f0nzWAfpDqJW/sTdt85Q778eweUltfSWra X-Received: by 2002:a05:6808:485:b0:3ab:8431:8037 with SMTP id z5-20020a056808048500b003ab84318037mr12444804oid.32.1695751591225; Tue, 26 Sep 2023 11:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695751591; cv=none; d=google.com; s=arc-20160816; b=i6rqVl4t0IB9OseTWdrvrpQt0D2dauG1/dFFfYIH4/nZCIOefvan9xNdrGkXWsEMxP v/58SNpH1muYxqOxdHBz3OwwwN6+H7pWtP5jfX06eKLWyUR8luU1Lal+Um7CLPnva2Cq MCAfewk4/vIW9vn36eK+lPRSUGKDk5RzUkuSdIvHS0sYNUUf7YRZw/8vP+DDEBlO43WN Mdru/lUhYm1NOui2JFixkgrVogonTNTch2nuIu932Ge2KqF2+QfXPr9XpN2JQ8SgMYoT ab27n6p0Utse/j9g5I6Uv3rGGc5ESLepmGxpOSulHm14/vr5m+wojgj5cwMpclZkrnox esTg== 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=MxNaR1L/IoAr15yc7Sdm9g7DSAYd3BIqYfIKv8PKaGw=; fh=RthEAx/kgJ1XvAH6ep1xIyH52i5Ju5Jj53Ncyg0DoBs=; b=dDCUWBUX0jCOsQaeel4SGctvaxA5CoO6XXoeXB6TTjF+zP/OKrVJqDj8u9s7SjBznK E9dMiKVRxv50BKcc5iurxdAS3sc7zAYTxSOl7Yj9W1QVo2cx1AD5e5sy4OcuyAl0PkCY oh3pAgfDPsHAYmfk3ZjBTnwnyzWLKEod2XbqvYc2vHvXBhLl69Z+8LF4gP3Re0EvVJhy Vf5mSoKee5sukON2ujz9jL2hm5mjvHC3wuUYoRJMi3gueuRh5Y5Ftg/RVlR3aTCANBXr Zbk83+OcC9/002TNHMvpzANaJf3FrEMMf+YKuwwbKeCZ3CE54ni5iCIDcnbgALMCcewu dMRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id cg10-20020a056a00290a00b00690f8063627si13050699pfb.38.2023.09.26.11.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 11:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3BBDB81D82FE; Tue, 26 Sep 2023 11:05:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235570AbjIZSEx convert rfc822-to-8bit (ORCPT + 99 others); Tue, 26 Sep 2023 14:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235564AbjIZSEw (ORCPT ); Tue, 26 Sep 2023 14:04:52 -0400 Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1931D139; Tue, 26 Sep 2023 11:04:46 -0700 (PDT) Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-57ddba5ba84so99300eaf.0; Tue, 26 Sep 2023 11:04:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695751485; x=1696356285; 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=U27hlPgGqPLU6XmNuvI90P/WMHTPv95Abz8ctFWAnKs=; b=csnuOAfXNSyoq7NtB5k51nuu/qtqedl7TTvdnDvQiIcfAboC19lQXriUj8/cYsHdWE 9PM9rnxukEdK+GfGc9cQ7dC49DnEqarN5j3zmfWQtuX9jYpVDfTTWPpz6+IhouP3PbbU jjjwlem7ggxUJVPNo1pXnjbOJE37b7UohiNgGTgZCGMlpa0CqQbLPSG6wifRzb0tGQfw tGR+UFFjaOM29WdzA/bSZbOI+TL7m4UgLuOnH3Tcwo45YxV4+j5W3Cqm4gUdq2FWWTll CsxEtkpQqO8oLpE2ff/9ClAApNCbm4frOPJ8AjwgruK7KDSG4vVPH+nn3CCHzTeAOo9s 8/0Q== X-Gm-Message-State: AOJu0YyPYdAuj+lR0qEfZoOG98COfvHh6XU2U8v4j2b47yGHBOuqi3hw eH8k5ZJYInCVl2rnaugWn9zRVIXnM7+q7Yb/BNY= X-Received: by 2002:a4a:e2d8:0:b0:578:c2af:45b5 with SMTP id l24-20020a4ae2d8000000b00578c2af45b5mr9430902oot.0.1695751485276; Tue, 26 Sep 2023 11:04:45 -0700 (PDT) MIME-Version: 1.0 References: <1957441.PYKUYFuaPT@kreacher> <3534976.iIbC2pHGDl@kreacher> <38ea14aa-ecc2-c40e-34ea-05b348158cfb@linaro.org> In-Reply-To: From: "Rafael J. Wysocki" Date: Tue, 26 Sep 2023 20:04:34 +0200 Message-ID: Subject: Re: [PATCH v1 02/13] ACPI: thermal: Collapse trip devices update functions To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Linux PM , LKML , Linux ACPI , Srinivas Pandruvada , Zhang Rui , Lukasz Luba Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 11:05:34 -0700 (PDT) On Tue, Sep 26, 2023 at 7:56 PM Rafael J. Wysocki wrote: > > On Tue, Sep 26, 2023 at 7:18 PM Daniel Lezcano > wrote: > > > > On 21/09/2023 19:49, Rafael J. Wysocki wrote: > > > From: Rafael J. Wysocki > > > > > > In order to reduce code duplication, merge update_passive_devices() and > > > update_active_devices() into one function called update_trip_devices() > > > that will be used for updating both the passive and active trip points. > > > > > > No intentional functional impact. > > > > > > Signed-off-by: Rafael J. Wysocki > > > --- > > > drivers/acpi/thermal.c | 53 ++++++++++++++++++------------------------------- > > > 1 file changed, 20 insertions(+), 33 deletions(-) > > > > > > Index: linux-pm/drivers/acpi/thermal.c > > > =================================================================== > > > --- linux-pm.orig/drivers/acpi/thermal.c > > > +++ linux-pm/drivers/acpi/thermal.c > > > @@ -43,6 +43,8 @@ > > > #define ACPI_THERMAL_MAX_ACTIVE 10 > > > #define ACPI_THERMAL_MAX_LIMIT_STR_LEN 65 > > > > > > +#define ACPI_THERMAL_TRIP_PASSIVE (-1) > > > + > > > /* > > > * This exception is thrown out in two cases: > > > * 1.An invalid trip point becomes invalid or a valid trip point becomes invalid > > > @@ -202,18 +204,25 @@ static void acpi_thermal_update_passive_ > > > ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state"); > > > } > > > > > > -static bool update_passive_devices(struct acpi_thermal *tz, bool compare) > > > +static bool update_trip_devices(struct acpi_thermal *tz, > > > + struct acpi_thermal_trip *acpi_trip, > > > + int index, bool compare) > > > { > > > - struct acpi_thermal_trip *acpi_trip = &tz->trips.passive.trip; > > > struct acpi_handle_list devices; > > > + char method[] = "_PSL"; > > > acpi_status status; > > > > > > + if (index != ACPI_THERMAL_TRIP_PASSIVE) { > > > + method[1] = 'A'; > > > + method[2] = 'L'; > > > + method[3] = '0' + index; > > > + } > > > > Could be index > 9 ? > > I can add a check, but it will never be called with index > 9 anyway. To be more precise, update_trip_devices() is called in two places, acpi_thermal_init_trip() and acpi_thermal_update_trip_devices(). Both of these are called either with ACPI_THERMAL_TRIP_PASSIVE passed as index, or from a loop over indices between 0 and ACPI_THERMAL_MAX_ACTIVE-1 inclusive.