Message ID | 4882956.31r3eYUQgx@kreacher |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1427157vqb; Thu, 12 Oct 2023 11:36:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGg8l1zCibqT6IWys/8tw29wPeLuwvHSG3WnRjyJYYM7AdOW/GsbZE40++WFDw4RVbrjAB6 X-Received: by 2002:a05:6a21:3394:b0:163:ab09:193e with SMTP id yy20-20020a056a21339400b00163ab09193emr28396299pzb.1.1697135764260; Thu, 12 Oct 2023 11:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697135764; cv=none; d=google.com; s=arc-20160816; b=E0xx2dI1Fvqdezh2doUj1QeTimKEw7A9y7s13mO6JRJBItUHuzPxSyN+TT8eMKQmCH d50v/t3K3xxvsCW852RBMS9J/laOgYCaym0QyBUAjozD3NRaLxW39thZWEL886KYI25s nEkhW7+/2Km72KzZ8a/fdeeQ2wW7giw5HFZZf3DNqt8X0WyWFFlqa9uEsfCvIh6d4Kl7 GeO98nXLipRjqnEhE7xY3ClNxs4Ovdv8WU7GvR42bQDErSRDZnVpQoOFCgCHbikmrHjl I8kwYdH32oUSTet7zgwZFhqwcmz2T/Ri1WnTfXqsDcxB8xX8ru1tBRNsg6IMn55YpLL6 9Jww== 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=LVB37QCsHSviVmK30z5t/FBYAPtf9wyrN3yOgXviDBY=; fh=7MtGe3Dn5wgXLQQm5DZb5OyhwmEFEEdRNCLYMJcP5yE=; b=Lqxbb6kYiwfs8SfwcQt9JJeGqJUeJ9ZLpi3g/wUZrypNKgBgitCbNh7QlUpnD+wQys mPMTiFxbCHZx3IzZrM/0iQA4ScGfHnoSW83c7RCg1QaRUaJSFsa+K/SwGRcC+jNh/FrT wREIQaPZzxFwoTfEmSk4acmFgFdF8urzYt58BMbo/xwesF6BkQGC3Gdc2rlYOzP9GyIF BiDprzKat8tnUmqq1QkIy2hqUN0rhv67k/Db8JfDkbzMOwLPuY9dv42p0GpqBpX5zR4l EtXOZmnJAo4CEOKlWVVKueNPGi6xC+eXgUFWjEn/O/txyU64SVhaO95zBGIz1NiJedc5 yE7g== 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:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id e12-20020a17090a804c00b0027b0acd55d2si2782748pjw.101.2023.10.12.11.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 11:36:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 3892383E1AD1; Thu, 12 Oct 2023 11:36:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442066AbjJLSfS (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Thu, 12 Oct 2023 14:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441945AbjJLSfI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 12 Oct 2023 14:35:08 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6460BE; Thu, 12 Oct 2023 11:35:05 -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 16bddb04797c5061; Thu, 12 Oct 2023 20:35:04 +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 cloudserver094114.home.pl (Postfix) with ESMTPSA id 1DFAB666870; Thu, 12 Oct 2023 20:35:03 +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 v2 1/6] thermal: trip: Simplify computing trip indices Date: Thu, 12 Oct 2023 20:25:06 +0200 Message-ID: <4882956.31r3eYUQgx@kreacher> In-Reply-To: <5734364.DvuYhMxLoT@kreacher> References: <5734364.DvuYhMxLoT@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: gggruggvucftvghtrhhoucdtuddrgedvkedriedtgdduudeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgv lhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 11:36:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779575831243429792 X-GMAIL-MSGID: 1779575831243429792 |
Series |
thermal: core: Pass trip pointers to governor .throttle() callbacks
|
|
Commit Message
Rafael J. Wysocki
Oct. 12, 2023, 6:25 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> A trip index can be computed right away as a difference between the value of a trip pointer pointing to the given trip object and the start of the trips[] table in the given thermal zone, so change thermal_zone_trip_id() accordingly. No intentional functional impact (except for some speedup). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- v1 -> v2: Rebase on top of current linux-next --- drivers/thermal/thermal_trip.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
Comments
On 12/10/2023 20:25, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > A trip index can be computed right away as a difference between the > value of a trip pointer pointing to the given trip object and the > start of the trips[] table in the given thermal zone, so change > thermal_zone_trip_id() accordingly. > > No intentional functional impact (except for some speedup). > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > --- Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Index: linux-pm/drivers/thermal/thermal_trip.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_trip.c +++ linux-pm/drivers/thermal/thermal_trip.c @@ -173,12 +173,9 @@ int thermal_zone_set_trip(struct thermal int thermal_zone_trip_id(struct thermal_zone_device *tz, const struct thermal_trip *trip) { - int i; - - for (i = 0; i < tz->num_trips; i++) { - if (&tz->trips[i] == trip) - return i; - } - - return -ENODATA; + /* + * Assume the trip to be located within the bounds of the thermal + * zone's trips[] table. + */ + return trip - tz->trips; }