Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1173969rdb; Fri, 20 Oct 2023 10:19:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9WSix9rUSJqxzclkbw0I0VYIsQINjnY+1ID0pRbgjQ8TAUg42FoW93RAsA/2nuDySC1oa X-Received: by 2002:a05:6a00:21c7:b0:690:c75e:25c8 with SMTP id t7-20020a056a0021c700b00690c75e25c8mr2825259pfj.7.1697822374975; Fri, 20 Oct 2023 10:19:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697822374; cv=none; d=google.com; s=arc-20160816; b=xcdaV/EFD79y99suMRzwYltTx2LzO87QxNSJxtw8Jt8jpMm/YaVA1J4FF/vYcmv05/ ctVZ9IeIqUnP7JgGzsYCWwT1NhR0EAsi6gvI32ZdumyFAkFXJZAMcDungFGt4o/TSZxb MjpIWaRZJXMpjYst/zozzZWMUQQC0RbfbVfKJ0g6xL8wc3Jw2+O5KgYWKrIvEoI/5rBQ FBE7MSj/pWymQ3DeKdO6x7t+H2TitR1nj+KktsRFFvlPW98usrWcFUnAFa50O+QO+q5I WCpfUIyCFbZF6ZNptLQ/NM4BwsBkOb8ubR3SoxwohWKMCx3ukjl+mfLCBZf4qjS98iYJ uVYQ== 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=eQJ1SmRIVnSpt88HCzKN/jpA+/Q+s2yqKe7U8XT/CCo=; fh=RkIex7BMwGHPYYWl8O5R3ZXiNH/X7HGCywQ3lHHavU8=; b=Y3wiX+jsZXlBmJN8Z+Zo2Mhg3/tj60xfcUojDZmOZYLEzoTX0JEJphe5nI9fQ/2S7Q x1VrVZ5+frpohGW2Sek7BuqTvtWj4b6ios4GNIFaN9qDFNSR+fwLHHKj7bvFdzhTgC/z Y8IN3OxI3eTzS+/nAFjgwAATrxB1afYM9T9PzQMNXTut3kMV1Po2CGkYxoClBRK2mnuy vS2Vby/kfnojh7nTR2vkI2yo9Fi+73fVs0ylDG1kYk8v3CyX+kMcf/qPtouCzZv2K1Mg I5Fcfn8jZc0lKsrz4D7XHdZyfNQVIjZcl6lN/Z/bOAW9z5nEUTIgJ2rhJt4vYfeG0kjn Wmow== 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:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id 200-20020a6301d1000000b00565e39e7b80si2230139pgb.678.2023.10.20.10.19.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 10:19:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id A7D7F805E007; Fri, 20 Oct 2023 10:19:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377912AbjJTRTW convert rfc822-to-8bit (ORCPT + 99 others); Fri, 20 Oct 2023 13:19:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377886AbjJTRTV (ORCPT ); Fri, 20 Oct 2023 13:19:21 -0400 Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03901D6F; Fri, 20 Oct 2023 10:19:19 -0700 (PDT) Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-57b83ff7654so60093eaf.1; Fri, 20 Oct 2023 10:19:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697822359; x=1698427159; 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=FZdk3IcTInpdu6dxFpN0K1xv4jMgNLN6oNZ7x7JyzCo=; b=AhX5+W6N1NCFDJcb5tXA04V0IWNWY7UsKddrgv3ryhdi8SXVBGTZYHtn/kPG1+g19J tjScrV3xPZvcvWwNJqVsrAlIIvwQstCK25IsJ8yIl5m6QyVa1wFmBAH4WmQDsOD8tHTA YpfHplqIhICBa8Cex71hbzse9k1MqaHVa2/gbmylM68qUt+G4c7fcWAS3m9RUtedQ8p3 xTE8W1A2VvNj0r8Ltf6BxvmRjogIGT7HEzqJ1nAP9tCCRhxBup2WZgcpByXrjx2izs51 0+07MRl9gP9H67SmyvFW8DvTS7FxV8TB5kH0yRyyIvyv5ebQ8rGz1AtgoFYzrEQnd27Z c+Fg== X-Gm-Message-State: AOJu0YxdR+gWBAAiqfPME/0sLBfgnx4QdSU4+243beybFSLM4AUZQGuz dmQWrU1EeoVaprBMQNOBahNiW7WBoiQsmo9CJ68= X-Received: by 2002:a4a:e9ed:0:b0:584:537:ffbd with SMTP id w13-20020a4ae9ed000000b005840537ffbdmr2759105ooc.0.1697822359012; Fri, 20 Oct 2023 10:19:19 -0700 (PDT) MIME-Version: 1.0 References: <13365827.uLZWGnKmhe@kreacher> <8282829.T7Z3S40VBb@kreacher> <63b7f4da-8ddb-443c-8074-66b7b0c6cd84@arm.com> In-Reply-To: <63b7f4da-8ddb-443c-8074-66b7b0c6cd84@arm.com> From: "Rafael J. Wysocki" Date: Fri, 20 Oct 2023 19:19:08 +0200 Message-ID: Subject: Re: [PATCH v1 2/6] thermal: trip: Define for_each_trip() macro To: Lukasz Luba Cc: "Rafael J. Wysocki" , LKML , Daniel Lezcano , Srinivas Pandruvada , Zhang Rui , Linux PM 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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 20 Oct 2023 10:19:32 -0700 (PDT) On Fri, Oct 20, 2023 at 7:14 PM Lukasz Luba wrote: > > > > 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 Thanks!