From patchwork Tue Jan 24 19:16:09 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: 47842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2332235wrn; Tue, 24 Jan 2023 11:23:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXvwfLQ/gWvMu5mc24+w5E0+YXRHtIybNpqJuXt/vAyLUU2jnBHN/roKhSH5VeWvMLZilp7v X-Received: by 2002:a05:6a21:398d:b0:b9:19b0:d58a with SMTP id ad13-20020a056a21398d00b000b919b0d58amr26070672pzc.31.1674588212276; Tue, 24 Jan 2023 11:23:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674588212; cv=none; d=google.com; s=arc-20160816; b=Uh/tbWtzfSeVxlerAvMjxUcE03vsKUEaoz1YW/trNBU2RkvgmscA7gdZadx69fjAz9 USNYf1hrAFT62521CL4q6PE1HRHSCllEVn9Rp5epmrD3wzGTEPgcxTYK0LwGVdJm4EEU q6gZYnqY722VzKJmjeWv3DcgalL9jfFB3hCZ6tagOCrvXbRjZPOT6NkPugBojsjt1h9F eUFayhRQHwnXdV8BJNrBZGU5K1CsZu6SeyU7kJUiRy0mMn/YrMobnRO98H29IwlEJq2u uJYPVdnUy4gMbiGH/Zfh0DI4OPCUDtYE0bYOoJcyLZqOS+5UEeuyABV6lpE51VPDZqfo bCnw== 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=Xrn0pvZ0tkGYjs0HMj1spsHcyTl03A9PCD3I3ZcH9xg=; b=jCmN0I9NKFac796joaMk+nnWG6Vs4LeQNsxgO+SmiIjav7vaLMvuEucDqKNa8DEKNS lcIt4f9iNTZvM0/xsb1CTpKUoquytr2wQytS/MGUk3ZKegzIz2Olvj1ytpmC75SEh9YB C3X9RzJ20KSjnj4my8YXicCEHzLXVta4+BYhlA30sGSzuQqHF4LsSkCK+Z9FMtO4aax7 XHkI+Sydf7keabBBXr8cIzqDGYR8rka17SgkNT8PHSkK1nnsVcmnbvbpAEDnHczYtbIn gh+X/nivoX1SasjarenGVA8T+gI81LGTAl9FQ8zKxVKeFaF04pKFvXslpfC/wbqA4mwW Zv7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h63-20020a638342000000b004d812fdce36si2939761pge.803.2023.01.24.11.23.20; Tue, 24 Jan 2023 11:23:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234466AbjAXTTU (ORCPT + 99 others); Tue, 24 Jan 2023 14:19:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234492AbjAXTTN (ORCPT ); Tue, 24 Jan 2023 14:19:13 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 200A74C0D4; Tue, 24 Jan 2023 11:19:11 -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.1.0) id b885dacc12dec74b; Tue, 24 Jan 2023 20:19:10 +0100 Received: from kreacher.localnet (unknown [213.134.189.30]) (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 BF0D27A644A; Tue, 24 Jan 2023 20:19:09 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Linux ACPI , Zhang Rui , Srinivas Pandruvada , Daniel Lezcano Subject: [PATCH v1 3/6] thermal: intel: int340x: Evaluate GTSH once Date: Tue, 24 Jan 2023 20:16:09 +0100 Message-ID: <2887081.e9J7NaK4W3@kreacher> In-Reply-To: <12159228.O9o76ZdvQC@kreacher> References: <12159228.O9o76ZdvQC@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.189.30 X-CLIENT-HOSTNAME: 213.134.189.30 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedruddvtddguddvudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudekledrfedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekledrfedtpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthho pehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755933009296264711?= X-GMAIL-MSGID: =?utf-8?q?1755933009296264711?= From: Rafael J. Wysocki It is not necessary to evaluate the GTSH ACPI object for every trip point in int340x_thermal_zone_add() and the function used for that is not really necessary either, because it only has one caller. Accordingly, fold the evaluation of GTSH directly into int340x_thermal_zone_add(), evaluate it only once and populate the hysteresis for all of the trip points with the value produced by it. No expected functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 24 +++-------- 1 file changed, 8 insertions(+), 16 deletions(-) Index: linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -53,21 +53,6 @@ static int int340x_thermal_set_trip_temp return 0; } -static int int340x_thermal_get_global_hyst(struct acpi_device *adev, int *temp) -{ - acpi_status status; - unsigned long long hyst; - - status = acpi_evaluate_integer(adev->handle, "GTSH", NULL, &hyst); - if (ACPI_FAILURE(status)) - *temp = 0; - else - *temp = hyst * 100; - - return 0; -} - - static void int340x_thermal_critical(struct thermal_zone_device *zone) { dev_dbg(&zone->device, "%s: critical temperature reached\n", zone->type); @@ -120,6 +105,7 @@ struct int34x_thermal_zone *int340x_ther { struct int34x_thermal_zone *int34x_zone; unsigned long long trip_cnt = 0; + unsigned long long hyst; int trip_mask = 0; acpi_status status; int i, ret; @@ -156,8 +142,14 @@ struct int34x_thermal_zone *int340x_ther trip_cnt = int340x_thermal_read_trips(int34x_zone); + status = acpi_evaluate_integer(adev->handle, "GTSH", NULL, &hyst); + if (ACPI_SUCCESS(status)) + hyst *= 100; + else + hyst = 0; + for (i = 0; i < trip_cnt; ++i) - int340x_thermal_get_global_hyst(adev, &int34x_zone->trips[i].hysteresis); + int34x_zone->trips[i].hysteresis = hyst; for (i = 0; i < int34x_zone->aux_trip_nr; i++) { int34x_zone->trips[i].type = THERMAL_TRIP_PASSIVE;