From patchwork Tue Jan 24 19:13:44 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: 47840 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2332097wrn; Tue, 24 Jan 2023 11:23:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXtTbVyd2IlE4X4VcbQRbIA5anhxi/6cLck977118X8ATA3pd+glgeb/HsE6KLYL0KDkXGFX X-Received: by 2002:a05:6402:3496:b0:48e:9c36:6c39 with SMTP id v22-20020a056402349600b0048e9c366c39mr41987102edc.0.1674588187042; Tue, 24 Jan 2023 11:23:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674588187; cv=none; d=google.com; s=arc-20160816; b=D+t8Vd9mo16dLy1ih/iBsuzENU08sZ4bzSgecCk009WQ1kVZj497Owdz+iyiInwK8r dBIqlkqp99t1I+Jpgcj7j8fL9VQ1sGGtPvzknB3K2z0UTuVy7TP0XGfrCHsrQhpTCTCC AVycRuqBut5RrFRdVOay+QGQ6U7KPqMtG8+iq1+Zz+PXQv932nUaPXP23Nc6i0KtxquM zKSIu1aJ/5WcTnRVe5sc1NunBdYbmHZJTnTOSuNEfv6ew9Jtz8kEmYAywxjVlQnjfPrx oDu+TgxR8FxN82uemNET/F7x5jAN6T6DvgrTPrfTvSi1IH7U480vHmjUoSWdzE6dGbYT sjWg== 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=FtuyHJrTGoEyajQpJPyWPj8l5Fj+TH9V0G+jTLVUVqM=; b=D1ZizZWfQgCgI3zIg/mtVWlgFfq1BYtJ5bk6EVXzzzDXvHMyA+D77eCJj0FmIcJFGy A+z6CRa0eiBRGo+l8BIxLiiguki1YCRZbuRg425PjNuQoeNzzaCmZ9IR09+qb7Wf0rjs AMb6sVy3da2GvgnZFGe3gpdLx8iWOQ7z3k/mKEHxKBwEkW6m14Jmd53Rq5UWZlLusKq4 vjqYM6M3jqeHBaphr/vXXE0joVlL9cpsxGmjQP9mFNVv48EleG77n4yNoZ0O+PwVVDU2 61LvlFhEXsyBH65yBYIbzLVf7IvJgu0jjfGF+N5yT2+IqTA/gVcAcCyLFE/42tPnBidl DZtA== 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 g35-20020a056402322300b004841817039asi4238248eda.614.2023.01.24.11.22.43; Tue, 24 Jan 2023 11:23:07 -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 S234680AbjAXTT3 (ORCPT + 99 others); Tue, 24 Jan 2023 14:19:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234575AbjAXTTS (ORCPT ); Tue, 24 Jan 2023 14:19:18 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64D154F370; Tue, 24 Jan 2023 11:19:15 -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 1ca963bc24d3b939; Tue, 24 Jan 2023 20:19:13 +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 F024C7A644A; Tue, 24 Jan 2023 20:19:12 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Linux ACPI , Zhang Rui , Srinivas Pandruvada , Daniel Lezcano Subject: [PATCH v1 1/6] thermal: intel: int340x: Assorted minor cleanups Date: Tue, 24 Jan 2023 20:13:44 +0100 Message-ID: <4795442.GXAFRqVoOG@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: gggruggvucftvghtrhhoucdtuddrgedvhedruddvtddguddvudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudekledrfedtnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekledrfedtpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthho 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?1755932982896326740?= X-GMAIL-MSGID: =?utf-8?q?1755932982896326740?= From: Rafael J. Wysocki Improve some inconsistent usage of white space in int340x_thermal_zone.c, fix up one coding style issue in it (missing braces around an else branch of a conditional) and while at it replace a !ACPI_FAILURE() check with an equivalent ACPI_SUCCESS() one. Also add INT340X_THERMAL_MAX_TRIP_COUNT to trip_cnt before using it for the allocation of trips for more clarity. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 22 +++++------ 1 file changed, 10 insertions(+), 12 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 @@ -30,10 +30,10 @@ static int int340x_thermal_get_zone_temp return conv_temp; *temp = (unsigned long)conv_temp * 10; - } else + } else { /* _TMP returns the temperature in tenths of degrees Kelvin */ *temp = deci_kelvin_to_millicelsius(tmp); - + } return 0; } @@ -46,7 +46,7 @@ static int int340x_thermal_set_trip_temp snprintf(name, sizeof(name), "PAT%d", trip); status = acpi_execute_simple_method(d->adev->handle, name, - millicelsius_to_deci_kelvin(temp)); + millicelsius_to_deci_kelvin(temp)); if (ACPI_FAILURE(status)) return -EIO; @@ -99,7 +99,6 @@ int int340x_thermal_read_trips(struct in trip_cnt++; for (i = 0; i < INT340X_THERMAL_MAX_ACT_TRIP_COUNT; i++) { - ret = thermal_acpi_trip_active(int34x_zone->adev, i, &int34x_zone->trips[trip_cnt]); if (ret) break; @@ -125,8 +124,7 @@ struct int34x_thermal_zone *int340x_ther acpi_status status; int i, ret; - int34x_thermal_zone = kzalloc(sizeof(*int34x_thermal_zone), - GFP_KERNEL); + int34x_thermal_zone = kzalloc(sizeof(*int34x_thermal_zone), GFP_KERNEL); if (!int34x_thermal_zone) return ERR_PTR(-ENOMEM); @@ -143,14 +141,15 @@ struct int34x_thermal_zone *int340x_ther int34x_thermal_zone->ops->get_temp = get_temp; status = acpi_evaluate_integer(adev->handle, "PATC", NULL, &trip_cnt); - if (!ACPI_FAILURE(status)) { + if (ACPI_SUCCESS(status)) { int34x_thermal_zone->aux_trip_nr = trip_cnt; trip_mask = BIT(trip_cnt) - 1; } - int34x_thermal_zone->trips = kzalloc(sizeof(*int34x_thermal_zone->trips) * - (INT340X_THERMAL_MAX_TRIP_COUNT + trip_cnt), - GFP_KERNEL); + trip_cnt += INT340X_THERMAL_MAX_TRIP_COUNT; + + int34x_thermal_zone->trips = kzalloc(sizeof(*int34x_thermal_zone->trips) * trip_cnt, + GFP_KERNEL); if (!int34x_thermal_zone->trips) { ret = -ENOMEM; goto err_trips_alloc; @@ -166,8 +165,7 @@ struct int34x_thermal_zone *int340x_ther int34x_thermal_zone->trips[i].temperature = THERMAL_TEMP_INVALID; } - int34x_thermal_zone->lpat_table = acpi_lpat_get_conversion_table( - adev->handle); + int34x_thermal_zone->lpat_table = acpi_lpat_get_conversion_table(adev->handle); int34x_thermal_zone->zone = thermal_zone_device_register_with_trips( acpi_device_bid(adev), From patchwork Tue Jan 24 19:14:52 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: 47843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2332246wrn; Tue, 24 Jan 2023 11:23:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXtftQH1PWg8+AmBxcg9PGbB5WHFOOm4wtxNz6atnKsanaAz8CKRPJD+GJxkWjC3cz2MHDAr X-Received: by 2002:a17:902:d651:b0:194:bdcf:1ab8 with SMTP id y17-20020a170902d65100b00194bdcf1ab8mr22936195plh.37.1674588214587; Tue, 24 Jan 2023 11:23:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674588214; cv=none; d=google.com; s=arc-20160816; b=A/rICY8hp506MMt/N/g3XwypMCvA57bEWy1yV89YpAcnzwTivEFQErquFOdur3Z8X7 +Xj9/NNGJtvvSs8Cv+XQdZgv3OqNm2gzRdc+Klfo70poj+NWgErlxq7MKWkl5qkXjBO3 +KH930PFo+vAG6gbfHbgEYiMrOXXn2AlV7O7Vbbbv6Mv4LfVx5yWPpM90TBKzCjFnWmF Pi8lpeIVMPBUdnNr0f/GPJxKdIaQNek0LyvZADcrU9XPOJBZpcEFlyp3Ziim8rIvG1EM zy7pT+553RJGBgg04u5KzYSHI2dm891RRvh/XCOO3r+F0gn+1GWoHRGRiiM3qXDhJzoe Sprg== 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=KgGzvqK1T70L5KxMqFq6gfzjgr7XokXMLyiesF87F/Y=; b=gls3LOxp5DUQwRQqrKuf3RXFWeT0u07Jm7+U0vX7vxl8aEm8wGWcIVk1MK8amV+jY2 jKBAlRCqTVgx8/VJVRkMgkZsVJR/EV7UYFzikPCuaSYtpXmbDr9Rva/+2NzGuWCVVCC2 pPD4w8+3qHDjPCVx0Bo1YoiEuKUCcC5uw9MBYxcB2mgsEGlFaAcok76g305fR9bPEFNE 61Y36il91cD0czyeMAqB4gR+MXvp/Era3erEluTWzIL7CZGdgmsndd7U8tQUeuvRahs9 jd7lW6uy6dBzLgT24XJF5/TCLclUnAVpz1c/grHdZ9WhoAv63JIA/kbnf6ZjsrFmxo0l 7nxA== 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 r3-20020a170902be0300b00186aad06b52si3146100pls.290.2023.01.24.11.23.22; Tue, 24 Jan 2023 11:23:34 -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 S234605AbjAXTTZ (ORCPT + 99 others); Tue, 24 Jan 2023 14:19:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234512AbjAXTTQ (ORCPT ); Tue, 24 Jan 2023 14:19:16 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C412F4ED00; Tue, 24 Jan 2023 11:19:13 -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 899c60219e9c5128; Tue, 24 Jan 2023 20:19:12 +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 7D39D7A644A; Tue, 24 Jan 2023 20:19:11 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Linux ACPI , Zhang Rui , Srinivas Pandruvada , Daniel Lezcano Subject: [PATCH v1 2/6] thermal: intel: int340x: Rename variable in int340x_thermal_zone_add() Date: Tue, 24 Jan 2023 20:14:52 +0100 Message-ID: <2152349.irdbgypaU6@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?1755933011634730808?= X-GMAIL-MSGID: =?utf-8?q?1755933011634730808?= From: Rafael J. Wysocki Rename local variable int34x_thermal_zone in int340x_thermal_zone_add() to int34x_zone which allows a number of code lines to become shorter and easier to read and adjust some white space for consistency. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 69 +++++------ 1 file changed, 34 insertions(+), 35 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 @@ -118,82 +118,81 @@ static struct thermal_zone_params int340 struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, int (*get_temp) (struct thermal_zone_device *, int *)) { - struct int34x_thermal_zone *int34x_thermal_zone; + struct int34x_thermal_zone *int34x_zone; unsigned long long trip_cnt = 0; int trip_mask = 0; acpi_status status; int i, ret; - int34x_thermal_zone = kzalloc(sizeof(*int34x_thermal_zone), GFP_KERNEL); - if (!int34x_thermal_zone) + int34x_zone = kzalloc(sizeof(*int34x_zone), GFP_KERNEL); + if (!int34x_zone) return ERR_PTR(-ENOMEM); - int34x_thermal_zone->adev = adev; + int34x_zone->adev = adev; - int34x_thermal_zone->ops = kmemdup(&int340x_thermal_zone_ops, - sizeof(int340x_thermal_zone_ops), GFP_KERNEL); - if (!int34x_thermal_zone->ops) { + int34x_zone->ops = kmemdup(&int340x_thermal_zone_ops, + sizeof(int340x_thermal_zone_ops), GFP_KERNEL); + if (!int34x_zone->ops) { ret = -ENOMEM; goto err_ops_alloc; } if (get_temp) - int34x_thermal_zone->ops->get_temp = get_temp; + int34x_zone->ops->get_temp = get_temp; status = acpi_evaluate_integer(adev->handle, "PATC", NULL, &trip_cnt); if (ACPI_SUCCESS(status)) { - int34x_thermal_zone->aux_trip_nr = trip_cnt; + int34x_zone->aux_trip_nr = trip_cnt; trip_mask = BIT(trip_cnt) - 1; } trip_cnt += INT340X_THERMAL_MAX_TRIP_COUNT; - int34x_thermal_zone->trips = kzalloc(sizeof(*int34x_thermal_zone->trips) * trip_cnt, - GFP_KERNEL); - if (!int34x_thermal_zone->trips) { + int34x_zone->trips = kzalloc(sizeof(*int34x_zone->trips) * trip_cnt, GFP_KERNEL); + if (!int34x_zone->trips) { ret = -ENOMEM; goto err_trips_alloc; } - trip_cnt = int340x_thermal_read_trips(int34x_thermal_zone); + trip_cnt = int340x_thermal_read_trips(int34x_zone); for (i = 0; i < trip_cnt; ++i) - int340x_thermal_get_global_hyst(adev, &int34x_thermal_zone->trips[i].hysteresis); + int340x_thermal_get_global_hyst(adev, &int34x_zone->trips[i].hysteresis); - for (i = 0; i < int34x_thermal_zone->aux_trip_nr; i++) { - int34x_thermal_zone->trips[i].type = THERMAL_TRIP_PASSIVE; - int34x_thermal_zone->trips[i].temperature = THERMAL_TEMP_INVALID; + for (i = 0; i < int34x_zone->aux_trip_nr; i++) { + int34x_zone->trips[i].type = THERMAL_TRIP_PASSIVE; + int34x_zone->trips[i].temperature = THERMAL_TEMP_INVALID; } - int34x_thermal_zone->lpat_table = acpi_lpat_get_conversion_table(adev->handle); + int34x_zone->lpat_table = acpi_lpat_get_conversion_table(adev->handle); - int34x_thermal_zone->zone = thermal_zone_device_register_with_trips( - acpi_device_bid(adev), - int34x_thermal_zone->trips, - trip_cnt, - trip_mask, int34x_thermal_zone, - int34x_thermal_zone->ops, - &int340x_thermal_params, - 0, 0); - if (IS_ERR(int34x_thermal_zone->zone)) { - ret = PTR_ERR(int34x_thermal_zone->zone); + int34x_zone->zone = thermal_zone_device_register_with_trips( + acpi_device_bid(adev), + int34x_zone->trips, + trip_cnt, + trip_mask, int34x_zone, + int34x_zone->ops, + &int340x_thermal_params, + 0, 0); + if (IS_ERR(int34x_zone->zone)) { + ret = PTR_ERR(int34x_zone->zone); goto err_thermal_zone; } - ret = thermal_zone_device_enable(int34x_thermal_zone->zone); + ret = thermal_zone_device_enable(int34x_zone->zone); if (ret) goto err_enable; - return int34x_thermal_zone; + return int34x_zone; err_enable: - thermal_zone_device_unregister(int34x_thermal_zone->zone); + thermal_zone_device_unregister(int34x_zone->zone); err_thermal_zone: - kfree(int34x_thermal_zone->trips); - acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table); + kfree(int34x_zone->trips); + acpi_lpat_free_conversion_table(int34x_zone->lpat_table); err_trips_alloc: - kfree(int34x_thermal_zone->ops); + kfree(int34x_zone->ops); err_ops_alloc: - kfree(int34x_thermal_zone); + kfree(int34x_zone); return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(int340x_thermal_zone_add); 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; From patchwork Tue Jan 24 19:17: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: 47838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2331728wrn; Tue, 24 Jan 2023 11:22:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXvGt2+H32cP6aYMS4Wh7rBCZqfCk914uNlxbuGcweHh2O6+s2/2l0Vg3gnimrqlOceddo4T X-Received: by 2002:a17:906:c58:b0:78d:f456:1ed0 with SMTP id t24-20020a1709060c5800b0078df4561ed0mr43429813ejf.33.1674588128889; Tue, 24 Jan 2023 11:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674588128; cv=none; d=google.com; s=arc-20160816; b=GNACVIEUueFfUB984ER7ik9nlg9wXmtja7kuG8XJ+YZWETrrp3HVC/6RzoeD90/jdh +4JbrHG+Wgo8vOi6aZvzeF63gXeiZuGNN8CzsRTlvNsaDceTElQ24GR351/53XEmN7gD BhZvmA5DPhw9suYYIULCkmh1SEyrjEq555BGqsY/99626jbekohoghGV2xqSTuJ7muUl o7/IoPQfXr8UBwANIhfRI2iqMcRsyjyi0VLbyDArh1kUANXir+Vhugs6NAHk/bWrLz+a KUSBGKLCtrJIUGqtpn1Wsa937TH2hCFVP2fv+ZrB5wmVMuG7rX/+JGcJ85NIlrwClGAI LzPQ== 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=LZX6KVArSokyQzHIR97sCQr7AxJyZAUEzcl/MNAeJm4=; b=neCpFid9DcBUgfMvVYy4S2T6fqg/b34xu7gO1kpHS6MCXpEtu8WRlJmS2hZQiAA0ex bl4FIa3kUjyuUPkinoXuxBqYhCbsYvNA75BOi6eA40mLmJt9Tnh0iaXEDa2hVukxubwD z03IHGZnWWLGysN7I8fEj2UsjbrD8p+ki0GvGfsIi/RvQt3oP8o2T5FfCZltqXGTuyu5 Y2ZHhm1zEvQKTEcRrKKVJCY+DWF+PlIrlVKY9dfJhmduETsvnQ883Hipvy2EKa+skVEM 8fdST+GR++ty1Ig+EHXywg7/m4qTeCIK1zHIn5Tz0Mh3gQj1jhfQ5g21G5QyfhyMtWDh us8w== 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 s22-20020a170906221600b00876a2339b76si3432044ejs.400.2023.01.24.11.21.45; Tue, 24 Jan 2023 11:22:08 -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 S234547AbjAXTTR (ORCPT + 99 others); Tue, 24 Jan 2023 14:19:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234343AbjAXTTN (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 A561B32522; Tue, 24 Jan 2023 11:19:10 -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 489f2acd983c5755; Tue, 24 Jan 2023 20:19:09 +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 501A47A644A; Tue, 24 Jan 2023 20:19:08 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Linux ACPI , Zhang Rui , Srinivas Pandruvada , Daniel Lezcano Subject: [PATCH v1 4/6] thermal: intel: int340x: Rearrange int340x_thermal_read_trips() Date: Tue, 24 Jan 2023 20:17:09 +0100 Message-ID: <3238718.44csPzL39Z@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?1755932922117214003?= X-GMAIL-MSGID: =?utf-8?q?1755932922117214003?= From: Rafael J. Wysocki Use local variables trips and adev to store the addresses of the given thermal zone's trip point table and ACPI device, respectively, and use them to shorten some code lines. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 @@ -66,25 +66,27 @@ static struct thermal_zone_device_ops in int int340x_thermal_read_trips(struct int34x_thermal_zone *int34x_zone) { + struct thermal_trip *trips = int34x_zone->trips; + struct acpi_device *adev = int34x_zone->adev; int trip_cnt; int i, ret; trip_cnt = int34x_zone->aux_trip_nr; - ret = thermal_acpi_trip_critical(int34x_zone->adev, &int34x_zone->trips[trip_cnt]); + ret = thermal_acpi_trip_critical(adev, &trips[trip_cnt]); if (!ret) trip_cnt++; - ret = thermal_acpi_trip_hot(int34x_zone->adev, &int34x_zone->trips[trip_cnt]); + ret = thermal_acpi_trip_hot(adev, &trips[trip_cnt]); if (!ret) trip_cnt++; - ret = thermal_acpi_trip_passive(int34x_zone->adev, &int34x_zone->trips[trip_cnt]); + ret = thermal_acpi_trip_passive(adev, &trips[trip_cnt]); if (!ret) trip_cnt++; for (i = 0; i < INT340X_THERMAL_MAX_ACT_TRIP_COUNT; i++) { - ret = thermal_acpi_trip_active(int34x_zone->adev, i, &int34x_zone->trips[trip_cnt]); + ret = thermal_acpi_trip_active(adev, i, &trips[trip_cnt]); if (ret) break; From patchwork Tue Jan 24 19:18: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: 47839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2331742wrn; Tue, 24 Jan 2023 11:22:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXtoX54YxR5aKR3LwIFwCn07qWNf3n93ZNoUhy5BTv1SMtriGViwv/oEUHxlUzKOD7DpbBp6 X-Received: by 2002:a17:902:c943:b0:195:e834:31e8 with SMTP id i3-20020a170902c94300b00195e83431e8mr20988994pla.10.1674588131601; Tue, 24 Jan 2023 11:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674588131; cv=none; d=google.com; s=arc-20160816; b=lNnWvzFrbSVIwRToubqvrefn2012/Vm7Jp9GYixwkWEygKKmDpyS0sTWCQ2B+iPXMo LD6RLeEjq5/JMvsuMc3WWf1BWN3AzcQqjFo3+CNzTg/SyjDXXajDpoY9Uyc7Rx4WPcMr jLTSz0MsEI1kFI8VfcHnHfvz731wXvGhwnkl6T4zRknqspzFM8wcmXvO8Qz4PdZ/38Wp /jZFQ01fyk2Lk9lAICnL+lPS3CoQc2qkwjr5531jZ5jLk4aDGcNVJ/ItITnRHyJ3bZ01 Fafy6y+1Xj8PZp8os+zAFpl7ICU3gviAquBtUufFNboqphWmIVJZFHLXxm3YOs9VEPMv YKkQ== 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=GbqI5x7Qd23KASVXNMexBDwHCFKOGLzor+NZPFZxlL8=; b=OBhxIKgQckdR9LdxZoo3OXDRe2RpHq1RRtQyyuLBj7AOK5jGYnPR+FvrGChp6S9PW3 k4axUTYHr4v5Q8mj6l07QcPF5O0MhshhvRYObP5dp2USqhMh66NGONoTYOV+EmtpOvPa 4rrEiD9Lu/7dDCfR82wXjq7LDIoQDrfYc4ITFNK7EnEer+59ZRoMKnkv4GLDBXL2PhQS ixMjhQv3yPXGnuq9VX2jQP3MLPxmB5V6xVj7hR/OVeVJd+rxCqwfT34vifHvQYy6KV3I Kw/29AEzU6lBeyGZwCeAwsj3taXMvTPj1jB2J4ULjenO3ppzxPjO9+cgPr42g2NIqOPs aQGw== 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 h10-20020a170902f7ca00b00189891763f3si3132245plw.600.2023.01.24.11.21.59; Tue, 24 Jan 2023 11:22:11 -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 S234433AbjAXTTM (ORCPT + 99 others); Tue, 24 Jan 2023 14:19:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234343AbjAXTTK (ORCPT ); Tue, 24 Jan 2023 14:19:10 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05FA531E3B; Tue, 24 Jan 2023 11:19:08 -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 86a9f70f4c250077; Tue, 24 Jan 2023 20:19:07 +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 A76BB7A644A; Tue, 24 Jan 2023 20:19:06 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Linux ACPI , Zhang Rui , Srinivas Pandruvada , Daniel Lezcano Subject: [PATCH v1 5/6] thermal: intel: int340x: Populate auxiliary trip points first Date: Tue, 24 Jan 2023 20:18:09 +0100 Message-ID: <10235439.nUPlyArG6x@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?1755932924464200757?= X-GMAIL-MSGID: =?utf-8?q?1755932924464200757?= From: Rafael J. Wysocki Populate the auxiliary trip points in the int340x thermal zone before the "regular" ACPI ones, because they occupy the initial entries of the trip points table. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 @@ -142,6 +142,11 @@ struct int34x_thermal_zone *int340x_ther goto err_trips_alloc; } + for (i = 0; i < int34x_zone->aux_trip_nr; i++) { + int34x_zone->trips[i].type = THERMAL_TRIP_PASSIVE; + int34x_zone->trips[i].temperature = THERMAL_TEMP_INVALID; + } + trip_cnt = int340x_thermal_read_trips(int34x_zone); status = acpi_evaluate_integer(adev->handle, "GTSH", NULL, &hyst); @@ -153,11 +158,6 @@ struct int34x_thermal_zone *int340x_ther for (i = 0; i < trip_cnt; ++i) int34x_zone->trips[i].hysteresis = hyst; - for (i = 0; i < int34x_zone->aux_trip_nr; i++) { - int34x_zone->trips[i].type = THERMAL_TRIP_PASSIVE; - int34x_zone->trips[i].temperature = THERMAL_TEMP_INVALID; - } - int34x_zone->lpat_table = acpi_lpat_get_conversion_table(adev->handle); int34x_zone->zone = thermal_zone_device_register_with_trips( From patchwork Tue Jan 24 19:18:52 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: 47841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2332113wrn; Tue, 24 Jan 2023 11:23:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsRE657qBu+7xfb3K/kYm5JBa84eCyNCEwtFEzKzIO2cjAn7q5KNVQZtjXt8WVHjWqYx3JP X-Received: by 2002:a17:902:9009:b0:193:2d46:7c5f with SMTP id a9-20020a170902900900b001932d467c5fmr28391575plp.33.1674588191080; Tue, 24 Jan 2023 11:23:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674588191; cv=none; d=google.com; s=arc-20160816; b=zdhHbyRRRyEz5UlH0REhl8Ow5oMAedAXuRrtXbWcxIjWiuLdNc/Fu8kMUgjT0ICYbu BI+dWiX2LlLg2BQHy0MS8ADCmi+AR42rV3LcHRDW04sPpcRZgjOeTHyzX1s//tBbxClE N1tUISDeB3sp6aXB1NwPXcwXHqX2bh+p5U4hgv4Zaokn7GlJyfCVkDjDP+6OynrMHoQg N3y+LQLV7cL7xxfsK5VJ9znsxun8o93yBZ27yzGZWyRhLU4vmQ0ucOPU6sQldsEN147S jZ4NVA1kcp3FzYTML4y0hPqabG1dGWNxKZDS758AlLUzlC+13eTN0wpxeow4cTxN2SL2 iAzQ== 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=enLJp/U4STN5QB6FM3B8Q2n45xbi+bu3yZ8x73QgwSw=; b=M900U5ug/RY7Ixz5+0dvTQwYqgsUUUJ6JAve+BwPrrlmYL+hNXX7PLDjH26b8MtCn6 pc8Gme9ah2Msyog3azBjcZ65nP1acoKqSZz8oUrJ2s+edjVP7G1ANTkIRLCL4Li8gANg hXB6QZWSDf6tgo4p+FAZIRstljn7Zw86B84U297H0hBG5IQnz1C5ufPOOcOZfMIidLbg TzR9PfE3OaEoMcHerRGjlwAf+/MK/m0N4gHmRY8VOVnqcsnisZ5pGgwNTbVamaO0/y+4 rbLZ4TgxyG2qX7628iFOcz4DkrDIJa5p8ObAenonn+IqAXH+JmNGh/0PkMSJF7kIlmTM o5zw== 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 iz15-20020a170902ef8f00b00195feba6157si3184590plb.288.2023.01.24.11.22.59; Tue, 24 Jan 2023 11:23:11 -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 S234393AbjAXTTK (ORCPT + 99 others); Tue, 24 Jan 2023 14:19:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbjAXTTJ (ORCPT ); Tue, 24 Jan 2023 14:19:09 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4869A31E26; Tue, 24 Jan 2023 11:19:08 -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 121f397b287e1538; Tue, 24 Jan 2023 20:19:06 +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 3D6BF7A644A; Tue, 24 Jan 2023 20:19:05 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Linux ACPI , Zhang Rui , Srinivas Pandruvada , Daniel Lezcano Subject: [PATCH v1 6/6] thermal: intel: int340x: Drop pointless cast to unsigned long Date: Tue, 24 Jan 2023 20:18:52 +0100 Message-ID: <1940542.PYKUYFuaPT@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?1755932987088965806?= X-GMAIL-MSGID: =?utf-8?q?1755932987088965806?= From: Rafael J. Wysocki The explicit casting from int to unsigned long in int340x_thermal_get_zone_temp() is pointless, becuase the multiplication result is cast back to int by the assignment in the same statement, so drop it. No expected functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ -29,7 +29,7 @@ static int int340x_thermal_get_zone_temp if (conv_temp < 0) return conv_temp; - *temp = (unsigned long)conv_temp * 10; + *temp = conv_temp * 10; } else { /* _TMP returns the temperature in tenths of degrees Kelvin */ *temp = deci_kelvin_to_millicelsius(tmp);