From patchwork Tue Sep 12 18:36:21 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: 138526 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp789034vqx; Tue, 12 Sep 2023 18:30:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLi5EMhzCwawC2APCGDZ02zggqBdgyTIDL5qmaQu4dtsMKzEKKeTNUOSJ4NIsqslgSChbo X-Received: by 2002:a17:903:32d0:b0:1c3:6667:5ff1 with SMTP id i16-20020a17090332d000b001c366675ff1mr1502830plr.27.1694568602035; Tue, 12 Sep 2023 18:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694568602; cv=none; d=google.com; s=arc-20160816; b=qtmDq4DEPKLUR0gUWuAjujShfONTBN24pR3Dzt45ZF+eMGBdmv3Y6Tz1bVoC+DDqWg gZiqqov1XLP6TwxHB8ZUcYYFcv/nGo+cRQxNYI9J5B9/VJbcpHbhaaHboT9rvP9A12rX GZrR+ilGMnVXGHah7iEGtBxkjTcbxQkhU0NyKjYRP2gsT/MhLa9Thz0VTGTg37DeUQ+T WX7mPhaXPqz+3vRtVxO7IcxSSqQb9l4piyiG79oBG26YaP8sPrIT1dlCcEiZpXZH4S5u ut9L40Q4Nv/fPNeaXxUCTkFE1xxLevgSe1xzMck3Sk4Y1JbLySYd+mxlnVHHnVl0riYd Vg5A== 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=I/I5OW+zlY265B/B5Cb8NTi6jPZKFbH0+mKArIVklLY=; fh=TcRPROXzT9svfC8PL4GA9v01BlJpZsrjV4HRPcpqUxk=; b=lomOVyTIikX/yAbUC2CF0WnyX7rZyxDYFl+jVDwwWF51lnpvMg8bfTso04qocMehEH 52KjWHoRh9Ms3jnvzEOutR3+JM1dYBlQzQk7MMrS5mn+JhPBp0Z/wdkzUNvv3ZmbSjWP nKF7nSM0O8rtJFfc7oJk+WbokHY4gBH1YJmmMvnY7ixkc+OVedWfyphJoKvXTHJFwmVg mm0DnGSXRarAN68M3mzcRJjI7ouF2Gh33XRiA0NqmP+aui5BcMBeSU9hi4g+NU6NNC9t Nh1lmc9yEl/Fh9jYgBM+PrjDRX2qwAItDGfsw3WIRd/vo2MqM3OK68dMzmyNexE5S3EW lfWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id m9-20020a170902db0900b001b801bd7fbasi9614792plx.417.2023.09.12.18.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 18:30:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id C3B5787182BF; Tue, 12 Sep 2023 11:48:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237695AbjILSsF (ORCPT + 36 others); Tue, 12 Sep 2023 14:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237606AbjILSry (ORCPT ); Tue, 12 Sep 2023 14:47:54 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B23751722; Tue, 12 Sep 2023 11:47:45 -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 d5ab5436fc065d13; Tue, 12 Sep 2023 20:47:44 +0200 Authentication-Results: v370.home.net.pl; spf=softfail (domain owner discourages use of this host) smtp.mailfrom=rjwysocki.net (client-ip=195.136.19.94; helo=[195.136.19.94]; envelope-from=rjw@rjwysocki.net; receiver=) 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 AAB59663BE5; Tue, 12 Sep 2023 20:47:43 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Linux PM , Zhang Rui , Srinivas Pandruvada , Daniel Lezcano Subject: [PATCH v1 2/9] ACPI: thermal: Fold acpi_thermal_get_info() into its caller Date: Tue, 12 Sep 2023 20:36:21 +0200 Message-ID: <2296248.ElGaqSPkdT@kreacher> In-Reply-To: <5708760.DvuYhMxLoT@kreacher> References: <5708760.DvuYhMxLoT@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: gggruggvucftvghtrhhoucdtuddrgedviedrudeiiedgudeftdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehs rhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 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 (howler.vger.email [0.0.0.0]); Tue, 12 Sep 2023 11:48:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776883966126935440 X-GMAIL-MSGID: 1776883966126935440 From: Rafael J. Wysocki There is only one caller of acpi_thermal_get_info() and the code from it can be folded into its caller just fine, so do that. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Daniel Lezcano --- drivers/acpi/thermal.c | 52 +++++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) Index: linux-pm/drivers/acpi/thermal.c =================================================================== --- linux-pm.orig/drivers/acpi/thermal.c +++ linux-pm/drivers/acpi/thermal.c @@ -846,38 +846,6 @@ static void acpi_thermal_aml_dependency_ acpi_evaluate_integer(handle, "_TMP", NULL, &value); } -static int acpi_thermal_get_info(struct acpi_thermal *tz) -{ - int result; - - if (!tz) - return -EINVAL; - - acpi_thermal_aml_dependency_fix(tz); - - /* Get trip points [_CRT, _PSV, etc.] (required) */ - result = acpi_thermal_get_trip_points(tz); - if (result) - return result; - - /* Get temperature [_TMP] (required) */ - result = acpi_thermal_get_temperature(tz); - if (result) - return result; - - /* Set the cooling mode [_SCP] to active cooling (default) */ - acpi_execute_simple_method(tz->device->handle, "_SCP", - ACPI_THERMAL_MODE_ACTIVE); - - /* Get default polling frequency [_TZP] (optional) */ - if (tzp) - tz->polling_frequency = tzp; - else - acpi_thermal_get_polling_frequency(tz); - - return 0; -} - /* * The exact offset between Kelvin and degree Celsius is 273.15. However ACPI * handles temperature values with a single decimal place. As a consequence, @@ -940,10 +908,28 @@ static int acpi_thermal_add(struct acpi_ strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); device->driver_data = tz; - result = acpi_thermal_get_info(tz); + acpi_thermal_aml_dependency_fix(tz); + + /* Get trip points [_CRT, _PSV, etc.] (required). */ + result = acpi_thermal_get_trip_points(tz); if (result) goto free_memory; + /* Get temperature [_TMP] (required). */ + result = acpi_thermal_get_temperature(tz); + if (result) + goto free_memory; + + /* Set the cooling mode [_SCP] to active cooling. */ + acpi_execute_simple_method(tz->device->handle, "_SCP", + ACPI_THERMAL_MODE_ACTIVE); + + /* Determine the default polling frequency [_TZP]. */ + if (tzp) + tz->polling_frequency = tzp; + else + acpi_thermal_get_polling_frequency(tz); + acpi_thermal_guess_offset(tz); result = acpi_thermal_register_thermal_zone(tz);