Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2321401rdb; Thu, 21 Sep 2023 15:25:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqRrd48I4JKZtrTZOZzPRM2acoLFmgu1+qzYSZe/WFbKhoggtGroDMNGWVcLfzbQ1a5haP X-Received: by 2002:a25:744a:0:b0:d19:ea71:a96b with SMTP id p71-20020a25744a000000b00d19ea71a96bmr7355912ybc.57.1695335137620; Thu, 21 Sep 2023 15:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695335137; cv=none; d=google.com; s=arc-20160816; b=QhBgWSzaCOqOjgGr1+fJrI14dmgnNX0nAJhTPPumNoPOW36veCnwVIdn0CpjHfzRp0 JALKIp5nP0oIKIDlwgdlwmUHCsEvzavhDknyhE3tX8r25c79hpEznhilEvK5z7qvKsCW RKkMHXjnVdg5xQhE8NuWZ8SmGzDoU8ztVs9GnHP14jAZaTcppCHBSFH8oehLydF1Uk/M NW0ZzTBsisvK08kkqOVnMSsl6+KTwJ6gXjGyaSwfwhngi8/x+D///EKNIipLWwo8BaJU 8WQsc5eEOegU8Ez+TqNo1AMDZcMCWpd5HQmUFaNVMwyED0LkNVxTyoXwu1S4tVLaU6dR f7Yg== 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=f7LmQP0UmruflYMCMM6WI92ijpnDS5T1M98XwguGSbs=; fh=M3Xj0cy8L+JeZSSd0Q6EHM9/xVzlLsbYrLkDMv02gfM=; b=GK94TzPl+LmqBTUBrTdMa9ppEcFE5oxqrvVEtRePQwfEnd2llol+pMRwk2vI7rQdD+ 7v6/oPZIBQTdVefquBbnGVRYXh058UsDtDTt451M4K290ufzlPeXkBG/Zxavhas4vlrn VsggukQue5QNwpp0n7uoD/xaIDdr6vRKMRn6zmMb0JuVLRso6uWRYbqQR6MPECAN7gaH xRoD0+FL7PD54r7Bv47GZ+PM8CHLS6V2YMIggovik0RFbcQHSeaJyO5Y/knyIuuyVj2q i3u2srEJegXLLikllUTUJLte1M2UTlHTi0F7rJMNyOTmd/kNR0J6JN29Wme8+vj97Wi1 xm4A== 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:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id q187-20020a632ac4000000b00577a083624csi2316192pgq.89.2023.09.21.15.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:25:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 4739483746B5; Thu, 21 Sep 2023 15:11:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231927AbjIUWLD (ORCPT + 99 others); Thu, 21 Sep 2023 18:11:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232852AbjIUWKu (ORCPT ); Thu, 21 Sep 2023 18:10:50 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C361AF6B6; Thu, 21 Sep 2023 11:07:27 -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 c196ef04c16d75e5; Thu, 21 Sep 2023 20:07:25 +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 66D16664EBE; Thu, 21 Sep 2023 20:07:25 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Linux ACPI , Srinivas Pandruvada , Zhang Rui , Daniel Lezcano , Lukasz Luba , "Rafael J. Wysocki" Subject: [PATCH v1 08/13] thermal: gov_step_wise: Fold update_passive_instance() into its caller Date: Thu, 21 Sep 2023 19:56:47 +0200 Message-ID: <2180114.Mh6RI2rZIc@kreacher> In-Reply-To: <1957441.PYKUYFuaPT@kreacher> References: <1957441.PYKUYFuaPT@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: gggruggvucftvghtrhhoucdtuddrgedviedrudekiedguddulecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeekpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhn thgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=8 Fuz1=8 Fuz2=8 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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 21 Sep 2023 15:11:05 -0700 (PDT) From: Rafael J. Wysocki Fold update_passive_instance() into thermal_zone_trip_update() that is its only caller so as to make the code in question easeir to follow. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/gov_step_wise.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) Index: linux-pm/drivers/thermal/gov_step_wise.c =================================================================== --- linux-pm.orig/drivers/thermal/gov_step_wise.c +++ linux-pm/drivers/thermal/gov_step_wise.c @@ -68,17 +68,6 @@ static unsigned long get_target_state(st return next_target; } -static void update_passive_instance(struct thermal_zone_device *tz, - enum thermal_trip_type type, int value) -{ - /* - * If value is +1, activate a passive instance. - * If value is -1, deactivate a passive instance. - */ - if (type == THERMAL_TRIP_PASSIVE) - tz->passive += value; -} - static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id) { const struct thermal_trip *trip = &tz->trips[trip_id]; @@ -109,14 +98,17 @@ static void thermal_zone_trip_update(str if (instance->initialized && old_target == instance->target) continue; - /* Activate a passive thermal instance */ if (old_target == THERMAL_NO_TARGET && - instance->target != THERMAL_NO_TARGET) - update_passive_instance(tz, trip->type, 1); - /* Deactivate a passive thermal instance */ - else if (old_target != THERMAL_NO_TARGET && - instance->target == THERMAL_NO_TARGET) - update_passive_instance(tz, trip->type, -1); + instance->target != THERMAL_NO_TARGET) { + /* Activate a passive thermal instance */ + if (trip->type == THERMAL_TRIP_PASSIVE) + tz->passive++; + } else if (old_target != THERMAL_NO_TARGET && + instance->target == THERMAL_NO_TARGET) { + /* Deactivate a passive thermal instance */ + if (trip->type == THERMAL_TRIP_PASSIVE) + tz->passive--; + } instance->initialized = true; mutex_lock(&instance->cdev->lock);