Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2945484rdb; Mon, 4 Dec 2023 11:49:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEani9ORtL4rQZ46jyTrP3/NKqyxJW2dpQWJP9vuPw79g6RWUJoucO1dM6SNYFiEqLgNpKc X-Received: by 2002:a05:6a20:9382:b0:18a:fa92:7929 with SMTP id x2-20020a056a20938200b0018afa927929mr29358662pzh.22.1701719388433; Mon, 04 Dec 2023 11:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701719388; cv=none; d=google.com; s=arc-20160816; b=Y/nw/c7Slx7zQxEMdpuKLS8vXMNKZ2VEtl8R3YY7pM7DaJrHqixiRFRE+ZLZ8F8cov Uxcfk3uf7ojSqjx/VxcX3zlL2FEjkGjs/Jcb5OuRE+J210Q6vvYUPeJ6kLGAyFSsRKSl b0SbqNS8eztYf7e4efEod42P4JaV/ixQDikWHO73F1UDxLsuVoJuR/+sLgMjn5OzRtYz lZ7/4NKjrXLXWPdHJOjfoKxx+fc6wUHVDGYvClbXzASXukeqkyckCTWsFFQXnzT0HKZo rGFci4TED/MMhiZyGxU/16dkIB1O2wWvxMXm8tcTDYO2gJ9LpKvkbITYxRn3S8C7Nrqs LKLw== 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=2s0eARe/EC8VofRKHp0qU/S9EhEo+aL0marcw9uhjOQ=; fh=nLypB3rvk504GacFIka1NRIrs+dxk/mQtlixTJ9Bzjw=; b=jMwJ0wFblAZfCjGkpnlLBwGdO21aazZNA604JTepVNHoWVdN4Av+IBOHzxPAibALwx OneBiEbDYunqWNxrf7aIy39B9PL5sHFMiacnZEZdJRyeJj8Ne3keTZwuckg+TgPXruDG aSkPSMBTct0a4LF2g1KsA3FeYbJJkHCl2G7gPp9K0O9z8Yn4W6o0h+YcgggIaPRHexiR x/gLpS7tgCFHIUsljqJ3beZqSDTjhm5MXySIoKNENroGFQmbf9HHoAlxIGK76un/rxvh JvH69mL7pxRBO0YrT1QTL93dilOYh3LnREI7LOmNLdNrRBvfR2i5KZdCaAT1AWMMQCUW AXrQ== 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 Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id x21-20020a63f715000000b005b92b8e70f1si8146785pgh.27.2023.12.04.11.49.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 11:49:48 -0800 (PST) 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 53859805D58F; Mon, 4 Dec 2023 11:49:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233821AbjLDTtY (ORCPT + 99 others); Mon, 4 Dec 2023 14:49:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229983AbjLDTtW (ORCPT ); Mon, 4 Dec 2023 14:49:22 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 055C4CE; Mon, 4 Dec 2023 11:49:28 -0800 (PST) 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.4.0) id c20daf89d4323379; Mon, 4 Dec 2023 20:49:27 +0100 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 07FB1668764; Mon, 4 Dec 2023 20:49:27 +0100 (CET) From: "Rafael J. Wysocki" To: Daniel Lezcano , Lukasz Luba Cc: Linux PM , LKML , Srinivas Pandruvada , Zhang Rui Subject: [PATCH v1 2/3] thermal: helpers: Use for_each_trip() in __thermal_zone_get_temp() Date: Mon, 04 Dec 2023 20:46:35 +0100 Message-ID: <1871840.tdWV9SEqCh@kreacher> In-Reply-To: <5733564.DvuYhMxLoT@kreacher> References: <5733564.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: gggruggvucftvghtrhhoucdtuddrgedvkedrudejiedgudeftdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhr ihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhm 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,T_SCC_BODY_TEXT_LINE 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]); Mon, 04 Dec 2023 11:49:45 -0800 (PST) From: Rafael J. Wysocki Make __thermal_zone_get_temp() use for_each_trip() instead of an open- coded loop over trip indices. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_helpers.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) Index: linux-pm/drivers/thermal/thermal_helpers.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_helpers.c +++ linux-pm/drivers/thermal/thermal_helpers.c @@ -82,20 +82,18 @@ EXPORT_SYMBOL(get_thermal_instance); */ int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) { - int ret = -EINVAL; - int count; + const struct thermal_trip *trip; int crit_temp = INT_MAX; - struct thermal_trip trip; + int ret = -EINVAL; lockdep_assert_held(&tz->lock); ret = tz->ops->get_temp(tz, temp); if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) { - for (count = 0; count < tz->num_trips; count++) { - ret = __thermal_zone_get_trip(tz, count, &trip); - if (!ret && trip.type == THERMAL_TRIP_CRITICAL) { - crit_temp = trip.temperature; + for_each_trip(tz, trip) { + if (trip->type == THERMAL_TRIP_CRITICAL) { + crit_temp = trip->temperature; break; } }