From patchwork Mon Jan 30 18:42:16 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: 50426 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2347811wrn; Mon, 30 Jan 2023 11:07:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXsEFiw59lq0LTF4Y6VcIXuUtqooUiNoStEb6g1JplnCqLYsRuWxqy3jvUORPG6hJ3ROWwHi X-Received: by 2002:a17:90a:b702:b0:219:7f29:3152 with SMTP id l2-20020a17090ab70200b002197f293152mr51524427pjr.39.1675105665037; Mon, 30 Jan 2023 11:07:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105665; cv=none; d=google.com; s=arc-20160816; b=SQhxWinrqo41AsUKJFqRApfGhJ3rDcMXwfw6DUngjqipelK4b3txQgdoMBuXrlKmre 7D096c7aTZKpGEEcNaAKSD5kgtMqdsZaHuy/se5hLBEL2jjwRKOuLQJAJc4/EwWLUh2h tuH8REANKsnwp5M0l1LIpYA4UfdK3GYvRREp1k1GfsMv51vXSuikHn3GuEzKtSFmjltr P6GwH+vRAYDQN0jZKxQC4EIVy7fYsaj99WObdEu0YzlXdYXm9TOZl8Af+PpE2fIN5Kzq frTMI/cJIT7nvawYI6T/s6O6nrq3E03WSrR+EixQ8b8G9HIS111bwAdSjxJiz6+f3Kln XSuA== 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=TRHykEcwUFTXtEOhPuZNSni89v/uJDuR9lIqSoqv2Hw=; b=cpFGg1u6shMmXcyRJ5CEhVTnBV+HbopOMwLbjXSvV/FRVN+dw7c1OvglMnq5liBfQj CkwvNrDthV59UD+yK3IhRl1eOjcZoU0x+PD/vEs6u/5wE+W7ObvLjNVUvuocC++hOdFw Z1XLxPSkuaeaqwSsXtei1Al5SFB41HtpOzNdTi3tjNi6pQ5wBEhvQan+/Fy0Gs9MLT5l PAKnlBfA/5vG3+sprrI34Xolky6h2uQCyc31+XmfZBubql9mR3zBEnKRzULN2iYCV/7D lgKlUuOIvoNL3oC0EmKcwvEcFx/HXh8ahz/dwVLSceNKQzd5MIP1SM3yzjO14nBV6rFT vj5A== 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 c4-20020a17090a8d0400b0022bb380256esi14620917pjo.106.2023.01.30.11.07.32; Mon, 30 Jan 2023 11:07:45 -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 S237629AbjA3SsL (ORCPT + 99 others); Mon, 30 Jan 2023 13:48:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237196AbjA3SsF (ORCPT ); Mon, 30 Jan 2023 13:48:05 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BAB529157; Mon, 30 Jan 2023 10:48:01 -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 2e3b141596fad6a6; Mon, 30 Jan 2023 19:47:59 +0100 Received: from kreacher.localnet (unknown [213.134.169.112]) (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 11B0525258B8; Mon, 30 Jan 2023 19:47:59 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Linux ACPI , LKML , Srinivas Pandruvada , Zhang Rui , Daniel Lezcano Subject: [PATCH v2 1/4] thermal: intel: int340x: Assorted minor cleanups Date: Mon, 30 Jan 2023 19:42:16 +0100 Message-ID: <3220135.44csPzL39Z@kreacher> In-Reply-To: <2133431.irdbgypaU6@kreacher> References: <2133431.irdbgypaU6@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.169.112 X-CLIENT-HOSTNAME: 213.134.169.112 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddulecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhu gidrihhnthgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrgh 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?1756475597726088866?= X-GMAIL-MSGID: =?utf-8?q?1756475597726088866?= 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. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano --- v1 -> v2: * Rebase * Skip trip_cnt update * More white space adjustments --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 16 ++++------- 1 file changed, 7 insertions(+), 9 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,15 +30,16 @@ 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; } static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, - int trip, int temp) + int trip, int temp) { struct int34x_thermal_zone *d = zone->devdata; acpi_status status; @@ -46,7 +47,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; @@ -92,7 +93,6 @@ static int int340x_thermal_read_trips(st } for (i = 0; i < INT340X_THERMAL_MAX_ACT_TRIP_COUNT; i++) { - ret = thermal_acpi_active_trip_temp(zone_adev, i, &zone_trips[trip_cnt].temperature); if (ret) @@ -121,8 +121,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); @@ -139,7 +138,7 @@ 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; } @@ -169,8 +168,7 @@ struct int34x_thermal_zone *int340x_ther int34x_thermal_zone->trips = zone_trips; - 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 Mon Jan 30 18:43:32 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: 50427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2347838wrn; Mon, 30 Jan 2023 11:07:48 -0800 (PST) X-Google-Smtp-Source: AK7set+1PpAPMIqWmm7EG/vExb3cTu6eYN9x9pUoNFa8zgeLnFVWkYPTIv/Hdt9y0bwJZ2P9WFIl X-Received: by 2002:a05:6a20:12d5:b0:be:9b65:1f82 with SMTP id v21-20020a056a2012d500b000be9b651f82mr3343822pzg.25.1675105668481; Mon, 30 Jan 2023 11:07:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105668; cv=none; d=google.com; s=arc-20160816; b=DFIBeZ8riOI+NvAC3cfa+Bubf3mVIYZUSXzixS69voGZChc93q9yVZy0RlS2Ty4LhT JdFbc6PXfjcq0Rs9GC36e1QcR9tqusNevvp/4GGynKYn60l24yR08rh4rzP8tg/vHT6a 00wxuGW3odbBeX6OMCaW3A/hMK3RZEMH/AjJC/5f4dtcxJxoJM8PKHL1UFsbO11odg02 pEnaxvZ74ejK94jlmtyaKIG/W9sweJqWhcs6LHHiVufklbVxY3ReUhgjGiuDTxSkxuBG Z2uv6pXrw7zM8YzydFxhsDXIpEVi3HO1hbhc/0DFjMrr0v99TjBJXJzEJpY/hFwBWbsP 5RHg== 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=lch5WWsjGMcgQs2cBW5RJ74CjEkYOIfeO3GvrisGUn8=; b=majvTqFlAVkvBegv6fa95HNG3DL+bC+7b3TqgscSeSmmYXAPqfTwFihsPFUOquK2tI zoTQg2L20FjWgg5IKopLMUGQalJfo4iAKfDxsy8OlJt48lrK77rqb4L6WViCeaPGbqo7 lFmJpPO+WfH/3mOt26vzqX6VWDFzh9oWvLY4hVaXRpRTMAN8ou68QGjJqBre7kQ68Vg1 vmlX8c64rssVM0mZTWhNRC8qAFVGR3lgR+Lr6lbIDp0+S+eez1nh8gTymD51ayG0rm2z YmRn9uodDfDclEwib7kJ+PYB3fkaS1QqE9EnLe9gCNS46tgN1bPWOEIbfEhM/DUQ+Uun hFTQ== 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 m5-20020a637105000000b004b55673ea6fsi12253621pgc.103.2023.01.30.11.07.36; Mon, 30 Jan 2023 11:07:48 -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 S237684AbjA3SsQ (ORCPT + 99 others); Mon, 30 Jan 2023 13:48:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237184AbjA3SsF (ORCPT ); Mon, 30 Jan 2023 13:48:05 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C51D269C; Mon, 30 Jan 2023 10:47:59 -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 53872a6aedc49286; Mon, 30 Jan 2023 19:47:58 +0100 Received: from kreacher.localnet (unknown [213.134.169.112]) (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 728A425258B8; Mon, 30 Jan 2023 19:47:57 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Linux ACPI , LKML , Srinivas Pandruvada , Zhang Rui , Daniel Lezcano Subject: [PATCH v2 2/4] thermal: intel: int340x: Rename variable in int340x_thermal_zone_add() Date: Mon, 30 Jan 2023 19:43:32 +0100 Message-ID: <10219014.nUPlyArG6x@kreacher> In-Reply-To: <2133431.irdbgypaU6@kreacher> References: <2133431.irdbgypaU6@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.169.112 X-CLIENT-HOSTNAME: 213.134.169.112 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddulecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhu gidrihhnthgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=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?1756475601082823795?= X-GMAIL-MSGID: =?utf-8?q?1756475601082823795?= From: Rafael J. Wysocki Rename local variables int34x_thermal_zone in int340x_thermal_zone_add() and int340x_thermal_zone_remove() to int34x_zone which allows a number of code lines to be shorter and easier to read and adjust some white space for consistency. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- v1 -> v2: Rebase --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 67 +++++------ 1 file changed, 33 insertions(+), 34 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 @@ -113,7 +113,7 @@ 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; struct thermal_trip *zone_trips; unsigned long long trip_cnt = 0; unsigned long long hyst; @@ -121,25 +121,25 @@ struct int34x_thermal_zone *int340x_ther 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; } @@ -166,48 +166,47 @@ struct int34x_thermal_zone *int340x_ther for (i = 0; i < trip_cnt; ++i) zone_trips[i].hysteresis = hyst; - int34x_thermal_zone->trips = zone_trips; + int34x_zone->trips = zone_trips; - 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), - 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), + 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); -void int340x_thermal_zone_remove(struct int34x_thermal_zone - *int34x_thermal_zone) +void int340x_thermal_zone_remove(struct int34x_thermal_zone *int34x_zone) { - thermal_zone_device_unregister(int34x_thermal_zone->zone); - acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table); - kfree(int34x_thermal_zone->trips); - kfree(int34x_thermal_zone->ops); - kfree(int34x_thermal_zone); + thermal_zone_device_unregister(int34x_zone->zone); + acpi_lpat_free_conversion_table(int34x_zone->lpat_table); + kfree(int34x_zone->trips); + kfree(int34x_zone->ops); + kfree(int34x_zone); } EXPORT_SYMBOL_GPL(int340x_thermal_zone_remove); From patchwork Mon Jan 30 18:45:17 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: 50433 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2348848wrn; Mon, 30 Jan 2023 11:09:53 -0800 (PST) X-Google-Smtp-Source: AK7set9ujGHGgTBLf4j9q0ZEqSeHhrUYRVgkX1X5VVbPA8+lHBqRZi08xb5ol9cBVxCiKmD2cuGt X-Received: by 2002:a62:1d55:0:b0:592:4d85:ecb1 with SMTP id d82-20020a621d55000000b005924d85ecb1mr14745432pfd.33.1675105793264; Mon, 30 Jan 2023 11:09:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105793; cv=none; d=google.com; s=arc-20160816; b=ByQM6+BhmGOmZTI9qZ000VlHPmXntkxQ4fcTmEvUIblv5DJ0J4oRGkDyM8TQFVH8nT 2kV7BiuyViRaVOx9i3hwENtlVkShUGF/7WV0rWXK8aWxC5vYygggHVgMuezDCJWY21ba udrU21XCyzjTXcOw8CUM1ZmcwGi8OqamJNFaNtj6KaRWGWDmyaj3/WUlHQpw0Cp3MPOA 3T5l+17xBrKqr6XhEeSF+x5FsywAA7JKrhzs6beaYQQ//juck2+6cN3zlTCBH2ok+pnP CfLkwdMzCpXnpUlY9AY6ZO8CH3kqQu9VLs9j3/tD+CXPqWo5qim5Q5Ld/CFe+Du5rr+t pQRg== 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=sDGy9jUGuMfCB2uhubUW4dDrrwzrtGNav52ldpTRyM8=; b=PBHozRALveN2ppo+kTX+S0uvmeAy7Ici33vXhiG2g9GGgXmFEFi1Ws4/842zdf9kq+ wli1URKlrH/uQjTprtCjGN8LsnbKTwAUIJldX4L71pyLueRv4D3xHULwtrMZK+Q+xE88 0yJcuAtyNaWge9l86gwSyjW5YJGrut/K5zzEEGOhtvRJ7YpzulYxJ63DoJlWd6dAxFtH zGYkN8xNtui437xT0gJqSr/zWF4uidxgbcHruAIl78ftkWTHlUDG4DDZR9PGfC8a5K7q VjuoMu9BSjTLqzaJkL94dqbMgHmXJjNUYd5PzdOtKj5TaMVuywmn5/fDesWF9svJ9Pwb DsGQ== 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 j16-20020a056a00175000b0058e2403f011si13417810pfc.56.2023.01.30.11.09.40; Mon, 30 Jan 2023 11:09:53 -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 S237527AbjA3SsJ (ORCPT + 99 others); Mon, 30 Jan 2023 13:48:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236842AbjA3SsE (ORCPT ); Mon, 30 Jan 2023 13:48:04 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AE10196A0; Mon, 30 Jan 2023 10:47:58 -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 d815d95774922b1d; Mon, 30 Jan 2023 19:47:56 +0100 Received: from kreacher.localnet (unknown [213.134.169.112]) (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 C8F4C25258B8; Mon, 30 Jan 2023 19:47:55 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Linux ACPI , LKML , Srinivas Pandruvada , Zhang Rui , Daniel Lezcano Subject: [PATCH v2 3/4] thermal: intel: int340x: Drop pointless cast to unsigned long Date: Mon, 30 Jan 2023 19:45:17 +0100 Message-ID: <1921559.PYKUYFuaPT@kreacher> In-Reply-To: <2133431.irdbgypaU6@kreacher> References: <2133431.irdbgypaU6@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.169.112 X-CLIENT-HOSTNAME: 213.134.169.112 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddulecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhu gidrihhnthgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrgh 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?1756475732207337221?= X-GMAIL-MSGID: =?utf-8?q?1756475732207337221?= 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 Acked-by: Daniel Lezcano --- v1 -> v2: * It was [6/6] in v1 * Rebase --- 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); From patchwork Mon Jan 30 18:47:43 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: 50425 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2347699wrn; Mon, 30 Jan 2023 11:07:33 -0800 (PST) X-Google-Smtp-Source: AK7set+BJ3cWciB3wLuflsIDPjqZl3JKqsrJmvVYWXz2IRlhlkXcg/ZxRVn1chMpELqRJATmGqco X-Received: by 2002:a17:907:da1:b0:888:7ce4:1dc1 with SMTP id go33-20020a1709070da100b008887ce41dc1mr6842424ejc.26.1675105653595; Mon, 30 Jan 2023 11:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105653; cv=none; d=google.com; s=arc-20160816; b=KFQl2JxPpxSNIrbMyxPmLCQyxxTVtjjvq1NDhbMof/E3mMhVGPUr7F2xsoWrobiM/T uI5JY94oRRIXSWF7+1fZ1nX9LQn0SjRL8yY6ezzA+rv8p6pXnh4OALHuy2x/fVvzVqKx T24NJqjxAHlZg+qVeTKSfFxt9fjSON2q7yG5zqWB4GljWLScosij9FH8hI3UZShVjukk 7y4QS06SbF65pqmENUvOg5+CkCgXppRfxZt6b5r+PUTnXm0JwaLl3WEtorFeQA5Nfoux fe8pTMsOYxWMRKmCiCtOq0aImWhKqTVQlHUVdViznjWXxC892S2xMw5StKEiSvMRVoz3 LrgQ== 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=W1Gd1Icwci5AFUxcseLITko9Dg2yFl6yP/HgissYkcU=; b=maGlukLPLJLpfAs6lP2SjgNBwNAD1P1T3G4seiDtX0VXwSBjSpHfLaBfZH6X6pF3ip AkYkjDl0Dp+BtzRdYMI3Wj+4AypUKh/JAS0zPccqid9iOImthJ7yNEByVfeaZ59jJN4B TLe+njJhC13Gi2ZZElTG5NShqGpX2N3Gq1sacu6dIceLmhPPoPHAohjCLQ4eVLx5fLZm tsdB6BiowPB/IRseWfQh3khOUJFg7qlB9HcD6ggz13Vs7V5+DGN4EzkvEIg2HBvo0bbM RTBpwdoCwUNuYmhzTetSUDJc4PEtxF3iI7p/QQujXVofeHaF2nBpR/fxSZ4AylBNWK96 i8Rw== 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 cm17-20020a170907939100b0088b553a6261si916192ejc.868.2023.01.30.11.07.09; Mon, 30 Jan 2023 11:07:33 -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 S236753AbjA3SsF (ORCPT + 99 others); Mon, 30 Jan 2023 13:48:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236090AbjA3SsD (ORCPT ); Mon, 30 Jan 2023 13:48:03 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 309961421D; Mon, 30 Jan 2023 10:47:56 -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 8426bca2ecd88b5b; Mon, 30 Jan 2023 19:47:55 +0100 Received: from kreacher.localnet (unknown [213.134.169.112]) (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 1C48725258B8; Mon, 30 Jan 2023 19:47:54 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Linux ACPI , LKML , Srinivas Pandruvada , Zhang Rui , Daniel Lezcano Subject: [PATCH v2 4/4] thermal: intel: int340x: Improve int340x_thermal_set_trip_temp() Date: Mon, 30 Jan 2023 19:47:43 +0100 Message-ID: <3719164.kQq0lBPeGt@kreacher> In-Reply-To: <2133431.irdbgypaU6@kreacher> References: <2133431.irdbgypaU6@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.169.112 X-CLIENT-HOSTNAME: 213.134.169.112 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddulecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhu gidrihhnthgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrgh 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?1756475585503047297?= X-GMAIL-MSGID: =?utf-8?q?1756475585503047297?= From: Rafael J. Wysocki Instead of using snprintf() to populate the ACPI object name in int340x_thermal_set_trip_temp(), use an appropriate initializer and make the function fail if its trip argument is greater than 9, because ACPI object names can only be 4 characters long and it does not make sense to even try to evaluate objects with longer names (that argument is guaranteed to be non-negative, because it comes from the thermal code that will not pass negative trip numbers to zone callbacks). Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano --- v1 -> v2: New patch in v2 --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 @@ -42,10 +42,12 @@ static int int340x_thermal_set_trip_temp int trip, int temp) { struct int34x_thermal_zone *d = zone->devdata; + char name[] = {'P', 'A', 'T', '0' + trip, '\0'}; acpi_status status; - char name[10]; - snprintf(name, sizeof(name), "PAT%d", trip); + if (trip > 9) + return -EINVAL; + status = acpi_execute_simple_method(d->adev->handle, name, millicelsius_to_deci_kelvin(temp)); if (ACPI_FAILURE(status))