From nobody Fri Feb 13 19:27:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A67DEE7D0AA for ; Thu, 21 Sep 2023 20:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231908AbjIUUcX (ORCPT ); Thu, 21 Sep 2023 16:32:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231888AbjIUUcA (ORCPT ); Thu, 21 Sep 2023 16:32:00 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DCA1AF94C; Thu, 21 Sep 2023 11:07: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 c8dfa8de6a80f189; Thu, 21 Sep 2023 20:07: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 1A650664EBE; Thu, 21 Sep 2023 20:07:28 +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 04/13] ACPI: thermal: Merge trip initialization functions Date: Thu, 21 Sep 2023 19:51:19 +0200 Message-ID: <1785516.VLH7GnMWUR@kreacher> In-Reply-To: <1957441.PYKUYFuaPT@kreacher> References: <1957441.PYKUYFuaPT@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedviedrudekiedguddvtdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeekpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhn thgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=8 Fuz1=8 Fuz2=8 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki In order to reduce code duplicationeve further, merge acpi_thermal_init_passive/active_trip() into one function called acpi_thermal_init_trip() that will be used for initializing both the passive and active trip points. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Daniel Lezcano --- drivers/acpi/thermal.c | 64 ++++++++++++++++++++++----------------------= ----- 1 file changed, 30 insertions(+), 34 deletions(-) Index: linux-pm/drivers/acpi/thermal.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-pm.orig/drivers/acpi/thermal.c +++ linux-pm/drivers/acpi/thermal.c @@ -399,72 +399,68 @@ static long acpi_thermal_get_hot_trip(st return tmp; } =20 -static bool acpi_thermal_init_passive_trip(struct acpi_thermal *tz) +static bool passive_trip_params_init(struct acpi_thermal *tz) { unsigned long long tmp; acpi_status status; - int temp; - - if (psv =3D=3D -1) - goto fail; - - if (psv > 0) { - temp =3D celsius_to_deci_kelvin(psv); - } else { - temp =3D get_passive_temp(tz); - if (temp =3D=3D THERMAL_TEMP_INVALID) - goto fail; - } =20 status =3D acpi_evaluate_integer(tz->device->handle, "_TC1", NULL, &tmp); if (ACPI_FAILURE(status)) - goto fail; + return false; =20 tz->trips.passive.tc1 =3D tmp; =20 status =3D acpi_evaluate_integer(tz->device->handle, "_TC2", NULL, &tmp); if (ACPI_FAILURE(status)) - goto fail; + return false; =20 tz->trips.passive.tc2 =3D tmp; =20 status =3D acpi_evaluate_integer(tz->device->handle, "_TSP", NULL, &tmp); if (ACPI_FAILURE(status)) - goto fail; + return false; =20 tz->trips.passive.tsp =3D tmp; =20 - if (!update_trip_devices(tz, &tz->trips.passive.trip, - ACPI_THERMAL_TRIP_PASSIVE, false)) - goto fail; - - tz->trips.passive.trip.temperature =3D temp; return true; - -fail: - tz->trips.passive.trip.temperature =3D THERMAL_TEMP_INVALID; - return false; } =20 -static bool acpi_thermal_init_active_trip(struct acpi_thermal *tz, int ind= ex) +static bool acpi_thermal_init_trip(struct acpi_thermal *tz, int index) { + struct acpi_thermal_trip *acpi_trip; long temp; =20 - if (act =3D=3D -1) - goto fail; + if (index =3D=3D ACPI_THERMAL_TRIP_PASSIVE) { + acpi_trip =3D &tz->trips.passive.trip; + + if (psv =3D=3D -1) + goto fail; + + if (!passive_trip_params_init(tz)) + goto fail; + + temp =3D psv > 0 ? celsius_to_deci_kelvin(psv) : + get_passive_temp(tz); + } else { + acpi_trip =3D &tz->trips.active[index].trip; + + if (act =3D=3D -1) + goto fail; + + temp =3D get_active_temp(tz, index); + } =20 - temp =3D get_active_temp(tz, index); if (temp =3D=3D THERMAL_TEMP_INVALID) goto fail; =20 - if (!update_trip_devices(tz, &tz->trips.active[index].trip, index, false)) + if (!update_trip_devices(tz, acpi_trip, index, false)) goto fail; =20 - tz->trips.active[index].trip.temperature =3D temp; + acpi_trip->temperature =3D temp; return true; =20 fail: - tz->trips.active[index].trip.temperature =3D THERMAL_TEMP_INVALID; + acpi_trip->temperature =3D THERMAL_TEMP_INVALID; return false; } =20 @@ -473,11 +469,11 @@ static int acpi_thermal_get_trip_points( unsigned int count =3D 0; int i; =20 - if (acpi_thermal_init_passive_trip(tz)) + if (acpi_thermal_init_trip(tz, ACPI_THERMAL_TRIP_PASSIVE)) count++; =20 for (i =3D 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { - if (acpi_thermal_init_active_trip(tz, i)) + if (acpi_thermal_init_trip(tz, i)) count++; else break;