Message ID | 8282829.T7Z3S40VBb@kreacher |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp499122vqo; Fri, 6 Oct 2023 10:52:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUCEPph9rhH2W8W6bNSdnFVovdkTzSXsYhw8Tpb9K7o2iYf2Yg/1z01cs2/dNH10C0m62a X-Received: by 2002:a17:90a:8597:b0:274:1bc9:b72 with SMTP id m23-20020a17090a859700b002741bc90b72mr8425994pjn.24.1696614732858; Fri, 06 Oct 2023 10:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696614732; cv=none; d=google.com; s=arc-20160816; b=CzXAhG3vU2t5GESNi9aLfZcOZgBnItsPv3VjgYu2QcennTQEdWRMmbSboYlmzG3NU9 KX3ow9fECuZmcz3uXeCOlNEx/hk0P+ah0m86PSTS9036YLfSMlw7SiG0IexFWFAkuS+C 0xKl6vq3dvewS+Mi1s/KyXUfkp4RFTT63nJ2L7mAQWVqeyOhznnOKkp80BmMRIapcbxK LoRivOg1q9oLbIApr4iDZD1mQ/7X6z1flJuVMl4GP7YSaNZsxSVZ/1FuF8IT8OX982Fx i76+DUyOZsZX/G52VE9QYv7qOA+ZA40a5ND5PwXzVMDcm97U+aPoCGn5QEHf63DZp7Ao OLnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QK3xt8nYMnK+BkjjRqcxuMqYMHbGq1kiZ1ojWdYZmek=; fh=7MtGe3Dn5wgXLQQm5DZb5OyhwmEFEEdRNCLYMJcP5yE=; b=e4S/U9iv4LIqQ2zF3FyDj/mwbCFiQyUaijVJicJvK6zU1Zur1YuG8xKjkUl94noRrd tBkboWBJeD47u5YcV3VZG99vmhYchfzjwSUWNIkOoVmk7URzs+0Sv8xaRUz2Fzof/OGC UySxQ6iq1GFYmlM8AHh4B5ytIjlKD3QVVxaTZWX7xqxjt32NVYbb3M2Zqe3ybDTC96A2 HGe5wgWf/EE5cp2D5abG0/gicCoi+ZhxPf9uC6LuR8j11apazF+Ky01i/qrbbia3tQWG EdEqcOOY8GZ01ruya34fWjY+7cCLrVumW1ErV1C4nBbKq7B5oQhmnEqDNijb5an6nGTG S9HA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k6-20020a17090ac50600b002774e11ca41si6260734pjt.67.2023.10.06.10.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 10:52:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id EF35E8172973; Fri, 6 Oct 2023 10:52:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233113AbjJFRvl (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Fri, 6 Oct 2023 13:51:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233066AbjJFRvc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Oct 2023 13:51:32 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD61BE; Fri, 6 Oct 2023 10:51:31 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.2.0) id 1e41d53679a1e7ca; Fri, 6 Oct 2023 19:51:29 +0200 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 69307665D08; Fri, 6 Oct 2023 19:51:29 +0200 (CEST) From: "Rafael J. Wysocki" <rjw@rjwysocki.net> To: Linux PM <linux-pm@vger.kernel.org> Cc: LKML <linux-kernel@vger.kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Zhang Rui <rui.zhang@intel.com>, Lukasz Luba <lukasz.luba@arm.com> Subject: [PATCH v1 2/6] thermal: trip: Define for_each_trip() macro Date: Fri, 06 Oct 2023 19:41:56 +0200 Message-ID: <8282829.T7Z3S40VBb@kreacher> In-Reply-To: <13365827.uLZWGnKmhe@kreacher> References: <13365827.uLZWGnKmhe@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrgeeigdduudehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgv lhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,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 lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 06 Oct 2023 10:52:11 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779029490301344917 X-GMAIL-MSGID: 1779029490301344917 |
Series |
thermal: core: Pass trip pointers to governor .throttle() callbacks
|
|
Commit Message
Rafael J. Wysocki
Oct. 6, 2023, 5:41 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> 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 <rafael.j.wysocki@intel.com> --- drivers/thermal/thermal_core.h | 3 +++ drivers/thermal/thermal_trip.c | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-)
Comments
On 06/10/2023 19:41, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > 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 <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
On 10/6/23 18:41, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > 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 <rafael.j.wysocki@intel.com> > --- > 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 <lukasz.luba@arm.com>
On Fri, Oct 20, 2023 at 7:14 PM Lukasz Luba <lukasz.luba@arm.com> wrote: > > > > On 10/6/23 18:41, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > 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 <rafael.j.wysocki@intel.com> > > --- > > 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 <lukasz.luba@arm.com> Thanks!
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; }