Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1170669rdb; Fri, 20 Oct 2023 10:14:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE4FCXv/NPePH1FrHbBBz9Rl77m77g5MUcQlfy5qvKwpfn8ylaKf3k7+fjnPTICmqRsT+Vi X-Received: by 2002:a17:903:238c:b0:1ca:7879:b59e with SMTP id v12-20020a170903238c00b001ca7879b59emr2260910plh.32.1697822063771; Fri, 20 Oct 2023 10:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697822063; cv=none; d=google.com; s=arc-20160816; b=WGz+bvRNShoeuyW9OQh6BJ57zRmuEQ0e3Hnduug+UMRM8mGcQXNW6dDjFPZ679s6Yx QfKIqzAlukxvCKY3iq4fWid6kChQSzMYHIbhQOCCc92BU/DfJ9u+6dXRRmE2Xpsx7f7M nP/jHuvzmKHTlRPlzzL5objEzxcJ6NfbcgZyW3RGR6dhOVI/N+HU4ws5D3yhZSVX4qPb s0kDdXAuqGjJv4BwcTmxqZi+zBdq9aB50Jzod/fY0MjKlquYuCgSjDeVA8N//rvK4BUr S3lLKWfqJ8cEpNcx1fMFGP4Fjw+XnpSLbqfTSEyhLg0BYc1rgq+ajBCYe0dUy0xJzSeJ YTKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=qf7OU7FDqeVkAa9QnB6W96Lnx2Pp33UuqhP+xSKboy8=; fh=Ti+l9dN1V1s4/No4+jOTAJr69T5zUPbby9cCUyZHH/o=; b=ZEcLhi/L8IA1ff2om7/kzZpJlotjGoJU0SP1Hmna3Zr6X+3Ih0apLVeK4PmiCoTnAk /Tj3eCnngCUqqXWhoYfEu6epuRaelWUG66mUl0RbyKavp1xGmn0zlQ83CdnB/nNiBVKw IWif2gzHRPKjYnvg1oOxkzkL4eWBYZa1L4c9ld4LXXJhJ2chZoK7YkAQngaJkDZ2XZ4E Xm2AwDK9KBGR9eQ24u9p/jkU5Ye2u3HSOOG6oQixGsj7Hn6+hJXDK4xewEulUkhckAAT GpjURr69DJR7UDogb24Flm0jWb3uJnYKIN2L9vgPPfMiSQ34UNptLQLTr7LJ20wLtMCM Iq/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p3-20020a170902a40300b001bdf6eb05f2si2088119plq.227.2023.10.20.10.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 10:14:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 98DB7830C30A; Fri, 20 Oct 2023 10:14:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377905AbjJTROS (ORCPT + 99 others); Fri, 20 Oct 2023 13:14:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377855AbjJTROR (ORCPT ); Fri, 20 Oct 2023 13:14:17 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F14F4D6D; Fri, 20 Oct 2023 10:14:14 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7DCEF143D; Fri, 20 Oct 2023 10:14:55 -0700 (PDT) Received: from [10.57.82.142] (unknown [10.57.82.142]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7A27C3F5A1; Fri, 20 Oct 2023 10:14:13 -0700 (PDT) Message-ID: <63b7f4da-8ddb-443c-8074-66b7b0c6cd84@arm.com> Date: Fri, 20 Oct 2023 18:15:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 2/6] thermal: trip: Define for_each_trip() macro Content-Language: en-US To: "Rafael J. Wysocki" Cc: LKML , Daniel Lezcano , Srinivas Pandruvada , Zhang Rui , Linux PM References: <13365827.uLZWGnKmhe@kreacher> <8282829.T7Z3S40VBb@kreacher> From: Lukasz Luba In-Reply-To: <8282829.T7Z3S40VBb@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 20 Oct 2023 10:14:22 -0700 (PDT) On 10/6/23 18:41, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Define a new macro for_each_trip() to be used by the thermal core code > and thermal governors for walking trips in a given thermal zone. > > Modify for_each_thermal_trip() to use this macro instead of an open- > coded loop over trips. > > No intentional functional impact. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/thermal/thermal_core.h | 3 +++ > drivers/thermal/thermal_trip.c | 7 ++++--- > 2 files changed, 7 insertions(+), 3 deletions(-) > > Index: linux-pm/drivers/thermal/thermal_core.h > =================================================================== > --- linux-pm.orig/drivers/thermal/thermal_core.h > +++ linux-pm/drivers/thermal/thermal_core.h > @@ -116,6 +116,9 @@ void __thermal_zone_device_update(struct > enum thermal_notify_event event); > > /* Helpers */ > +#define for_each_trip(__tz, __trip) \ > + for (__trip = __tz->trips; __trip - __tz->trips < __tz->num_trips; __trip++) > + > void __thermal_zone_set_trips(struct thermal_zone_device *tz); > int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id, > struct thermal_trip *trip); > Index: linux-pm/drivers/thermal/thermal_trip.c > =================================================================== > --- linux-pm.orig/drivers/thermal/thermal_trip.c > +++ linux-pm/drivers/thermal/thermal_trip.c > @@ -13,12 +13,13 @@ int for_each_thermal_trip(struct thermal > int (*cb)(struct thermal_trip *, void *), > void *data) > { > - int i, ret; > + struct thermal_trip *trip; > + int ret; > > lockdep_assert_held(&tz->lock); > > - for (i = 0; i < tz->num_trips; i++) { > - ret = cb(&tz->trips[i], data); > + for_each_trip(tz, trip) { > + ret = cb(trip, data); > if (ret) > return ret; > } > > > LGTM Reviewed-by: Lukasz Luba