From patchwork Mon Jan 30 18:58: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: 50437 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2349472wrn; Mon, 30 Jan 2023 11:11:21 -0800 (PST) X-Google-Smtp-Source: AK7set84uU9RgfuQ7YooEXzDdgEJtvy79vcincyQivysYKKBWcIa3VOiTDRatF16rUtMyiv06e6E X-Received: by 2002:a05:6402:5253:b0:4a2:358e:e734 with SMTP id t19-20020a056402525300b004a2358ee734mr9518625edd.7.1675105880820; Mon, 30 Jan 2023 11:11:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105880; cv=none; d=google.com; s=arc-20160816; b=AJWWzKEijoPBEGcP0tjEWDodP6BN7cTEf5iy1/Of9UokooBU2id0H5J9w2pm0GpDAo 3YT9VRNRQw2LA4ALEqimeN7Bp89mSJILOwpnADeDxbutxCYVyDsNa96OjiKzImb5s080 RKow+8UJM7Erfllguy2H7tSM6lJh3Jhit8Ks+c77qi7jBRR/bF4T+Fc9z9l003sz89QJ TZ8WVF4CTSIcJZXo7f3w35b5LJj+e6tih+fF7OZ6AYcJuxkhOAech7XCsanxKr4AYq6I eLuWV6skcczo/TtSj7vC0xdh4uh8uoX65zHyquev7C30CR21/L1jJM1RKsCM4j6F59+6 rEXg== 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=dHPnRjHCg/x2QzFV7dRj2+//WEd9Oke3eyv2+VlblK8=; b=zXciRNjXYoOOsilBDDNDESmbDl4R/IgiLpq7AA9uIzDcFvzO1pg/8hMx9F+tFyK+bZ 4TT8HvXJrEB6XwwBaVR6eWTqST2kNY4jGCjeIbkV+Y5399EqjwGZlsjatFoyo9gc4Uat lD4x6k0tBVwswrrbdn9LRbNPhGPlVL1QcRpE5mOfjldz3bmwaFerURai3QhWZCeaM4RS 62uJbOLi0FoKWhMDqCYf0aiMYSaPjD/wEKRIEUseNpybbb95f54TGu7NOPPnw9/wJUbT X0veNHCjJs/tGlQClOXBdh9Kq8n0UsXFEFdeIse5UIefH1OEj5p8ifNnWgPxepfgk8HZ CUDQ== 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 y14-20020a17090668ce00b0084d1a0d90cdsi15586956ejr.674.2023.01.30.11.10.56; Mon, 30 Jan 2023 11:11:20 -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 S238334AbjA3TID (ORCPT + 99 others); Mon, 30 Jan 2023 14:08:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235858AbjA3TH5 (ORCPT ); Mon, 30 Jan 2023 14:07:57 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C8FB3A87D; Mon, 30 Jan 2023 11:07:39 -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 08df841c7d46ca66; Mon, 30 Jan 2023 20:07:37 +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 B6C6D2528287; Mon, 30 Jan 2023 20:07:36 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Zhang Rui , Srinivas Pandruvada , Linux ACPI , LKML , David Box Subject: [PATCH v1 1/8] thermal: intel: intel_pch: Make pch_wpt_add_acpi_psv_trip() return int Date: Mon, 30 Jan 2023 19:58:32 +0100 Message-ID: <1941501.usQuhbGJ8B@kreacher> In-Reply-To: <1751684.VLH7GnMWUR@kreacher> References: <1751684.VLH7GnMWUR@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: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdho rhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrvhhiugdrvgdrsghogieslhhinhhugidrihhnthgvlhdrtghomh 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?1756475824277385817?= X-GMAIL-MSGID: =?utf-8?q?1756475824277385817?= From: Rafael J. Wysocki Modify pch_wpt_add_acpi_psv_trip() to return an int value instead of using a return pointer for that. While at it, drop an excessive empty code line. Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano --- drivers/thermal/intel/intel_pch_thermal.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) Index: linux-pm/drivers/thermal/intel/intel_pch_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_pch_thermal.c +++ linux-pm/drivers/thermal/intel/intel_pch_thermal.c @@ -90,34 +90,31 @@ struct pch_thermal_device { }; #ifdef CONFIG_ACPI - /* * On some platforms, there is a companion ACPI device, which adds * passive trip temperature using _PSV method. There is no specific * passive temperature setting in MMIO interface of this PCI device. */ -static void pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, - int *nr_trips) +static int pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, int trip) { struct acpi_device *adev; int temp; adev = ACPI_COMPANION(&ptd->pdev->dev); if (!adev) - return; + return 0; if (thermal_acpi_passive_trip_temp(adev, &temp) || temp <= 0) - return; + return 0; - ptd->trips[*nr_trips].type = THERMAL_TRIP_PASSIVE; - ptd->trips[*nr_trips].temperature = temp; - ++(*nr_trips); + ptd->trips[trip].type = THERMAL_TRIP_PASSIVE; + ptd->trips[trip].temperature = temp; + return 1; } #else -static void pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, - int *nr_trips) +static int pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, int trip) { - + return 0; } #endif @@ -167,7 +164,7 @@ read_trips: ++(*nr_trips); } - pch_wpt_add_acpi_psv_trip(ptd, nr_trips); + *nr_trips += pch_wpt_add_acpi_psv_trip(ptd, *nr_trips); return 0; } From patchwork Mon Jan 30 18:59:48 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: 50436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2349150wrn; Mon, 30 Jan 2023 11:10:36 -0800 (PST) X-Google-Smtp-Source: AK7set9bGI6CehO8Vc0AFcFh3wua7UQ0WRAQtrFucKfepR2PNedlkF/edPDgIIkDyo9HCJ1gUJR3 X-Received: by 2002:a05:6a21:99a9:b0:be:bea0:7139 with SMTP id ve41-20020a056a2199a900b000bebea07139mr1501737pzb.9.1675105835698; Mon, 30 Jan 2023 11:10:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105835; cv=none; d=google.com; s=arc-20160816; b=lQZsH+VB+RGRKTl9Hm9KdTXgNXSx2YoNCPtmqb8YNYGyu9Oktm/h+CddAf7gaBqGaG fjlkXNNxhiT9XyNw6AkYb4csaETepliv8tC9hp0QjBgbxDZvf/g9W5OcfenWno8bbXMI nu/rOWvf0iajNZnlfZSsooOB9sHiHxEnGjkRvmPl/xbVeniix0hOpSz0QegmzaIlPvQa RmeIIJv9BwOZ87TV4GdahC0Tq2D+cUOfrM24TWdUavJQsb3ObApFSRaT9YHdYNHIPttL ccT5b6IftLOKdOLu/a6grM29tEsCeRO6Yhkr1PyD6ZDCbFMgcFs5wbsTPBuCMvTTqchX TmyA== 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=EdVQSzzM8x8fbUrAkhaEs6o9BewhMe+TiienT7JfBXI=; b=Fru4DBDojDHTrDwTOqkNLeAYnbkNWJMesUKX2Eg5cyQlr7V5+Y5cpdKGwp6tr1eo2K njA37W9GBJ14yYuV1Wjioj7cIaY8kL8+jtlZe7t66F5kNP+0oTy2YOdQGVDweHZ+6Oxw Rq2ZWjwxD+6p2iVu1MO1fqo2Qg3v8FqaeqPOfcBofBA9yEi2L38EiR6hp0josDe5FBuq 4NCjCwBeWAQxVmJoxx4YoxFROeiQsXgQaGimApT+CEZz+i5Skic3APyTBRPJPzHnk3qr L+y5a1OJfgEaHU6OFLhXIy8jNu2o6T6JmvPm++G4qlfvY+z56bKnIDM5h6mqJATyuEkp kYYg== 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 m187-20020a633fc4000000b004dfb2d69e3bsi11520367pga.778.2023.01.30.11.10.23; Mon, 30 Jan 2023 11:10:35 -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 S238310AbjA3TH7 (ORCPT + 99 others); Mon, 30 Jan 2023 14:07:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238200AbjA3THn (ORCPT ); Mon, 30 Jan 2023 14:07:43 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E82483B3F7; Mon, 30 Jan 2023 11:07:37 -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 122e913e5c33ba76; Mon, 30 Jan 2023 20:07:36 +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 35ED32528287; Mon, 30 Jan 2023 20:07:35 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Zhang Rui , Srinivas Pandruvada , Linux ACPI , LKML , David Box Subject: [PATCH v1 2/8] thermal: intel: intel_pch: Eliminate redundant return pointers Date: Mon, 30 Jan 2023 19:59:48 +0100 Message-ID: <1847763.CQOukoFCf9@kreacher> In-Reply-To: <1751684.VLH7GnMWUR@kreacher> References: <1751684.VLH7GnMWUR@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: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdho rhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrvhhiugdrvgdrsghogieslhhinhhugidrihhnthgvlhdrtghomh 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?1756475776840460546?= X-GMAIL-MSGID: =?utf-8?q?1756475776840460546?= From: Rafael J. Wysocki Both pch_wpt_init() and pch_wpt_get_temp() can return the proper result via their return values, so they do not need to use return pointers. Modify them accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano Acked-by: Daniel Lezcano --- drivers/thermal/intel/intel_pch_thermal.c | 40 +++++++++++++----------------- 1 file changed, 18 insertions(+), 22 deletions(-) Index: linux-pm/drivers/thermal/intel/intel_pch_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_pch_thermal.c +++ linux-pm/drivers/thermal/intel/intel_pch_thermal.c @@ -118,12 +118,11 @@ static int pch_wpt_add_acpi_psv_trip(str } #endif -static int pch_wpt_init(struct pch_thermal_device *ptd, int *nr_trips) +static int pch_wpt_init(struct pch_thermal_device *ptd) { - u8 tsel; + int nr_trips = 0; u16 trip_temp; - - *nr_trips = 0; + u8 tsel; /* Check if BIOS has already enabled thermal sensor */ if (WPT_TSEL_ETS & readb(ptd->hw_base + WPT_TSEL)) { @@ -151,29 +150,23 @@ read_trips: trip_temp = readw(ptd->hw_base + WPT_CTT); trip_temp &= 0x1FF; if (trip_temp) { - ptd->trips[*nr_trips].temperature = GET_WPT_TEMP(trip_temp); - ptd->trips[*nr_trips].type = THERMAL_TRIP_CRITICAL; - ++(*nr_trips); + ptd->trips[nr_trips].temperature = GET_WPT_TEMP(trip_temp); + ptd->trips[nr_trips++].type = THERMAL_TRIP_CRITICAL; } trip_temp = readw(ptd->hw_base + WPT_PHL); trip_temp &= 0x1FF; if (trip_temp) { - ptd->trips[*nr_trips].temperature = GET_WPT_TEMP(trip_temp); - ptd->trips[*nr_trips].type = THERMAL_TRIP_HOT; - ++(*nr_trips); + ptd->trips[nr_trips].temperature = GET_WPT_TEMP(trip_temp); + ptd->trips[nr_trips++].type = THERMAL_TRIP_HOT; } - *nr_trips += pch_wpt_add_acpi_psv_trip(ptd, *nr_trips); - - return 0; + return nr_trips + pch_wpt_add_acpi_psv_trip(ptd, nr_trips); } -static int pch_wpt_get_temp(struct pch_thermal_device *ptd, int *temp) +static int pch_wpt_get_temp(struct pch_thermal_device *ptd) { - *temp = GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); - - return 0; + return GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); } /* Cool the PCH when it's overheat in .suspend_noirq phase */ @@ -259,8 +252,8 @@ static int pch_wpt_resume(struct pch_the } struct pch_dev_ops { - int (*hw_init)(struct pch_thermal_device *ptd, int *nr_trips); - int (*get_temp)(struct pch_thermal_device *ptd, int *temp); + int (*hw_init)(struct pch_thermal_device *ptd); + int (*get_temp)(struct pch_thermal_device *ptd); int (*suspend)(struct pch_thermal_device *ptd); int (*resume)(struct pch_thermal_device *ptd); }; @@ -278,7 +271,8 @@ static int pch_thermal_get_temp(struct t { struct pch_thermal_device *ptd = tzd->devdata; - return ptd->ops->get_temp(ptd, temp); + *temp = ptd->ops->get_temp(ptd); + return 0; } static void pch_critical(struct thermal_zone_device *tzd) @@ -372,9 +366,11 @@ static int intel_pch_thermal_probe(struc goto error_release; } - err = ptd->ops->hw_init(ptd, &nr_trips); - if (err) + nr_trips = ptd->ops->hw_init(ptd); + if (nr_trips < 0) { + err = nr_trips; goto error_cleanup; + } ptd->tzd = thermal_zone_device_register_with_trips(bi->name, ptd->trips, nr_trips, 0, ptd, From patchwork Mon Jan 30 19:00:48 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: 50434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2348958wrn; Mon, 30 Jan 2023 11:10:08 -0800 (PST) X-Google-Smtp-Source: AK7set8yOVERBZQbgCyYiEgQ+ICA3yYhLm/9KEmqIANcqa7ehTFSQKM/4j5Tsx2g70xTj+Ns2LEM X-Received: by 2002:a17:90a:1955:b0:22b:fcb6:c7cc with SMTP id 21-20020a17090a195500b0022bfcb6c7ccmr10358404pjh.29.1675105808603; Mon, 30 Jan 2023 11:10:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105808; cv=none; d=google.com; s=arc-20160816; b=o/c9ORgRmXRMYjKldxIfWBwTCilcD0ZOrVeQvxLzSXRXNEjldTb//Ht2NiL6WrpDNM 30bQaVrmCEIj9znQtdoV8fdS8emwIlDGFyZDXLdpCNWqe8prOYcgP54XW6qp0NhY35tK Y7OZPB5aoglRzYAIICWM0HOCw0I8W6TE197v2B5B4E1UNxvYzUiPe+tpnMKQ05L5u1YE NNx6fwG7xku1ZyT2NMwlmXSs2xKwapMQjvU1P1AfSzaRWjGFp5NnutfnkpitXOcPcSBq QTji8/DIPYcTv8Q62KrKRlRzjtuJoHZif2NLCjvnfB6ZIYf+C1m6C8IkPUf8s8jcQX1l n9sg== 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=ft96ccNEnylPgtnl69LwzBuw1P3ltt+FH8NXRxz6lio=; b=YusfjNwRFS2UGqxGurjKcbXNG8pGUi7z3yzaHb7fxP7bLfdCBkn/Uny6tPk14aOhvJ 14M65M6Jozc2PZDHGRi9dqhjnxJWyhe3vqF+kfXgvhiV3kYwadlvVOkn6yLIPypYz47Z j5AECOFbpv0+++srlqVYgK81Vf6S/KAGXOqRQIFq+m5HYvnvQ+CLPzcjUoknoUvHaCFy dH/iKrUKkzKuslny2Chz+k2TJKdkVI67tXSprZkKmoPVUiGFGMCrTi5W4HYsCyam5chz ZQP0z4rN5LV6SdKz+TmcYe8HjiivrzQ28Ap3D7jA2aYX3zr2WAmijXN7j+sxIQ9AXryV E9TA== 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 fu15-20020a17090ad18f00b0022bbae722fcsi19701099pjb.1.2023.01.30.11.09.56; Mon, 30 Jan 2023 11:10: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 S238260AbjA3THs (ORCPT + 99 others); Mon, 30 Jan 2023 14:07:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238142AbjA3THm (ORCPT ); Mon, 30 Jan 2023 14:07:42 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F2333A867; Mon, 30 Jan 2023 11:07:36 -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 f1e5e01fe10671b7; Mon, 30 Jan 2023 20:07:34 +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 9535D2528287; Mon, 30 Jan 2023 20:07:33 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Zhang Rui , Srinivas Pandruvada , Linux ACPI , LKML , David Box Subject: [PATCH v1 3/8] thermal: intel: intel_pch: Rename device operations callbacks Date: Mon, 30 Jan 2023 20:00:48 +0100 Message-ID: <2546853.Lt9SDvczpP@kreacher> In-Reply-To: <1751684.VLH7GnMWUR@kreacher> References: <1751684.VLH7GnMWUR@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: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdho rhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrvhhiugdrvgdrsghogieslhhinhhugidrihhnthgvlhdrtghomh 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?1756475748319709430?= X-GMAIL-MSGID: =?utf-8?q?1756475748319709430?= From: Rafael J. Wysocki Because the same device operations callbacks are used for all supported boards, they are in fact generic, so rename them to reflect that. Also rename the operations object itself for consistency. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano --- drivers/thermal/intel/intel_pch_thermal.c | 34 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 18 deletions(-) Index: linux-pm/drivers/thermal/intel/intel_pch_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_pch_thermal.c +++ linux-pm/drivers/thermal/intel/intel_pch_thermal.c @@ -118,7 +118,7 @@ static int pch_wpt_add_acpi_psv_trip(str } #endif -static int pch_wpt_init(struct pch_thermal_device *ptd) +static int pch_hw_init(struct pch_thermal_device *ptd) { int nr_trips = 0; u16 trip_temp; @@ -164,13 +164,13 @@ read_trips: return nr_trips + pch_wpt_add_acpi_psv_trip(ptd, nr_trips); } -static int pch_wpt_get_temp(struct pch_thermal_device *ptd) +static int pch_get_temp(struct pch_thermal_device *ptd) { return GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); } /* Cool the PCH when it's overheat in .suspend_noirq phase */ -static int pch_wpt_suspend(struct pch_thermal_device *ptd) +static int pch_suspend(struct pch_thermal_device *ptd) { u8 tsel; int pch_delay_cnt = 0; @@ -237,7 +237,7 @@ static int pch_wpt_suspend(struct pch_th return 0; } -static int pch_wpt_resume(struct pch_thermal_device *ptd) +static int pch_resume(struct pch_thermal_device *ptd) { u8 tsel; @@ -258,13 +258,11 @@ struct pch_dev_ops { int (*resume)(struct pch_thermal_device *ptd); }; - -/* dev ops for Wildcat Point */ -static const struct pch_dev_ops pch_dev_ops_wpt = { - .hw_init = pch_wpt_init, - .get_temp = pch_wpt_get_temp, - .suspend = pch_wpt_suspend, - .resume = pch_wpt_resume, +static const struct pch_dev_ops pch_dev_ops = { + .hw_init = pch_hw_init, + .get_temp = pch_get_temp, + .suspend = pch_suspend, + .resume = pch_resume, }; static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp) @@ -301,31 +299,31 @@ static const struct board_info { } board_info[] = { [board_hsw] = { .name = "pch_haswell", - .ops = &pch_dev_ops_wpt, + .ops = &pch_dev_ops, }, [board_wpt] = { .name = "pch_wildcat_point", - .ops = &pch_dev_ops_wpt, + .ops = &pch_dev_ops, }, [board_skl] = { .name = "pch_skylake", - .ops = &pch_dev_ops_wpt, + .ops = &pch_dev_ops, }, [board_cnl] = { .name = "pch_cannonlake", - .ops = &pch_dev_ops_wpt, + .ops = &pch_dev_ops, }, [board_cml] = { .name = "pch_cometlake", - .ops = &pch_dev_ops_wpt, + .ops = &pch_dev_ops, }, [board_lwb] = { .name = "pch_lewisburg", - .ops = &pch_dev_ops_wpt, + .ops = &pch_dev_ops, }, [board_wbg] = { .name = "pch_wellsburg", - .ops = &pch_dev_ops_wpt, + .ops = &pch_dev_ops, }, }; From patchwork Mon Jan 30 19:02:19 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: 50435 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2349023wrn; Mon, 30 Jan 2023 11:10:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXvFjpo37o8KD2wg/WCye23QLWFiB423yC2xCo0SSlWFrg1IUScVINrF+jvWayvi3Wb8kWFC X-Received: by 2002:a05:6402:e9c:b0:47e:eaae:9a69 with SMTP id h28-20020a0564020e9c00b0047eeaae9a69mr54373423eda.41.1675105817344; Mon, 30 Jan 2023 11:10:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105817; cv=none; d=google.com; s=arc-20160816; b=BEFDBmIYlS0OiEpzhNJuOuV9pAUNXxJIcm60Mh/Ns0VEOxn2iMFdmS9SFKSAsoAbby OvUUisvvsyVp8LS5QBtXoWCVuIInASzfZXgjZVhPHMFaKlyIQci+j86EFjgCsVN5yEcR Sp9uqgXsNYjDQeJTZY7Xw65PeTQCoP/ymcVK4x001C67VuIT71n4sh4XQAm43q3Xdp7r PmqCIAEW5GH8OuSax0L7xzkdaHvclXnbfg+AJEeSO4SCCSJ9QZzd02ov1KfAvAHbTZwG aBhZjrg0zdKQNPc1aqh6moZ3F1eQ9zTBGQuHafdToCGBC/jyxVGZOyw05e4Kmq87YKST qKlA== 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=cBvnI8INOzk9cwEph+kAf3uiSDQHjB7ndqvW6GHZ7fg=; b=Y9ZV+JCHjWGK00y+YlvI70M04u6D6uV11OSyDDIG9O/uzuWFNV1reOyRW/ZF/xG79+ cSTBq+2GYc5y82Wt0Xb+TAJDGX26zk/inW5Kt9cjURlaUiUo7vQkzBccqBDgbCeXbtZv qcedg0pIvAD3yfW71JEbT+wr7ReKBJR6DQY3/S197iAhJn1yYOFuIrj64juAqUEzXjJn Lxy8oFLoW8Bzb9zve9H3piJ3eHlaT8BZ7I3VH4zGJ5LCTDmszpLV5sPjQyVbRCMW54qf Et8maDfonnYm66VBhmkdOIb2/ZnQyxQarvfoHtWmGe3KzTpzeLFK2a6Ic96Q8gzl02F2 DrJw== 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 ew4-20020a170907950400b0087bd3d1f8dfsi12164922ejc.477.2023.01.30.11.09.54; Mon, 30 Jan 2023 11:10:17 -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 S238177AbjA3THq (ORCPT + 99 others); Mon, 30 Jan 2023 14:07:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238028AbjA3THg (ORCPT ); Mon, 30 Jan 2023 14:07:36 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C297A39CF7; Mon, 30 Jan 2023 11:07:34 -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 198d550b42cf78cc; Mon, 30 Jan 2023 20:07:32 +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 03D332528287; Mon, 30 Jan 2023 20:07:31 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Zhang Rui , Srinivas Pandruvada , Linux ACPI , LKML , David Box Subject: [PATCH v1 4/8] thermal: intel: intel_pch: Eliminate device operations object Date: Mon, 30 Jan 2023 20:02:19 +0100 Message-ID: <2141577.Mh6RI2rZIc@kreacher> In-Reply-To: <1751684.VLH7GnMWUR@kreacher> References: <1751684.VLH7GnMWUR@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: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdho rhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrvhhiugdrvgdrsghogieslhhinhhugidrihhnthgvlhdrtghomh 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?1756475757633845344?= X-GMAIL-MSGID: =?utf-8?q?1756475757633845344?= From: Rafael J. Wysocki The same device operations object is pointed to by all of the board configurations in the driver, so effectively the same operations callbacks are used by all of them which only adds overhead (that can be significant due to retpolines) for no real purpose. For this reason, drop the device operations object and replace the respective callback invocations by direct calls to the specific functions that were previously pointed to by callback pointers. No intentional change in behavior. Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano --- drivers/thermal/intel/intel_pch_thermal.c | 33 +++--------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) Index: linux-pm/drivers/thermal/intel/intel_pch_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_pch_thermal.c +++ linux-pm/drivers/thermal/intel/intel_pch_thermal.c @@ -82,7 +82,6 @@ static char driver_name[] = "Intel PCH t struct pch_thermal_device { void __iomem *hw_base; - const struct pch_dev_ops *ops; struct pci_dev *pdev; struct thermal_zone_device *tzd; struct thermal_trip trips[PCH_MAX_TRIPS]; @@ -251,25 +250,11 @@ static int pch_resume(struct pch_thermal return 0; } -struct pch_dev_ops { - int (*hw_init)(struct pch_thermal_device *ptd); - int (*get_temp)(struct pch_thermal_device *ptd); - int (*suspend)(struct pch_thermal_device *ptd); - int (*resume)(struct pch_thermal_device *ptd); -}; - -static const struct pch_dev_ops pch_dev_ops = { - .hw_init = pch_hw_init, - .get_temp = pch_get_temp, - .suspend = pch_suspend, - .resume = pch_resume, -}; - static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp) { struct pch_thermal_device *ptd = tzd->devdata; - *temp = ptd->ops->get_temp(ptd); + *temp = pch_get_temp(ptd); return 0; } @@ -295,35 +280,27 @@ enum board_ids { static const struct board_info { const char *name; - const struct pch_dev_ops *ops; } board_info[] = { [board_hsw] = { .name = "pch_haswell", - .ops = &pch_dev_ops, }, [board_wpt] = { .name = "pch_wildcat_point", - .ops = &pch_dev_ops, }, [board_skl] = { .name = "pch_skylake", - .ops = &pch_dev_ops, }, [board_cnl] = { .name = "pch_cannonlake", - .ops = &pch_dev_ops, }, [board_cml] = { .name = "pch_cometlake", - .ops = &pch_dev_ops, }, [board_lwb] = { .name = "pch_lewisburg", - .ops = &pch_dev_ops, }, [board_wbg] = { .name = "pch_wellsburg", - .ops = &pch_dev_ops, }, }; @@ -340,8 +317,6 @@ static int intel_pch_thermal_probe(struc if (!ptd) return -ENOMEM; - ptd->ops = bi->ops; - pci_set_drvdata(pdev, ptd); ptd->pdev = pdev; @@ -364,7 +339,7 @@ static int intel_pch_thermal_probe(struc goto error_release; } - nr_trips = ptd->ops->hw_init(ptd); + nr_trips = pch_hw_init(ptd); if (nr_trips < 0) { err = nr_trips; goto error_cleanup; @@ -412,14 +387,14 @@ static int intel_pch_thermal_suspend_noi { struct pch_thermal_device *ptd = dev_get_drvdata(device); - return ptd->ops->suspend(ptd); + return pch_suspend(ptd); } static int intel_pch_thermal_resume(struct device *device) { struct pch_thermal_device *ptd = dev_get_drvdata(device); - return ptd->ops->resume(ptd); + return pch_resume(ptd); } static const struct pci_device_id intel_pch_thermal_id[] = { From patchwork Mon Jan 30 19:03:11 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: 50432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2348730wrn; Mon, 30 Jan 2023 11:09:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXvGNfnbu2SBv2LOrv9LizG9RfQhsMlTPLxBcI/44lG+TLzoVaH/QVkY4aP0pZuCtf5jlOXe X-Received: by 2002:a05:6a20:c198:b0:b8:ca86:d1e8 with SMTP id bg24-20020a056a20c19800b000b8ca86d1e8mr57171337pzb.14.1675105776271; Mon, 30 Jan 2023 11:09:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105776; cv=none; d=google.com; s=arc-20160816; b=vg43DixDr0A3ibAMrjSE/iS24YQvwPKRgLniB0YYwIV4iRDYMcCoZYzxlXADf+ma45 plkRPz9/YxMeBZ/sEZ1HOjiRosw/TiHvGwFz8RxrJTvC2bOEpTNvfLyurjwjFV9Ypxdw 7oXmEe/fAOjpCkooAeuREwQNMd38kV+k66U1jXLuPHO4ypxW4rqoVFES9czhnpktjtlB R8nTCsIgokGXi22/su3nIns5B3phjgZ5nmPJ5sPyz76idaUbW4tsAkVwZzhefoXoi2Cy I41q4fYMscB5ViK9oy6FCSnSXt2X/ma6B1oq7W+6dgH1NG98a35jHrDfRZs4L7EfL+vR OQTA== 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=suAiXHFT++hwJ0GQ2mEvUXDPvh206oPYUv1xaqiydVM=; b=EtlDVvkiTbbQifexMgduXceiLqoXG8dWOX7d1U+rQZSnIcsqX9RWbJNQ2wA+ESIhU9 IN5Wigp0p1v+Uyx4V913gXi54bDydlNrAeJ9QH1DAKuvW1O2C+6jzWyM1Zpx52a+36qz aWAN+UZzLtKAuXxByGHBWUCnQ7pXsd+RkavY1XoSer9r81M/Men4ElK4nJyvZX9QJVZj U3l/aTKX9VYvDlM0ZiupQwtpBcm/MMqaEhTU9R9av8QkwzvAIXs53pxQlL1XGS5CtmpG I0PcTOv/xOeXsxByLYSAm6p/wcTsM9ownjf+5hkDl2q5S+tgz2uE1g5Qkxby/vWW6A4F Ah3Q== 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 h191-20020a636cc8000000b004e2da688d23si9345908pgc.534.2023.01.30.11.09.23; Mon, 30 Jan 2023 11:09:36 -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 S238083AbjA3THo (ORCPT + 99 others); Mon, 30 Jan 2023 14:07:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238103AbjA3THe (ORCPT ); Mon, 30 Jan 2023 14:07:34 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47A9838B62; Mon, 30 Jan 2023 11:07:33 -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 6014c07e825ce42e; Mon, 30 Jan 2023 20:07:31 +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 A943F2528287; Mon, 30 Jan 2023 20:07:30 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Zhang Rui , Srinivas Pandruvada , Linux ACPI , LKML , David Box Subject: [PATCH v1 5/8] thermal: intel: intel_pch: Fold two functions into their callers Date: Mon, 30 Jan 2023 20:03:11 +0100 Message-ID: <3662399.MHq7AAxBmi@kreacher> In-Reply-To: <1751684.VLH7GnMWUR@kreacher> References: <1751684.VLH7GnMWUR@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: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdho rhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrvhhiugdrvgdrsghogieslhhinhhugidrihhnthgvlhdrtghomh 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?1756475714313527325?= X-GMAIL-MSGID: =?utf-8?q?1756475714313527325?= From: Rafael J. Wysocki Fold two functions, pch_hw_init() and pch_get_temp(), that each have only one caller, into their respective callers to make the code somewhat easier to follow. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano --- drivers/thermal/intel/intel_pch_thermal.c | 98 ++++++++++++------------------ 1 file changed, 42 insertions(+), 56 deletions(-) Index: linux-pm/drivers/thermal/intel/intel_pch_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_pch_thermal.c +++ linux-pm/drivers/thermal/intel/intel_pch_thermal.c @@ -117,57 +117,6 @@ static int pch_wpt_add_acpi_psv_trip(str } #endif -static int pch_hw_init(struct pch_thermal_device *ptd) -{ - int nr_trips = 0; - u16 trip_temp; - u8 tsel; - - /* Check if BIOS has already enabled thermal sensor */ - if (WPT_TSEL_ETS & readb(ptd->hw_base + WPT_TSEL)) { - ptd->bios_enabled = true; - goto read_trips; - } - - tsel = readb(ptd->hw_base + WPT_TSEL); - /* - * When TSEL's Policy Lock-Down bit is 1, TSEL become RO. - * If so, thermal sensor cannot enable. Bail out. - */ - if (tsel & WPT_TSEL_PLDB) { - dev_err(&ptd->pdev->dev, "Sensor can't be enabled\n"); - return -ENODEV; - } - - writeb(tsel|WPT_TSEL_ETS, ptd->hw_base + WPT_TSEL); - if (!(WPT_TSEL_ETS & readb(ptd->hw_base + WPT_TSEL))) { - dev_err(&ptd->pdev->dev, "Sensor can't be enabled\n"); - return -ENODEV; - } - -read_trips: - trip_temp = readw(ptd->hw_base + WPT_CTT); - trip_temp &= 0x1FF; - if (trip_temp) { - ptd->trips[nr_trips].temperature = GET_WPT_TEMP(trip_temp); - ptd->trips[nr_trips++].type = THERMAL_TRIP_CRITICAL; - } - - trip_temp = readw(ptd->hw_base + WPT_PHL); - trip_temp &= 0x1FF; - if (trip_temp) { - ptd->trips[nr_trips].temperature = GET_WPT_TEMP(trip_temp); - ptd->trips[nr_trips++].type = THERMAL_TRIP_HOT; - } - - return nr_trips + pch_wpt_add_acpi_psv_trip(ptd, nr_trips); -} - -static int pch_get_temp(struct pch_thermal_device *ptd) -{ - return GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); -} - /* Cool the PCH when it's overheat in .suspend_noirq phase */ static int pch_suspend(struct pch_thermal_device *ptd) { @@ -254,7 +203,7 @@ static int pch_thermal_get_temp(struct t { struct pch_thermal_device *ptd = tzd->devdata; - *temp = pch_get_temp(ptd); + *temp = GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); return 0; } @@ -310,8 +259,10 @@ static int intel_pch_thermal_probe(struc enum board_ids board_id = id->driver_data; const struct board_info *bi = &board_info[board_id]; struct pch_thermal_device *ptd; - int err; + u16 trip_temp; int nr_trips; + u8 tsel; + int err; ptd = devm_kzalloc(&pdev->dev, sizeof(*ptd), GFP_KERNEL); if (!ptd) @@ -339,12 +290,47 @@ static int intel_pch_thermal_probe(struc goto error_release; } - nr_trips = pch_hw_init(ptd); - if (nr_trips < 0) { - err = nr_trips; + /* Check if BIOS has already enabled thermal sensor */ + if (WPT_TSEL_ETS & readb(ptd->hw_base + WPT_TSEL)) { + ptd->bios_enabled = true; + goto read_trips; + } + + tsel = readb(ptd->hw_base + WPT_TSEL); + /* + * When TSEL's Policy Lock-Down bit is 1, TSEL become RO. + * If so, thermal sensor cannot enable. Bail out. + */ + if (tsel & WPT_TSEL_PLDB) { + dev_err(&ptd->pdev->dev, "Sensor can't be enabled\n"); + err = -ENODEV; goto error_cleanup; } + writeb(tsel|WPT_TSEL_ETS, ptd->hw_base + WPT_TSEL); + if (!(WPT_TSEL_ETS & readb(ptd->hw_base + WPT_TSEL))) { + dev_err(&ptd->pdev->dev, "Sensor can't be enabled\n"); + err = -ENODEV; + goto error_cleanup; + } + +read_trips: + trip_temp = readw(ptd->hw_base + WPT_CTT); + trip_temp &= 0x1FF; + if (trip_temp) { + ptd->trips[nr_trips].temperature = GET_WPT_TEMP(trip_temp); + ptd->trips[nr_trips++].type = THERMAL_TRIP_CRITICAL; + } + + trip_temp = readw(ptd->hw_base + WPT_PHL); + trip_temp &= 0x1FF; + if (trip_temp) { + ptd->trips[nr_trips].temperature = GET_WPT_TEMP(trip_temp); + ptd->trips[nr_trips++].type = THERMAL_TRIP_HOT; + } + + nr_trips += pch_wpt_add_acpi_psv_trip(ptd, nr_trips); + ptd->tzd = thermal_zone_device_register_with_trips(bi->name, ptd->trips, nr_trips, 0, ptd, &tzd_ops, NULL, 0, 0); From patchwork Mon Jan 30 19:04:05 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: 50431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2348665wrn; Mon, 30 Jan 2023 11:09:27 -0800 (PST) X-Google-Smtp-Source: AK7set8SzrABzkvtvkC+hJTpXlszI5iolYaUy70xKTkaPCel2dt7FfSf0S+wP4GxN0wqut648wGT X-Received: by 2002:a05:6a20:3c8d:b0:be:cbee:ed9d with SMTP id b13-20020a056a203c8d00b000becbeeed9dmr617926pzj.45.1675105766820; Mon, 30 Jan 2023 11:09:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105766; cv=none; d=google.com; s=arc-20160816; b=yoSxZUiB+I3Tk1OlW43l7FTINIqIjVEwJ/rMiYBoqnaejrme5m/2Ja9XvF8sxfiVox pX65dYQGT8egsTXxRWt87zfB/Fp7JDk0FnWqzpClbf7M7tyc54q3EOjzprpZFQFk6E7k wM+Rml6+WmS2E0wR83GXoTPzsfZW0taD++7ajPkWfS4ukZlLzWjL6CS4Fj0NN8f7LH6b qY3t4soeSz8iFUAy2RRnoipJQbX6PkuFhInt+4lwrwseK0BylWr1RImiN77R1CgI4kZn m8QGOxWOdlnH21tI/QwaE7EwOUHfsbrMKjoc2ReMs1mfITPWaViJZxz2hVyPJdFFpEl5 undw== 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=4G68T9hQZQc0S3XbzZDTlptiKmOfai5qd5g1HYFrz6g=; b=RQOva30oFwcNJkot92msj4vsdsgdxy2uuYxQHudr4UnQ2nvm6zulDr+wqXiFhQ29BZ jrpgcvfx7xtrwrxj7+lTJHAqoYkH7D7m+qeDZUbqRsriPLm/Jz/IRTKpg60DEsxm5zo4 7+nff06guULsxseL9yTboUnAN6GNguxjhtstnBgAE+uYeVDHWpZ0ehj86gSUUJ064/jO Dk/k3b/8eEkLxia6o0y7Sdm4NsrcnGrmBqnEjFQh19jxKKQEYLz8JrCWCNj43r6fiqra iVvxwbazvux2Gnz5gt7kqSfXPq01bHjfkd06SE8Ftbgij8lKMxqTvkJLANF2jgBXDC+T NpeA== 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.09.13; Mon, 30 Jan 2023 11:09:26 -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 S238133AbjA3THh (ORCPT + 99 others); Mon, 30 Jan 2023 14:07:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238083AbjA3THd (ORCPT ); Mon, 30 Jan 2023 14:07:33 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9695B38666; Mon, 30 Jan 2023 11:07:31 -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 38ad90d73f134747; Mon, 30 Jan 2023 20:07:29 +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 016D22528287; Mon, 30 Jan 2023 20:07:28 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Zhang Rui , Srinivas Pandruvada , Linux ACPI , LKML , David Box Subject: [PATCH v1 6/8] thermal: intel: intel_pch: Fold suspend and resume routines into their callers Date: Mon, 30 Jan 2023 20:04:05 +0100 Message-ID: <1817848.atdPhlSkOF@kreacher> In-Reply-To: <1751684.VLH7GnMWUR@kreacher> References: <1751684.VLH7GnMWUR@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: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdho rhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrvhhiugdrvgdrsghogieslhhinhhugidrihhnthgvlhdrtghomh 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?1756475704249486131?= X-GMAIL-MSGID: =?utf-8?q?1756475704249486131?= From: Rafael J. Wysocki Fold pch_suspend() and pch_resume(), that each have only one caller, into their respective callers to make the code somewhat easier to follow. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano --- drivers/thermal/intel/intel_pch_thermal.c | 155 +++++++++++++----------------- 1 file changed, 71 insertions(+), 84 deletions(-) Index: linux-pm/drivers/thermal/intel/intel_pch_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_pch_thermal.c +++ linux-pm/drivers/thermal/intel/intel_pch_thermal.c @@ -117,88 +117,6 @@ static int pch_wpt_add_acpi_psv_trip(str } #endif -/* Cool the PCH when it's overheat in .suspend_noirq phase */ -static int pch_suspend(struct pch_thermal_device *ptd) -{ - u8 tsel; - int pch_delay_cnt = 0; - u16 pch_thr_temp, pch_cur_temp; - - /* Shutdown the thermal sensor if it is not enabled by BIOS */ - if (!ptd->bios_enabled) { - tsel = readb(ptd->hw_base + WPT_TSEL); - writeb(tsel & 0xFE, ptd->hw_base + WPT_TSEL); - return 0; - } - - /* Do not check temperature if it is not s2idle */ - if (pm_suspend_via_firmware()) - return 0; - - /* Get the PCH temperature threshold value */ - pch_thr_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TSPM)); - - /* Get the PCH current temperature value */ - pch_cur_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); - - /* - * If current PCH temperature is higher than configured PCH threshold - * value, run some delay loop with sleep to let the current temperature - * go down below the threshold value which helps to allow system enter - * lower power S0ix suspend state. Even after delay loop if PCH current - * temperature stays above threshold, notify the warning message - * which helps to indentify the reason why S0ix entry was rejected. - */ - while (pch_delay_cnt < delay_cnt) { - if (pch_cur_temp < pch_thr_temp) - break; - - if (pm_wakeup_pending()) { - dev_warn(&ptd->pdev->dev, "Wakeup event detected, abort cooling\n"); - return 0; - } - - pch_delay_cnt++; - dev_dbg(&ptd->pdev->dev, - "CPU-PCH current temp [%dC] higher than the threshold temp [%dC], sleep %d times for %d ms duration\n", - pch_cur_temp, pch_thr_temp, pch_delay_cnt, delay_timeout); - msleep(delay_timeout); - /* Read the PCH current temperature for next cycle. */ - pch_cur_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); - } - - if (pch_cur_temp >= pch_thr_temp) - dev_warn(&ptd->pdev->dev, - "CPU-PCH is hot [%dC] after %d ms delay. S0ix might fail\n", - pch_cur_temp, pch_delay_cnt * delay_timeout); - else { - if (pch_delay_cnt) - dev_info(&ptd->pdev->dev, - "CPU-PCH is cool [%dC] after %d ms delay\n", - pch_cur_temp, pch_delay_cnt * delay_timeout); - else - dev_info(&ptd->pdev->dev, - "CPU-PCH is cool [%dC]\n", - pch_cur_temp); - } - - return 0; -} - -static int pch_resume(struct pch_thermal_device *ptd) -{ - u8 tsel; - - if (ptd->bios_enabled) - return 0; - - tsel = readb(ptd->hw_base + WPT_TSEL); - - writeb(tsel | WPT_TSEL_ETS, ptd->hw_base + WPT_TSEL); - - return 0; -} - static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp) { struct pch_thermal_device *ptd = tzd->devdata; @@ -372,15 +290,84 @@ static void intel_pch_thermal_remove(str static int intel_pch_thermal_suspend_noirq(struct device *device) { struct pch_thermal_device *ptd = dev_get_drvdata(device); + u16 pch_thr_temp, pch_cur_temp; + int pch_delay_cnt = 0; + u8 tsel; + + /* Shutdown the thermal sensor if it is not enabled by BIOS */ + if (!ptd->bios_enabled) { + tsel = readb(ptd->hw_base + WPT_TSEL); + writeb(tsel & 0xFE, ptd->hw_base + WPT_TSEL); + return 0; + } + + /* Do not check temperature if it is not s2idle */ + if (pm_suspend_via_firmware()) + return 0; + + /* Get the PCH temperature threshold value */ + pch_thr_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TSPM)); + + /* Get the PCH current temperature value */ + pch_cur_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); - return pch_suspend(ptd); + /* + * If current PCH temperature is higher than configured PCH threshold + * value, run some delay loop with sleep to let the current temperature + * go down below the threshold value which helps to allow system enter + * lower power S0ix suspend state. Even after delay loop if PCH current + * temperature stays above threshold, notify the warning message + * which helps to indentify the reason why S0ix entry was rejected. + */ + while (pch_delay_cnt < delay_cnt) { + if (pch_cur_temp < pch_thr_temp) + break; + + if (pm_wakeup_pending()) { + dev_warn(&ptd->pdev->dev, "Wakeup event detected, abort cooling\n"); + return 0; + } + + pch_delay_cnt++; + dev_dbg(&ptd->pdev->dev, + "CPU-PCH current temp [%dC] higher than the threshold temp [%dC], sleep %d times for %d ms duration\n", + pch_cur_temp, pch_thr_temp, pch_delay_cnt, delay_timeout); + msleep(delay_timeout); + /* Read the PCH current temperature for next cycle. */ + pch_cur_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); + } + + if (pch_cur_temp >= pch_thr_temp) + dev_warn(&ptd->pdev->dev, + "CPU-PCH is hot [%dC] after %d ms delay. S0ix might fail\n", + pch_cur_temp, pch_delay_cnt * delay_timeout); + else { + if (pch_delay_cnt) + dev_info(&ptd->pdev->dev, + "CPU-PCH is cool [%dC] after %d ms delay\n", + pch_cur_temp, pch_delay_cnt * delay_timeout); + else + dev_info(&ptd->pdev->dev, + "CPU-PCH is cool [%dC]\n", + pch_cur_temp); + } + + return 0; } static int intel_pch_thermal_resume(struct device *device) { struct pch_thermal_device *ptd = dev_get_drvdata(device); + u8 tsel; - return pch_resume(ptd); + if (ptd->bios_enabled) + return 0; + + tsel = readb(ptd->hw_base + WPT_TSEL); + + writeb(tsel | WPT_TSEL_ETS, ptd->hw_base + WPT_TSEL); + + return 0; } static const struct pci_device_id intel_pch_thermal_id[] = { From patchwork Mon Jan 30 19:04:55 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: 50430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2348622wrn; Mon, 30 Jan 2023 11:09:19 -0800 (PST) X-Google-Smtp-Source: AK7set/umPuGADTPeHk8+HKL3eSdMQEBvM70/RyUMcRJOrYkyn6TKStZOACrwbPPIgCD1iW/10a4 X-Received: by 2002:a17:902:ec8c:b0:196:8c61:656 with SMTP id x12-20020a170902ec8c00b001968c610656mr3838207plg.30.1675105759390; Mon, 30 Jan 2023 11:09:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105759; cv=none; d=google.com; s=arc-20160816; b=dlb7GD9hkmyGd+x0j3iBUy7A7l5Ae7ex/b0P3ihJyAIRSSo/sg6FlRzq9QYsYEuuGp lZmFiOIFCoxqYqYiFOY276hloWgfd2WC7cd/0N/apcFPuEFLeGYPYyKpXrMF88fDXSts fe08fFnq/6jB2CFdaKjMtFvemk+MzGda9Jq40olF/Vgtm15kfHrASfTTlT4XXRkWcttC uliZLckvlLIDDmGBPEKnJrJptl2UpM75p9Wz9nZX2rC/nYvYSOAem9UCaDmhgDhyx/Eq 4CtntS5t7fwJMhMl17pc3PTmXkHKg0rGlCA8Huj4BvacrsIsWpoyVJYGeiF1ak3piq0N KKkQ== 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=qO18DFXqsvqXtBg/rt6J+pRUuOS4WElVjD91RD4j9yg=; b=N0FyG7epLC3drm/ljeBJEqv2Kf/jwAzko6mcet8IZFNrHQfBZYcIdWooeaU3qmKDHA eb6mws9kMLGlZpj6T9ePiWDMYs32zp99SqrFJHr5uIB0p/ff5ks8UG1/lD2rNAmcCpSO 1LcsFg3ypK1Vt6ITbmGuRmS61md8nFH4snFCOW/+JmeWAS77KxqbxfYGlok0tdjeVGq4 oMIaK71vDHNy0sXmOUEHV9xQ7Xo4P3+CdiFSxmsosPQe4noHcLo10TH0cXhOwv1g9xP8 Mbxq6+sHDPCQ10xWzWoQt2VmxWl8IZVaDY+d6u0AUXSV4h6wLhnRSfyXrjiA1we+tmuX IJGw== 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 l18-20020a170902d05200b001964122ab23si12207102pll.49.2023.01.30.11.09.07; Mon, 30 Jan 2023 11:09:19 -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 S238085AbjA3THf (ORCPT + 99 others); Mon, 30 Jan 2023 14:07:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238028AbjA3THc (ORCPT ); Mon, 30 Jan 2023 14:07:32 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FA933800F; Mon, 30 Jan 2023 11:07:29 -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 9fd19c7a651f5ead; Mon, 30 Jan 2023 20:07:28 +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 851A12528287; Mon, 30 Jan 2023 20:07:27 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Zhang Rui , Srinivas Pandruvada , Linux ACPI , LKML , David Box Subject: [PATCH v1 7/8] thermal: intel: intel_pch: Rename board ID symbols Date: Mon, 30 Jan 2023 20:04:55 +0100 Message-ID: <2144306.Icojqenx9y@kreacher> In-Reply-To: <1751684.VLH7GnMWUR@kreacher> References: <1751684.VLH7GnMWUR@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: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddvvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdho rhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrvhhiugdrvgdrsghogieslhhinhhugidrihhnthgvlhdrtghomh 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?1756475697039210512?= X-GMAIL-MSGID: =?utf-8?q?1756475697039210512?= From: Rafael J. Wysocki Use capitals in the names of the board ID symbols and add the PCH_ prefix to each of them for consistency. Also rename the board_ids enum accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano --- drivers/thermal/intel/intel_pch_thermal.c | 54 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) Index: linux-pm/drivers/thermal/intel/intel_pch_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_pch_thermal.c +++ linux-pm/drivers/thermal/intel/intel_pch_thermal.c @@ -135,38 +135,38 @@ static struct thermal_zone_device_ops tz .critical = pch_critical, }; -enum board_ids { - board_hsw, - board_wpt, - board_skl, - board_cnl, - board_cml, - board_lwb, - board_wbg, +enum pch_board_ids { + PCH_BOARD_HSW = 0, + PCH_BOARD_WPT, + PCH_BOARD_SKL, + PCH_BOARD_CNL, + PCH_BOARD_CML, + PCH_BOARD_LWB, + PCH_BOARD_WBG, }; static const struct board_info { const char *name; } board_info[] = { - [board_hsw] = { + [PCH_BOARD_HSW] = { .name = "pch_haswell", }, - [board_wpt] = { + [PCH_BOARD_WPT] = { .name = "pch_wildcat_point", }, - [board_skl] = { + [PCH_BOARD_SKL] = { .name = "pch_skylake", }, - [board_cnl] = { + [PCH_BOARD_CNL] = { .name = "pch_cannonlake", }, - [board_cml] = { + [PCH_BOARD_CML] = { .name = "pch_cometlake", }, - [board_lwb] = { + [PCH_BOARD_LWB] = { .name = "pch_lewisburg", }, - [board_wbg] = { + [PCH_BOARD_WBG] = { .name = "pch_wellsburg", }, }; @@ -174,7 +174,7 @@ static const struct board_info { static int intel_pch_thermal_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - enum board_ids board_id = id->driver_data; + enum pch_board_ids board_id = id->driver_data; const struct board_info *bi = &board_info[board_id]; struct pch_thermal_device *ptd; u16 trip_temp; @@ -372,27 +372,27 @@ static int intel_pch_thermal_resume(stru static const struct pci_device_id intel_pch_thermal_id[] = { { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_HSW_1), - .driver_data = board_hsw, }, + .driver_data = PCH_BOARD_HSW, }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_HSW_2), - .driver_data = board_hsw, }, + .driver_data = PCH_BOARD_HSW, }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_WPT), - .driver_data = board_wpt, }, + .driver_data = PCH_BOARD_WPT, }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_SKL), - .driver_data = board_skl, }, + .driver_data = PCH_BOARD_SKL, }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_SKL_H), - .driver_data = board_skl, }, + .driver_data = PCH_BOARD_SKL, }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_CNL), - .driver_data = board_cnl, }, + .driver_data = PCH_BOARD_CNL, }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_CNL_H), - .driver_data = board_cnl, }, + .driver_data = PCH_BOARD_CNL, }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_CNL_LP), - .driver_data = board_cnl, }, + .driver_data = PCH_BOARD_CNL, }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_CML_H), - .driver_data = board_cml, }, + .driver_data = PCH_BOARD_CML, }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_LWB), - .driver_data = board_lwb, }, + .driver_data = PCH_BOARD_LWB, }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_WBG), - .driver_data = board_wbg, }, + .driver_data = PCH_BOARD_WBG, }, { 0, }, }; MODULE_DEVICE_TABLE(pci, intel_pch_thermal_id); From patchwork Mon Jan 30 19:07: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: 50429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2348523wrn; Mon, 30 Jan 2023 11:09:10 -0800 (PST) X-Google-Smtp-Source: AK7set/by5mYgJ2a5NwcX0/Oy4DCFoqpCo9d9YhZteRRS+9KIpJtcsKJ17sunWg30EhEJdeItaeV X-Received: by 2002:a17:90b:388a:b0:22c:305b:9503 with SMTP id mu10-20020a17090b388a00b0022c305b9503mr17136025pjb.41.1675105750112; Mon, 30 Jan 2023 11:09:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675105750; cv=none; d=google.com; s=arc-20160816; b=OmwL0o70/T9kwNYheSeEEj3lOxo1qWJ5awVRf4I/J7pUCjVcMBCEfSoEIP6A6NSD/W ynphD7QISz6uWUChCzrq/4U0UK4IFi7anBKKqa44ipc31loA6Tk4J3YJtxkMRTzplRRR 1QvvLScLkieVKjd1xeyrRzjiHgOaDCRsdjl0XYg4CgitUov5kpINzvAAgL8kNFePo6oI t33dJLJtJuolJcmP51CobIbO6WgjJcwsDoRNJvqMYYuOVL1tIZ/J5bo4Fr4lmBy9RSKQ P+b034Ztw29m/8dUQxkR1dLAeTnS1J1r1j7xJ8tJIf8083VqmoXn9IZumSJh4HiZUojb qR/g== 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=0DA6vh0+GjoXhrdHgtvGbC9TbSwT4m7WTRyu+ru3VmU=; b=OMsqj+Pv/2xoj0A/1r6xATBPD+4ekntzc2SQAe076htxpTNwfsRfo8UWobelgeNLwP yFRZrJRui7p8/oHgdk2Oho4uFBDc7mTAZRR+5FvmzKJUv13k4JLJSgMkeJCRnmK2nO5N H3HuvziPTLEBodQsypF6SQ+B7iPDl+oxxqAQV3r4nP1PE9pgLmnaWoR+N4aEAb0mxy8T EA/e3dN4rMX6rARmeWoHwN/Ax/Ywohxo08jG1eG5eXnkh31aDsr/me7aXYtqxJlZaWr5 t0yI88cuPZxu28woza5MNzPn4d2fCZD/ABzQbjFV7mQvrFK+1lNrHFkyKsNfBeB6GRqb HbQQ== 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 lb18-20020a17090b4a5200b0022c35527521si14945651pjb.20.2023.01.30.11.08.58; Mon, 30 Jan 2023 11:09:10 -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 S238045AbjA3THc (ORCPT + 99 others); Mon, 30 Jan 2023 14:07:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236432AbjA3THa (ORCPT ); Mon, 30 Jan 2023 14:07:30 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A397538B5C; Mon, 30 Jan 2023 11:07:28 -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 e536acd3fe07cf94; Mon, 30 Jan 2023 20:07:26 +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 246EA2528287; Mon, 30 Jan 2023 20:07:26 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM , Srinivas Pandruvada Cc: Zhang Rui , Linux ACPI , LKML , David Box Subject: [PATCH v1 8/8] thermal: intel: intel_pch: Refer to thermal zone name directly Date: Mon, 30 Jan 2023 20:07:17 +0100 Message-ID: <837557782.0ifERbkFSE@kreacher> In-Reply-To: <1751684.VLH7GnMWUR@kreacher> References: <1751684.VLH7GnMWUR@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: gggruggvucftvghtrhhoucdtuddrgedvhedrudefvddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepvddufedrudefgedrudeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduuddvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdho rhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrvhhiugdrvgdrsghogieslhhinhhugidrihhnthgvlhdrtghomh 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?1756475687274232523?= X-GMAIL-MSGID: =?utf-8?q?1756475687274232523?= From: Rafael J. Wysocki Make intel_pch_thermal_probe() use a const char pointer instead of a struct board_info one for accessing the thermal zone name. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Acked-by: Daniel Lezcano --- BTW, Srinivas, I'm wondering if user space would be terribly confused by changing this driver to use "Intel PCH" as the thermal zone name of all of the supported platforms? --- drivers/thermal/intel/intel_pch_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: linux-pm/drivers/thermal/intel/intel_pch_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_pch_thermal.c +++ linux-pm/drivers/thermal/intel/intel_pch_thermal.c @@ -175,7 +175,7 @@ static int intel_pch_thermal_probe(struc const struct pci_device_id *id) { enum pch_board_ids board_id = id->driver_data; - const struct board_info *bi = &board_info[board_id]; + const char *zone_name = board_info[board_id].name; struct pch_thermal_device *ptd; u16 trip_temp; int nr_trips; @@ -249,12 +249,12 @@ read_trips: nr_trips += pch_wpt_add_acpi_psv_trip(ptd, nr_trips); - ptd->tzd = thermal_zone_device_register_with_trips(bi->name, ptd->trips, + ptd->tzd = thermal_zone_device_register_with_trips(zone_name, ptd->trips, nr_trips, 0, ptd, &tzd_ops, NULL, 0, 0); if (IS_ERR(ptd->tzd)) { dev_err(&pdev->dev, "Failed to register thermal zone %s\n", - bi->name); + zone_name); err = PTR_ERR(ptd->tzd); goto error_cleanup; }