From patchwork Thu Sep 21 18:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 142923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5146574vqi; Thu, 21 Sep 2023 14:22:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE4kR+GoKdDwX1cxV6zoHMdA5mqPcandkMZK8I2/P/Sjf6ZXWkOSDTLgCKTGTWxAy5c/ilY X-Received: by 2002:a05:6870:a691:b0:1bf:df47:7b5e with SMTP id i17-20020a056870a69100b001bfdf477b5emr7829926oam.16.1695331327685; Thu, 21 Sep 2023 14:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695331327; cv=none; d=google.com; s=arc-20160816; b=Ml9+NvmjMz5yztIkxfdzc0dufxkjhV6o6gP+YH+DOkMEKOw/wJ2+mEnZ5BVoZT+td1 bdD0ZBKrNyvkzPd4daVJasSyNE3ZiQrvugBk34YyeKqj92pCWwJXSWzjssA2WXMX+RBi S9GuO162oj0SRZolRjC8IZs+T4TQ5YS0gY24KyialnvdI6LVXoK7xNKoT7IFQ17QXSLO ebt2CR9b300cNGqEuMo2KW9y4547h87AXJ0k0LiHFgvcJVVYoeWYIBAgkWPYxut+NsS/ OzjgzufF2NB4Wjw3cFp+3fjpMQwZV/5CjObe0ctmc2is/W+ex5FqKIODhj9rlhZ1lgjg zdeg== 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=uAnJ7xLeSPzNFUY9aHPIIV1U4zr8LnczFH9Zz9YXAHU=; fh=M3Xj0cy8L+JeZSSd0Q6EHM9/xVzlLsbYrLkDMv02gfM=; b=anuh4LcXZ6MLWRka4YwztxYR/VyJfc0I5ekWrpvepPJouNWntqzAstI22BHsmSW7iX Vp2HCJkuqsxnikxZtub68gXCJDZRM6hkzXRB1MaCf4ZWGerbwmb05IuAectKaBRsBmLQ gH5HV92LwxHQjd1Rh7xgPs8z3iqyWPCyM0VvoUgcXjeziK2zIlblQXC75txKB6ecARXn MbpCdxQektSkiXWl5C/mBzWJ0tnvOpIZ/z4ryGD3OjQUvR9nZ4Y+1IquVO5mZ6Xu2EId BSn1/6MMt+zETfVidyvVM2GtWaS6Xu4vuhTKm0gcEpZKt9Lzy4cVogr1raMm5o8SBR7K +JaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id a35-20020a631a63000000b00578ea9a0b93si2176913pgm.890.2023.09.21.14.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 14:22:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 C77918158E8B; Thu, 21 Sep 2023 14:06:39 -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 S232641AbjIUVGb (ORCPT + 29 others); Thu, 21 Sep 2023 17:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233042AbjIUVFU (ORCPT ); Thu, 21 Sep 2023 17:05:20 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA2A1AF69F; Thu, 21 Sep 2023 11:07:23 -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 36cbd7be29a8bf2c; Thu, 21 Sep 2023 20:07:22 +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 D268B664EBE; Thu, 21 Sep 2023 20:07:21 +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 12/13] ACPI: thermal: Drop critical_valid and hot_valid trip flags Date: Thu, 21 Sep 2023 20:04:49 +0200 Message-ID: <2375603.NG923GbCHz@kreacher> In-Reply-To: <1957441.PYKUYFuaPT@kreacher> References: <1957441.PYKUYFuaPT@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedviedrudekiedguddvtdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeekpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhn 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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:06:39 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777683742324686366 X-GMAIL-MSGID: 1777683742324686366 From: Rafael J. Wysocki The critical_valid and hot_valid flags in struct acpi_thermal_trips are only used during initialization and they are only false if the corresponding trip temperatures are equal to THERMAL_TEMP_INVALID, so drop them and use THERMAL_TEMP_INVALID checks instead of them where applicable. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Daniel Lezcano --- drivers/acpi/thermal.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) Index: linux-pm/drivers/acpi/thermal.c =================================================================== --- linux-pm.orig/drivers/acpi/thermal.c +++ linux-pm/drivers/acpi/thermal.c @@ -100,8 +100,6 @@ struct acpi_thermal_active { struct acpi_thermal_trips { struct acpi_thermal_passive passive; struct acpi_thermal_active active[ACPI_THERMAL_MAX_ACTIVE]; - bool critical_valid; - bool hot_valid; }; struct acpi_thermal { @@ -355,13 +353,13 @@ static long acpi_thermal_get_critical_tr } if (crt == -1) { acpi_handle_debug(tz->device->handle, "Critical threshold disabled\n"); - goto fail; + return THERMAL_TEMP_INVALID; } status = acpi_evaluate_integer(tz->device->handle, "_CRT", NULL, &tmp); if (ACPI_FAILURE(status)) { acpi_handle_debug(tz->device->handle, "No critical threshold\n"); - goto fail; + return THERMAL_TEMP_INVALID; } if (tmp <= 2732) { /* @@ -369,17 +367,12 @@ static long acpi_thermal_get_critical_tr * so discard them as invalid. */ pr_info(FW_BUG "Invalid critical threshold (%llu)\n", tmp); - goto fail; + return THERMAL_TEMP_INVALID; } set: - tz->trips.critical_valid = true; acpi_handle_debug(tz->device->handle, "Critical threshold [%llu]\n", tmp); return tmp; - -fail: - tz->trips.critical_valid = false; - return THERMAL_TEMP_INVALID; } static long acpi_thermal_get_hot_trip(struct acpi_thermal *tz) @@ -389,12 +382,10 @@ static long acpi_thermal_get_hot_trip(st status = acpi_evaluate_integer(tz->device->handle, "_HOT", NULL, &tmp); if (ACPI_FAILURE(status)) { - tz->trips.hot_valid = false; acpi_handle_debug(tz->device->handle, "No hot threshold\n"); return THERMAL_TEMP_INVALID; } - tz->trips.hot_valid = true; acpi_handle_debug(tz->device->handle, "Hot threshold [%llu]\n", tmp); return tmp; } @@ -789,7 +780,7 @@ static void acpi_thermal_aml_dependency_ */ static void acpi_thermal_guess_offset(struct acpi_thermal *tz, long crit_temp) { - if (tz->trips.critical_valid && crit_temp % 5 == 1) + if (crit_temp != THERMAL_TEMP_INVALID && crit_temp % 5 == 1) tz->kelvin_offset = 273100; else tz->kelvin_offset = 273200; @@ -850,11 +841,11 @@ static int acpi_thermal_add(struct acpi_ trip_count = acpi_thermal_get_trip_points(tz); crit_temp = acpi_thermal_get_critical_trip(tz); - if (tz->trips.critical_valid) + if (crit_temp != THERMAL_TEMP_INVALID) trip_count++; hot_temp = acpi_thermal_get_hot_trip(tz); - if (tz->trips.hot_valid) + if (hot_temp != THERMAL_TEMP_INVALID) trip_count++; if (!trip_count) { @@ -886,13 +877,13 @@ static int acpi_thermal_add(struct acpi_ tz->trip_table = trip; - if (tz->trips.critical_valid) { + if (crit_temp != THERMAL_TEMP_INVALID) { trip->type = THERMAL_TRIP_CRITICAL; trip->temperature = acpi_thermal_temp(tz, crit_temp); trip++; } - if (tz->trips.hot_valid) { + if (hot_temp != THERMAL_TEMP_INVALID) { trip->type = THERMAL_TRIP_HOT; trip->temperature = acpi_thermal_temp(tz, hot_temp); trip++;