From patchwork Tue Jan 30 11:12:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537302 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F99BC48285 for ; Tue, 30 Jan 2024 11:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JMbgGjuO+H9H5DNG/35E9CbWxKtYfml7/iEP+47445M=; b=QwQ4p+T3aCNsre 6LwWdTL4tBU9dhogdjvZh+aOCvkZTfzkjI+In2ih2kpF5ymR2DocTYx5M+qDYwk3/Hk1mBQY0IHVM THO19LIgfyOA453M/gKLSEHDHN2ZiMPFrYXV6go5JRwSUZXdt7DaWkDtQcQnXr+8U120RO7rdu+En Bft1Ykk9SU4TfRdU/xVcmvd5QSf8c6tRzRDv9II1SvBAPR4Yz8FORazN1XrCISdRbSB4dfWgVBjSz D913s5hy+p/E9hw+XIwPuPFYjEpkc19eeI5e66QTTZ/aIyKqaOjdFtjNct4wBlASRZ5nf90YI2vPO m8kURyN5fBnw3Y8hjEwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3U-0000000GMAr-3W9B; Tue, 30 Jan 2024 11:13:29 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3G-0000000GM2v-35ID for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613192; bh=NMhqSFdRSjNI1p1vyp5dOffkk1ADZ0MeWiy+ifEvnrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qt0nsFEZO5QpPc8PT9E0Lm/cgu375vY8D/mR9k7Z3W1Wv+myVR0nC/5GsZAjx1uOg IOPezeLBWscheyDiOgrc/qZAVxW2SIrVUutDo7DZ63z9zUaXkaOq4XWiQV+cYY6Cb/ a6gCdWmh3IEA5qY5GYnH3bdWQBTID73s0OeKIN3eC0naUOfwNSfz1+7Gn+mzXamZZ1 LbYglX3oHMZWJBash/KF827A8A2VN09xGuA48AaHftWY8fjbotKGMviiOHH6Ui9Wl9 +4O3dOIUxOrUpnxr2lKSbzRngscGghNZAZQNMEs9YlAtIaUx9luxx0GphbKNcEdKnI Xff/+eqNdXpPA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id F116F37811F4; Tue, 30 Jan 2024 11:13:09 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 01/18] thermal: core: Change governor name to const char pointer Date: Tue, 30 Jan 2024 12:12:33 +0100 Message-ID: <20240130111250.185718-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031314_948101_D5822D27 X-CRM114-Status: GOOD ( 12.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org All users are already assigning a const char * to the `governor_name` member of struct thermal_zone_params and to the `name` member of struct thermal_governor. Even if users are technically wrong, it just makes more sense to change this member to be a const char pointer instead of doing the other way around. Signed-off-by: AngeloGioacchino Del Regno Acked-by: Rafael J. Wysocki --- include/linux/thermal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/thermal.h b/include/linux/thermal.h index b7a3deb372fd..65d8f92a9a0d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -214,7 +214,7 @@ struct thermal_zone_device { * @governor_list: node in thermal_governor_list (in thermal_core.c) */ struct thermal_governor { - char name[THERMAL_NAME_LENGTH]; + const char *name; int (*bind_to_tz)(struct thermal_zone_device *tz); void (*unbind_from_tz)(struct thermal_zone_device *tz); int (*throttle)(struct thermal_zone_device *tz, @@ -226,7 +226,7 @@ struct thermal_governor { /* Structure to define Thermal Zone parameters */ struct thermal_zone_params { - char governor_name[THERMAL_NAME_LENGTH]; + const char *governor_name; /* * a boolean to indicate if the thermal to hwmon sysfs interface From patchwork Tue Jan 30 11:12:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32F0DC46CD2 for ; Tue, 30 Jan 2024 11:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=a+NeoP/PSbTLvDBcwT0mEzwnOTDmMRa5Ry2gssFzkvE=; b=1qEjakUdnR8De7 l3FxzFWyLfrmjbWPFfWbjLaV/wN6gEBVrRXfjPH0ycU/hRg7by8ISkPLlzXeE6Gd6p3ZzQKa+D9mH Ek3NAtaujbxJF4FTv3N+UHjhpEokPgbzBdZq2BFHlS+IYVl7vvZe9ghE+WACErb21BnHOeKgv5LYh ipdP4upZE6gv4KXLIcILN8KJbz7LsRJllBogvG3bIfG1AJ/Mzjt8yjTGK80bOtGmRUzJTkwzYMqV0 OjvCAzYuJ4pToteqG0IsTVHoqsWQnbbD3G1D5e2tjv9qMSkhANRZAtXR3oTxrD6qMB3araKA6BdLd mbxOCCcVcEyP1EERoSwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3W-0000000GMBm-3SdS; Tue, 30 Jan 2024 11:13:31 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3H-0000000GM40-1n9J for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613194; bh=B2pHEkbuVDb5/8B80P9qFpRxNFIT7wXDUKIRSMeB/Vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O3Woz7M2rLFcx5Pnq4AJNqKWkGCiAcvY2Nb/QkqsuCYaNgNuHB54iWwzKBchwcorN sVMIiF2DCGRlSG4agxfZtOm2eUtl48dxNAr0+A/E/SGzZ2KgLzj7dQ3Pg1RzvFKlT4 o7uBszLU7gNQeoaqe9wHaVRlGkg86nge2RePt64U+jzKGjK8cVwchBgNFMjKP163AP ymLASSBShA3CRjyewlafPhtPELwWcWjv5SyP8a94J6TpGBTzLh2SMCniQOQhidwHPb DedX2rEaXOb+C9zaAaKoKJ0BVU8MnhwdXBL4aIDtltl4f3ovlTRUmjGGs8oa08a2GT ZOqWNMU0hsNyw== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 35B55378208A; Tue, 30 Jan 2024 11:13:12 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 02/18] thermal: Add new structures and thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:34 +0100 Message-ID: <20240130111250.185718-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031315_803733_80F6C748 X-CRM114-Status: GOOD ( 29.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In preparation for extending the thermal zone devices to actually have a name and disambiguate thermal zone types/names, and to do a reorganization in thermal_zone_device, add some new Thermal Zone structures: Introduce new thermal_governor_params, thermal_zone_platform_params and thermal_zone_device_params structures which are meant to hold the parameters for thermal zone registration and, in the future, to stop having a catch-all thermal_zone_device structure. While at it, also add a new thermal_zone_device_register() function which uses the new structure(s) for registration; the now old functions thermal_tripless_zone_device_register() and thermal_zone_device_register_with_trips() are now advertised as being deprecated and changed to instead act as wrappers around the new thermal_zone_device_register(). Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/gov_power_allocator.c | 38 +++---- drivers/thermal/qcom/tsens.c | 4 +- drivers/thermal/thermal_core.c | 146 ++++++++++++++++++-------- drivers/thermal/thermal_helpers.c | 8 +- drivers/thermal/thermal_sysfs.c | 16 +-- include/linux/thermal.h | 73 +++++++++++-- 6 files changed, 202 insertions(+), 83 deletions(-) diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c index 81e061f183ad..3efbc60cd148 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -167,14 +167,14 @@ static void estimate_pid_constants(struct thermal_zone_device *tz, if (!temperature_threshold) return; - tz->tzp->k_po = int_to_frac(sustainable_power) / + tz->tgp->ipa_params.k_po = int_to_frac(sustainable_power) / temperature_threshold; - tz->tzp->k_pu = int_to_frac(2 * sustainable_power) / + tz->tgp->ipa_params.k_pu = int_to_frac(2 * sustainable_power) / temperature_threshold; - k_i = tz->tzp->k_pu / 10; - tz->tzp->k_i = k_i > 0 ? k_i : 1; + k_i = tz->tgp->ipa_params.k_pu / 10; + tz->tgp->ipa_params.k_i = k_i > 0 ? k_i : 1; /* * The default for k_d and integral_cutoff is 0, so we can @@ -199,10 +199,10 @@ static u32 get_sustainable_power(struct thermal_zone_device *tz, { u32 sustainable_power; - if (!tz->tzp->sustainable_power) + if (!tz->tgp->ipa_params.sustainable_power) sustainable_power = estimate_sustainable_power(tz); else - sustainable_power = tz->tzp->sustainable_power; + sustainable_power = tz->tgp->ipa_params.sustainable_power; /* Check if it's init value 0 or there was update via sysfs */ if (sustainable_power != params->sustainable_power) { @@ -210,7 +210,7 @@ static u32 get_sustainable_power(struct thermal_zone_device *tz, params->trip_switch_on, control_temp); /* Do the estimation only once and make available in sysfs */ - tz->tzp->sustainable_power = sustainable_power; + tz->tgp->ipa_params.sustainable_power = sustainable_power; params->sustainable_power = sustainable_power; } @@ -252,7 +252,7 @@ static u32 pid_controller(struct thermal_zone_device *tz, err = int_to_frac(err); /* Calculate the proportional term */ - p = mul_frac(err < 0 ? tz->tzp->k_po : tz->tzp->k_pu, err); + p = mul_frac(err < 0 ? tz->tgp->ipa_params.k_po : tz->tgp->ipa_params.k_pu, err); /* * Calculate the integral term @@ -260,10 +260,10 @@ static u32 pid_controller(struct thermal_zone_device *tz, * if the error is less than cut off allow integration (but * the integral is limited to max power) */ - i = mul_frac(tz->tzp->k_i, params->err_integral); + i = mul_frac(tz->tgp->ipa_params.k_i, params->err_integral); - if (err < int_to_frac(tz->tzp->integral_cutoff)) { - s64 i_next = i + mul_frac(tz->tzp->k_i, err); + if (err < int_to_frac(tz->tgp->ipa_params.integral_cutoff)) { + s64 i_next = i + mul_frac(tz->tgp->ipa_params.k_i, err); if (abs(i_next) < max_power_frac) { i = i_next; @@ -278,7 +278,7 @@ static u32 pid_controller(struct thermal_zone_device *tz, * error (i.e. driving closer to the line) results in less * power being applied, slowing down the controller) */ - d = mul_frac(tz->tzp->k_d, err - params->prev_err); + d = mul_frac(tz->tgp->ipa_params.k_d, err - params->prev_err); d = div_frac(d, jiffies_to_msecs(tz->passive_delay_jiffies)); params->prev_err = err; @@ -699,9 +699,9 @@ static int power_allocator_bind(struct thermal_zone_device *tz) return ret; } - if (!tz->tzp) { - tz->tzp = kzalloc(sizeof(*tz->tzp), GFP_KERNEL); - if (!tz->tzp) { + if (!tz->tgp) { + tz->tgp = kzalloc(sizeof(*tz->tgp), GFP_KERNEL); + if (!tz->tgp) { ret = -ENOMEM; goto free_params; } @@ -709,10 +709,10 @@ static int power_allocator_bind(struct thermal_zone_device *tz) params->allocated_tzp = true; } - if (!tz->tzp->sustainable_power) + if (!tz->tgp->ipa_params.sustainable_power) dev_warn(&tz->device, "power_allocator: sustainable_power will be estimated\n"); - estimate_pid_constants(tz, tz->tzp->sustainable_power, + estimate_pid_constants(tz, tz->tgp->ipa_params.sustainable_power, params->trip_switch_on, params->trip_max->temperature); @@ -736,8 +736,8 @@ static void power_allocator_unbind(struct thermal_zone_device *tz) dev_dbg(&tz->device, "Unbinding from thermal zone %d\n", tz->id); if (params->allocated_tzp) { - kfree(tz->tzp); - tz->tzp = NULL; + kfree(tz->tgp); + tz->tgp = NULL; } kfree(params->power); diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 6d7c16ccb44d..9eddac93d683 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -252,8 +252,8 @@ int tsens_read_calibration_legacy(struct tsens_priv *priv, /* * Use this function on devices where slope and offset calculations * depend on calibration data read from qfprom. On others the slope - * and offset values are derived from tz->tzp->slope and tz->tzp->offset - * resp. + * and offset values are derived from tz->tgp->ipa_params.slope and + * tz->tgp->ipa_params.offset resp. */ void compute_intercept_slope(struct tsens_priv *priv, u32 *p1, u32 *p2, u32 mode) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index dfaa6341694a..3150475b947f 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -141,13 +141,13 @@ int thermal_register_governor(struct thermal_governor *governor) list_for_each_entry(pos, &thermal_tz_list, node) { /* - * only thermal zones with specified tz->tzp->governor_name + * only thermal zones with specified tz->tgp->governor_name * may run with tz->govenor unset */ if (pos->governor) continue; - name = pos->tzp->governor_name; + name = pos->tgp->governor_name; if (!strncasecmp(name, governor->name, THERMAL_NAME_LENGTH)) { int ret; @@ -1261,6 +1261,8 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_crit_temp); * whether trip points have been crossed (0 for interrupt * driven systems) * + * This function is deprecated. See thermal_zone_device_register(). + * * This interface function adds a new thermal zone device (sensor) to * /sys/class/thermal folder as thermal_zone[0-*]. It tries to bind all the * thermal cooling devices registered at the same time. @@ -1277,19 +1279,80 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t const struct thermal_zone_params *tzp, int passive_delay, int polling_delay) { + struct thermal_zone_device_params tzdp = { + /* Thermal Zone Platform parameters */ + .tzp = { + .type = type, + .ops = ops, + .trips = trips, + .num_trips = num_trips, + .mask = mask, + .passive_delay = passive_delay, + .polling_delay = polling_delay, + .devdata = devdata + }, + }; struct thermal_zone_device *tz; + + /* Thermal Zone Governor parameters */ + if (tzp) { + tzdp.tgp = kzalloc(sizeof(*tzdp.tgp), GFP_KERNEL); + if (!tzdp.tgp) + return ERR_PTR(-ENOMEM); + + tzdp.tgp->governor_name = tzp->governor_name; + tzdp.tzp.no_hwmon = tzp->no_hwmon; + memcpy(&tzdp.tgp->ipa_params, tzp, sizeof(*tzp)); + } + + tz = thermal_zone_device_register(&tzdp); + kfree(tzdp.tgp); + return tz; +} +EXPORT_SYMBOL_GPL(thermal_zone_device_register_with_trips); + +/* This function is deprecated. See thermal_zone_device_register(). */ +struct thermal_zone_device *thermal_tripless_zone_device_register( + const char *type, + void *devdata, + struct thermal_zone_device_ops *ops, + const struct thermal_zone_params *tzp) +{ + return thermal_zone_device_register_with_trips(type, NULL, 0, 0, devdata, + ops, tzp, 0, 0); +} +EXPORT_SYMBOL_GPL(thermal_tripless_zone_device_register); + +/** + * thermal_zone_device_register() - register a new thermal zone device + * @tzdp: Parameters of the new thermal zone device + * See struct thermal_zone_device_register. + * + * This interface function adds a new thermal zone device (sensor) to + * /sys/class/thermal folder as thermal_zone[0-*]. It tries to bind all the + * thermal cooling devices registered at the same time. + * thermal_zone_device_unregister() must be called when the device is no + * longer needed. The passive cooling depends on the .get_trend() return value. + * + * Return: a pointer to the created struct thermal_zone_device or an + * in case of error, an ERR_PTR. Caller must check return value with + * IS_ERR*() helpers. + */ +struct thermal_zone_device *thermal_zone_device_register(struct thermal_zone_device_params *tzdp) +{ + struct thermal_zone_device *tz; + struct thermal_governor *gov; int id; int result; - struct thermal_governor *governor; - if (!type || strlen(type) == 0) { + if (!tzdp->tzp.type || strlen(tzdp->tzp.type) == 0) { pr_err("No thermal zone type defined\n"); return ERR_PTR(-EINVAL); } - if (strlen(type) >= THERMAL_NAME_LENGTH) { + if (strlen(tzdp->tzp.type) >= THERMAL_NAME_LENGTH) { pr_err("Thermal zone name (%s) too long, should be under %d chars\n", - type, THERMAL_NAME_LENGTH); + tzdp->tzp.type, THERMAL_NAME_LENGTH); return ERR_PTR(-EINVAL); } @@ -1306,17 +1369,19 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t * Check will be true when the bit 31 of the mask is set. * 32 bit shift will cause overflow of 4 byte integer. */ - if (num_trips > (BITS_PER_TYPE(int) - 1) || num_trips < 0 || mask >> num_trips) { + if (tzdp->tzp.num_trips > (BITS_PER_TYPE(int) - 1) || + tzdp->tzp.num_trips < 0 || + tzdp->tzp.mask >> tzdp->tzp.num_trips) { pr_err("Incorrect number of thermal trips\n"); return ERR_PTR(-EINVAL); } - if (!ops || !ops->get_temp) { + if (!tzdp->tzp.ops || !tzdp->tzp.ops->get_temp) { pr_err("Thermal zone device ops not defined\n"); return ERR_PTR(-EINVAL); } - if (num_trips > 0 && !trips) + if (tzdp->tzp.num_trips > 0 && !tzdp->tzp.trips) return ERR_PTR(-EINVAL); if (!thermal_class) @@ -1326,11 +1391,17 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t if (!tz) return ERR_PTR(-ENOMEM); - if (tzp) { - tz->tzp = kmemdup(tzp, sizeof(*tzp), GFP_KERNEL); - if (!tz->tzp) { + tz->tzp = kmemdup(&tzdp->tzp, sizeof(tzdp->tzp), GFP_KERNEL); + if (!tz->tzp) { + result = -ENOMEM; + goto free_tz; + } + + if (tzdp->tgp) { + tz->tgp = kmemdup(tzdp->tgp, sizeof(*tzdp->tgp), GFP_KERNEL); + if (!tz->tgp) { result = -ENOMEM; - goto free_tz; + goto free_tzp; } } @@ -1342,27 +1413,27 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t id = ida_alloc(&thermal_tz_ida, GFP_KERNEL); if (id < 0) { result = id; - goto free_tzp; + goto free_tgp; } tz->id = id; - strscpy(tz->type, type, sizeof(tz->type)); + strscpy(tz->type, tzdp->tzp.type, sizeof(tz->type)); - if (!ops->critical) - ops->critical = thermal_zone_device_critical; + if (!tzdp->tzp.ops->critical) + tzdp->tzp.ops->critical = thermal_zone_device_critical; - tz->ops = ops; + tz->ops = tzdp->tzp.ops; tz->device.class = thermal_class; - tz->devdata = devdata; - tz->trips = trips; - tz->num_trips = num_trips; + tz->devdata = tzdp->tzp.devdata; + tz->trips = tzdp->tzp.trips; + tz->num_trips = tzdp->tzp.num_trips; - thermal_set_delay_jiffies(&tz->passive_delay_jiffies, passive_delay); - thermal_set_delay_jiffies(&tz->polling_delay_jiffies, polling_delay); + thermal_set_delay_jiffies(&tz->passive_delay_jiffies, tzdp->tzp.passive_delay); + thermal_set_delay_jiffies(&tz->polling_delay_jiffies, tzdp->tzp.polling_delay); /* sys I/F */ /* Add nodes that are always present via .groups */ - result = thermal_zone_create_device_groups(tz, mask); + result = thermal_zone_create_device_groups(tz, tzdp->tzp.mask); if (result) goto remove_id; @@ -1381,12 +1452,12 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t /* Update 'this' zone's governor information */ mutex_lock(&thermal_governor_lock); - if (tz->tzp) - governor = __find_governor(tz->tzp->governor_name); + if (tzdp->tgp) + gov = __find_governor(tzdp->tgp->governor_name); else - governor = def_governor; + gov = def_governor; - result = thermal_set_governor(tz, governor); + result = thermal_set_governor(tz, gov); if (result) { mutex_unlock(&thermal_governor_lock); goto unregister; @@ -1394,7 +1465,7 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t mutex_unlock(&thermal_governor_lock); - if (!tz->tzp || !tz->tzp->no_hwmon) { + if (!tzdp->tzp.no_hwmon) { result = thermal_add_hwmon_sysfs(tz); if (result) goto unregister; @@ -1426,24 +1497,15 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t put_device(&tz->device); remove_id: ida_free(&thermal_tz_ida, id); +free_tgp: + kfree(tz->tgp); free_tzp: kfree(tz->tzp); free_tz: kfree(tz); return ERR_PTR(result); } -EXPORT_SYMBOL_GPL(thermal_zone_device_register_with_trips); - -struct thermal_zone_device *thermal_tripless_zone_device_register( - const char *type, - void *devdata, - struct thermal_zone_device_ops *ops, - const struct thermal_zone_params *tzp) -{ - return thermal_zone_device_register_with_trips(type, NULL, 0, 0, devdata, - ops, tzp, 0, 0); -} -EXPORT_SYMBOL_GPL(thermal_tripless_zone_device_register); +EXPORT_SYMBOL_GPL(thermal_zone_device_register); void *thermal_zone_device_priv(struct thermal_zone_device *tzd) { @@ -1514,7 +1576,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) device_del(&tz->device); - kfree(tz->tzp); + kfree(tz->tgp); put_device(&tz->device); diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index 0329f4a71b02..a72095cfb771 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -211,8 +211,8 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev) */ int thermal_zone_get_slope(struct thermal_zone_device *tz) { - if (tz && tz->tzp) - return tz->tzp->slope; + if (tz && tz->tgp) + return tz->tgp->ipa_params.slope; return 1; } EXPORT_SYMBOL_GPL(thermal_zone_get_slope); @@ -226,8 +226,8 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_slope); */ int thermal_zone_get_offset(struct thermal_zone_device *tz) { - if (tz && tz->tzp) - return tz->tzp->offset; + if (tz && tz->tgp) + return tz->tgp->ipa_params.offset; return 0; } EXPORT_SYMBOL_GPL(thermal_zone_get_offset); diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index f4033865b093..3f5f4a04a754 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -271,8 +271,8 @@ sustainable_power_show(struct device *dev, struct device_attribute *devattr, { struct thermal_zone_device *tz = to_thermal_zone(dev); - if (tz->tzp) - return sprintf(buf, "%u\n", tz->tzp->sustainable_power); + if (tz->tgp) + return sprintf(buf, "%u\n", tz->tgp->ipa_params.sustainable_power); else return -EIO; } @@ -284,13 +284,13 @@ sustainable_power_store(struct device *dev, struct device_attribute *devattr, struct thermal_zone_device *tz = to_thermal_zone(dev); u32 sustainable_power; - if (!tz->tzp) + if (!tz->tgp) return -EIO; if (kstrtou32(buf, 10, &sustainable_power)) return -EINVAL; - tz->tzp->sustainable_power = sustainable_power; + tz->tgp->ipa_params.sustainable_power = sustainable_power; return count; } @@ -302,8 +302,8 @@ sustainable_power_store(struct device *dev, struct device_attribute *devattr, { \ struct thermal_zone_device *tz = to_thermal_zone(dev); \ \ - if (tz->tzp) \ - return sprintf(buf, "%d\n", tz->tzp->name); \ + if (tz->tgp) \ + return sprintf(buf, "%d\n", tz->tgp->ipa_params.name); \ else \ return -EIO; \ } \ @@ -315,13 +315,13 @@ sustainable_power_store(struct device *dev, struct device_attribute *devattr, struct thermal_zone_device *tz = to_thermal_zone(dev); \ s32 value; \ \ - if (!tz->tzp) \ + if (!tz->tgp) \ return -EIO; \ \ if (kstrtos32(buf, 10, &value)) \ return -EINVAL; \ \ - tz->tzp->name = value; \ + tz->tgp->ipa_params.name = value; \ \ return count; \ } \ diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 65d8f92a9a0d..7a540b746703 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -149,7 +149,8 @@ struct thermal_cooling_device { passive trip point. * @need_update: if equals 1, thermal_zone_device_update needs to be invoked. * @ops: operations this &thermal_zone_device supports - * @tzp: thermal zone parameters + * @tzp: Thermal zone parameters + * @tgp: Thermal zone governor parameters * @governor: pointer to the governor for this thermal zone * @governor_data: private pointer for governor data * @thermal_instances: list of &struct thermal_instance of this thermal zone @@ -184,7 +185,8 @@ struct thermal_zone_device { int prev_high_trip; atomic_t need_update; struct thermal_zone_device_ops *ops; - struct thermal_zone_params *tzp; + struct thermal_zone_platform_params *tzp; + struct thermal_governor_params *tgp; struct thermal_governor *governor; void *governor_data; struct list_head thermal_instances; @@ -224,15 +226,12 @@ struct thermal_governor { struct list_head governor_list; }; -/* Structure to define Thermal Zone parameters */ +/* Structure to define Thermal Zone IPA parameters */ struct thermal_zone_params { + /* Scheduled for removal - see struct thermal_governor_params. */ const char *governor_name; - /* - * a boolean to indicate if the thermal to hwmon sysfs interface - * is required. when no_hwmon == false, a hwmon sysfs interface - * will be created. when no_hwmon == true, nothing will be done - */ + /* Scheduled for removal - see struct thermal_zone_platform_params. */ bool no_hwmon; /* @@ -274,6 +273,58 @@ struct thermal_zone_params { int offset; }; +/** + * struct thermal_governor_params - Thermal Zone governor parameters + * @governor_name: Name of the Thermal Zone governor + * @ipa_params: IPA parameters for Thermal Zone governors + */ +struct thermal_governor_params { + const char *governor_name; + struct thermal_zone_params ipa_params; +}; + +/** + * struct thermal_zone_platform_params - Thermal Zone parameters + * @type: The thermal zone device type + * @ops: Standard thermal zone device callbacks + * @trips: Pointer to an array of thermal trips, if any + * @num_trips: Number of trip points the thermal zone support + * @mask: Bit string indicating the writeablility of trip points + * @passive_delay: Number of milliseconds to wait between polls when + * performing passive cooling + * @polling_delay: Number of milliseconds to wait between polls when checking + * whether trip points have been crossed (0 for interrupt + * driven systems) + * @devdata: Private device data + * @no_hwmon: Indicates whether the thermal to hwmon sysfs interface is + * required; this means that when no_hwmon == false, a hwmon + * sysfs interface will be created and when no_hwmon == true + * nothing will be done + */ +struct thermal_zone_platform_params { + const char *type; + struct thermal_zone_device_ops *ops; + struct thermal_trip *trips; + int num_trips; + int mask; + + int passive_delay; + int polling_delay; + + void *devdata; + bool no_hwmon; +}; + +/** + * struct thermal_zone_device_params - Thermal Zone device parameters + * @tzp: Thermal zone platform parameters + * @tgp: Thermal zone governor parameters + */ +struct thermal_zone_device_params { + struct thermal_zone_platform_params tzp; + struct thermal_governor_params *tgp; +}; + /* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *devm_thermal_of_zone_register(struct device *dev, int id, void *data, @@ -328,6 +379,8 @@ struct thermal_zone_device *thermal_tripless_zone_device_register( struct thermal_zone_device_ops *ops, const struct thermal_zone_params *tzp); +struct thermal_zone_device *thermal_zone_device_register(struct thermal_zone_device_params *tzdp); + void thermal_zone_device_unregister(struct thermal_zone_device *tz); void *thermal_zone_device_priv(struct thermal_zone_device *tzd); @@ -390,6 +443,10 @@ static inline struct thermal_zone_device *thermal_tripless_zone_device_register( const struct thermal_zone_params *tzp) { return ERR_PTR(-ENODEV); } +static inline struct thermal_zone_device *thermal_zone_device_register( + struct thermal_zone_device_params *tzdp) +{ return ERR_PTR(-ENODEV); } + static inline void thermal_zone_device_unregister(struct thermal_zone_device *tz) { } From patchwork Tue Jan 30 11:12:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2865DC46CD2 for ; Tue, 30 Jan 2024 11:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8PY1dMM0X8XwCVaEJjxwLWdajAQ6lxDCfzy1S4euBFw=; b=CN47cdK/5uUFNh DNiFhVXfMfH1UDcmeeFLuVI2MMIGoEdStOH5CKv6A0bvIITIimBk0smK0yYxanHv/ArhuXjJNtZvW 12fM346gHRkz1bLCYx+O5TBXiqedj7JMSrEbqSkt9dAoqWFBGUPjRL2CJTRPC8OGk5iSqtBpbBDVR SWbJfdQOzEGMOYBTeubFkj8JWmTpkfbX1sK+E0B/IpOJoqHDiP2wJ4ggTzdw1hPv4ps/u9rrlF5TX Cgw/Cnb6lepzwZIm6t4Aub5bJ9bh9sBbdMJXo+tToHzqAEq45HmJNiEvkxywotj3kM7sy1mgLExEw cJhKneQ+FFVzv2n3G+6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3g-0000000GMHH-0nxs; Tue, 30 Jan 2024 11:13:40 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3J-0000000GM55-2vAJ for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613196; bh=K9DIWCqRftNmAdLpTI5zlUjzjPBqeZyH/4bsZP2hZCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z9tPo+Z7eXCToDiRV5CgFUeD7VDvEgBUavru6Wjyv3bYY3CqzRuXhqFubn01Zg+pG ldrgAOOMyXzZZ0U8z3WbHXRRBPMT9Lsx0kPWyQKwZWJcY3xvegg4jj9/20tnloT03O IWhb9n4qixWGyLN25VoXy4m25qA8tTMTQwGAOsILnwR2rGRSmrpPzQ6ilraDwtOmC0 g6nCHVDVf6sa+qb/D77cFN7CBctxOrisV1MLZGRwlukCMkzdKi4BLVpH2QbwGaHs9z 7brVnKi0PrbmDLRiAKKHYAcNdGIB+5Isk0jxaJw327X4HUwzfzggEfEJeR1Jvs3vBj c6rkSk9IEMlNw== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 738AD378208C; Tue, 30 Jan 2024 11:13:14 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 03/18] thermal: Directly use thermal_zone_platform_params for thermal_zone_device Date: Tue, 30 Jan 2024 12:12:35 +0100 Message-ID: <20240130111250.185718-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031318_159050_17E3A3A8 X-CRM114-Status: GOOD ( 22.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Remove all duplicate members from thermal_zone_device and directly use the corresponding ones from struct thermal_zone_platform_params. Please note that this also changes thermal_zone_device's type member from char[THERMAL_NAME_LENGTH] to a const char *pointer, as the only reason for this to not be const was that thermal_core was performing a string copy operation, which is no more. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/gov_user_space.c | 2 +- drivers/thermal/thermal_core.c | 65 ++++++++++++++----------------- drivers/thermal/thermal_core.h | 6 ++- drivers/thermal/thermal_helpers.c | 14 +++---- drivers/thermal/thermal_hwmon.c | 8 ++-- drivers/thermal/thermal_of.c | 12 +++--- drivers/thermal/thermal_sysfs.c | 48 +++++++++++------------ drivers/thermal/thermal_trace.h | 8 ++-- drivers/thermal/thermal_trip.c | 14 +++---- include/linux/thermal.h | 10 ----- 10 files changed, 87 insertions(+), 100 deletions(-) diff --git a/drivers/thermal/gov_user_space.c b/drivers/thermal/gov_user_space.c index 7a1790b7e8f5..905f89f4aa4b 100644 --- a/drivers/thermal/gov_user_space.c +++ b/drivers/thermal/gov_user_space.c @@ -37,7 +37,7 @@ static int notify_user_space(struct thermal_zone_device *tz, lockdep_assert_held(&tz->lock); - thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", tz->type); + thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", tz->tzp->type); thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", tz->temperature); thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP=%d", thermal_zone_trip_id(tz, trip)); diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 3150475b947f..5694e2df158e 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -75,7 +75,7 @@ static void bind_previous_governor(struct thermal_zone_device *tz, if (tz->governor->bind_to_tz(tz)) { dev_err(&tz->device, "governor %s failed to bind and the previous one (%s) failed to bind again, thermal zone %s has no governor\n", - failed_gov_name, tz->governor->name, tz->type); + failed_gov_name, tz->governor->name, tz->tzp->type); tz->governor = NULL; } } @@ -156,7 +156,7 @@ int thermal_register_governor(struct thermal_governor *governor) if (ret) dev_err(&pos->device, "Failed to set governor %s for thermal zone %s: %d\n", - governor->name, pos->type, ret); + governor->name, pos->tzp->type, ret); } } @@ -327,7 +327,7 @@ static void thermal_zone_device_halt(struct thermal_zone_device *tz, bool shutdo int poweroff_delay_ms = CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS; const char *msg = "Temperature too high"; - dev_emerg(&tz->device, "%s: critical temperature reached\n", tz->type); + dev_emerg(&tz->device, "%s: critical temperature reached\n", tz->tzp->type); if (shutdown) hw_protection_shutdown(msg, poweroff_delay_ms); @@ -356,9 +356,9 @@ static void handle_critical_trips(struct thermal_zone_device *tz, trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, trip), trip->type); if (trip->type == THERMAL_TRIP_CRITICAL) - tz->ops->critical(tz); - else if (tz->ops->hot) - tz->ops->hot(tz); + tz->tzp->ops->critical(tz); + else if (tz->tzp->ops->hot) + tz->tzp->ops->hot(tz); } static void handle_thermal_trip(struct thermal_zone_device *tz, @@ -493,8 +493,8 @@ static int thermal_zone_device_set_mode(struct thermal_zone_device *tz, return ret; } - if (tz->ops->change_mode) - ret = tz->ops->change_mode(tz, mode); + if (tz->tzp->ops->change_mode) + ret = tz->tzp->ops->change_mode(tz, mode); if (!ret) tz->mode = mode; @@ -764,10 +764,10 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, unsigned long upper, unsigned long lower, unsigned int weight) { - if (trip_index < 0 || trip_index >= tz->num_trips) + if (trip_index < 0 || trip_index >= tz->tzp->num_trips) return -EINVAL; - return thermal_bind_cdev_to_trip(tz, &tz->trips[trip_index], cdev, + return thermal_bind_cdev_to_trip(tz, &tz->tzp->trips[trip_index], cdev, upper, lower, weight); } EXPORT_SYMBOL_GPL(thermal_zone_bind_cooling_device); @@ -823,10 +823,10 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, int trip_index, struct thermal_cooling_device *cdev) { - if (trip_index < 0 || trip_index >= tz->num_trips) + if (trip_index < 0 || trip_index >= tz->tzp->num_trips) return -EINVAL; - return thermal_unbind_cdev_from_trip(tz, &tz->trips[trip_index], cdev); + return thermal_unbind_cdev_from_trip(tz, &tz->tzp->trips[trip_index], cdev); } EXPORT_SYMBOL_GPL(thermal_zone_unbind_cooling_device); @@ -858,7 +858,7 @@ void print_bind_err_msg(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev, int ret) { dev_err(&tz->device, "binding zone %s with cdev %s failed:%d\n", - tz->type, cdev->type, ret); + tz->tzp->type, cdev->type, ret); } static void bind_cdev(struct thermal_cooling_device *cdev) @@ -867,8 +867,8 @@ static void bind_cdev(struct thermal_cooling_device *cdev) struct thermal_zone_device *pos = NULL; list_for_each_entry(pos, &thermal_tz_list, node) { - if (pos->ops->bind) { - ret = pos->ops->bind(pos, cdev); + if (pos->tzp->ops->bind) { + ret = pos->tzp->ops->bind(pos, cdev); if (ret) print_bind_err_msg(pos, cdev, ret); } @@ -1184,8 +1184,8 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) /* Unbind all thermal zones associated with 'this' cdev */ list_for_each_entry(tz, &thermal_tz_list, node) { - if (tz->ops->unbind) - tz->ops->unbind(tz, cdev); + if (tz->tzp->ops->unbind) + tz->tzp->ops->unbind(tz, cdev); } mutex_unlock(&thermal_list_lock); @@ -1199,13 +1199,13 @@ static void bind_tz(struct thermal_zone_device *tz) int ret; struct thermal_cooling_device *pos = NULL; - if (!tz->ops->bind) + if (!tz->tzp->ops->bind) return; mutex_lock(&thermal_list_lock); list_for_each_entry(pos, &thermal_cdev_list, node) { - ret = tz->ops->bind(tz, pos); + ret = tz->tzp->ops->bind(tz, pos); if (ret) print_bind_err_msg(tz, pos, ret); } @@ -1224,17 +1224,17 @@ int thermal_zone_get_crit_temp(struct thermal_zone_device *tz, int *temp) { int i, ret = -EINVAL; - if (tz->ops->get_crit_temp) - return tz->ops->get_crit_temp(tz, temp); + if (tz->tzp->ops->get_crit_temp) + return tz->tzp->ops->get_crit_temp(tz, temp); - if (!tz->trips) + if (!tz->tzp->trips) return -EINVAL; mutex_lock(&tz->lock); - for (i = 0; i < tz->num_trips; i++) { - if (tz->trips[i].type == THERMAL_TRIP_CRITICAL) { - *temp = tz->trips[i].temperature; + for (i = 0; i < tz->tzp->num_trips; i++) { + if (tz->tzp->trips[i].type == THERMAL_TRIP_CRITICAL) { + *temp = tz->tzp->trips[i].temperature; ret = 0; break; } @@ -1417,16 +1417,11 @@ struct thermal_zone_device *thermal_zone_device_register(struct thermal_zone_dev } tz->id = id; - strscpy(tz->type, tzdp->tzp.type, sizeof(tz->type)); if (!tzdp->tzp.ops->critical) tzdp->tzp.ops->critical = thermal_zone_device_critical; - tz->ops = tzdp->tzp.ops; tz->device.class = thermal_class; - tz->devdata = tzdp->tzp.devdata; - tz->trips = tzdp->tzp.trips; - tz->num_trips = tzdp->tzp.num_trips; thermal_set_delay_jiffies(&tz->passive_delay_jiffies, tzdp->tzp.passive_delay); thermal_set_delay_jiffies(&tz->polling_delay_jiffies, tzdp->tzp.polling_delay); @@ -1509,13 +1504,13 @@ EXPORT_SYMBOL_GPL(thermal_zone_device_register); void *thermal_zone_device_priv(struct thermal_zone_device *tzd) { - return tzd->devdata; + return tzd->tzp->devdata; } EXPORT_SYMBOL_GPL(thermal_zone_device_priv); const char *thermal_zone_device_type(struct thermal_zone_device *tzd) { - return tzd->type; + return tzd->tzp->type; } EXPORT_SYMBOL_GPL(thermal_zone_device_type); @@ -1561,8 +1556,8 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) /* Unbind all cdevs associated with 'this' thermal zone */ list_for_each_entry(cdev, &thermal_cdev_list, node) - if (tz->ops->unbind) - tz->ops->unbind(tz, cdev); + if (tz->tzp->ops->unbind) + tz->tzp->ops->unbind(tz, cdev); mutex_unlock(&thermal_list_lock); @@ -1607,7 +1602,7 @@ struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name) mutex_lock(&thermal_list_lock); list_for_each_entry(pos, &thermal_tz_list, node) - if (!strncasecmp(name, pos->type, THERMAL_NAME_LENGTH)) { + if (!strncasecmp(name, pos->tzp->type, THERMAL_NAME_LENGTH)) { found++; ref = pos; } diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index e9c099ecdd0f..b09c23a7a764 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -120,8 +120,10 @@ void thermal_governor_update_tz(struct thermal_zone_device *tz, enum thermal_notify_event reason); /* Helpers */ -#define for_each_trip(__tz, __trip) \ - for (__trip = __tz->trips; __trip - __tz->trips < __tz->num_trips; __trip++) +#define for_each_trip(__tz, __trip) \ + for (__trip = __tz->tzp->trips; \ + __trip - __tz->tzp->trips < __tz->tzp->num_trips; \ + __trip++) void __thermal_zone_set_trips(struct thermal_zone_device *tz); int thermal_zone_trip_id(const struct thermal_zone_device *tz, diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index a72095cfb771..f6d55ba853b5 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -26,8 +26,8 @@ int get_tz_trend(struct thermal_zone_device *tz, const struct thermal_trip *trip { enum thermal_trend trend; - if (tz->emul_temperature || !tz->ops->get_trend || - tz->ops->get_trend(tz, trip, &trend)) { + if (tz->emul_temperature || !tz->tzp->ops->get_trend || + tz->tzp->ops->get_trend(tz, trip, &trend)) { if (tz->temperature > tz->last_temperature) trend = THERMAL_TREND_RAISING; else if (tz->temperature < tz->last_temperature) @@ -50,7 +50,7 @@ get_thermal_instance(struct thermal_zone_device *tz, mutex_lock(&tz->lock); mutex_lock(&cdev->lock); - trip = &tz->trips[trip_index]; + trip = &tz->tzp->trips[trip_index]; list_for_each_entry(pos, &tz->thermal_instances, tz_node) { if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { @@ -74,8 +74,8 @@ EXPORT_SYMBOL(get_thermal_instance); * When a valid thermal zone reference is passed, it will fetch its * temperature and fill @temp. * - * Both tz and tz->ops must be valid pointers when calling this function, - * and the tz->ops->get_temp callback must be provided. + * Both tz and tz->tzp->ops must be valid pointers when calling this function, + * and the tz->tzp->ops->get_temp callback must be provided. * The function must be called under tz->lock. * * Return: On success returns 0, an error code otherwise @@ -88,7 +88,7 @@ int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) lockdep_assert_held(&tz->lock); - ret = tz->ops->get_temp(tz, temp); + ret = tz->tzp->ops->get_temp(tz, temp); if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) { for_each_trip(tz, trip) { @@ -132,7 +132,7 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) mutex_lock(&tz->lock); - if (!tz->ops->get_temp) { + if (!tz->tzp->ops->get_temp) { ret = -EINVAL; goto unlock; } diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index 252116f1e535..38edad3865f8 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -80,7 +80,7 @@ temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf) mutex_lock(&tz->lock); - ret = tz->ops->get_crit_temp(tz, &temperature); + ret = tz->tzp->ops->get_crit_temp(tz, &temperature); mutex_unlock(&tz->lock); @@ -99,7 +99,7 @@ thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz) mutex_lock(&thermal_hwmon_list_lock); list_for_each_entry(hwmon, &thermal_hwmon_list, node) { - strcpy(type, tz->type); + strcpy(type, tz->tzp->type); strreplace(type, '-', '_'); if (!strcmp(hwmon->type, type)) { mutex_unlock(&thermal_hwmon_list_lock); @@ -132,7 +132,7 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon, static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz) { int temp; - return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp); + return tz->tzp->ops->get_crit_temp && !tz->tzp->ops->get_crit_temp(tz, &temp); } int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) @@ -153,7 +153,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) return -ENOMEM; INIT_LIST_HEAD(&hwmon->tz_list); - strscpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH); + strscpy(hwmon->type, tz->tzp->type, THERMAL_NAME_LENGTH); strreplace(hwmon->type, '-', '_'); hwmon->device = hwmon_device_register_for_thermal(&tz->device, hwmon->type, hwmon); diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 4d6c22e0ed85..9f4c2c0cd7d8 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -274,7 +274,7 @@ static struct device_node *thermal_of_zone_get_by_name(struct thermal_zone_devic if (!np) return ERR_PTR(-ENODEV); - tz_np = of_get_child_by_name(np, tz->type); + tz_np = of_get_child_by_name(np, tz->tzp->type); of_node_put(np); @@ -310,7 +310,7 @@ static int __thermal_of_unbind(struct device_node *map_np, int index, int trip_i ret = thermal_zone_unbind_cooling_device(tz, trip_id, cdev); if (ret) - pr_err("Failed to unbind '%s' with '%s': %d\n", tz->type, cdev->type, ret); + pr_err("Failed to unbind '%s' with '%s': %d\n", tz->tzp->type, cdev->type, ret); return ret; } @@ -345,7 +345,7 @@ static int __thermal_of_bind(struct device_node *map_np, int index, int trip_id, cooling_spec.args[0], weight); if (ret) - pr_err("Failed to bind '%s' with '%s': %d\n", tz->type, cdev->type, ret); + pr_err("Failed to bind '%s' with '%s': %d\n", tz->tzp->type, cdev->type, ret); return ret; } @@ -438,8 +438,8 @@ static int thermal_of_unbind(struct thermal_zone_device *tz, */ static void thermal_of_zone_unregister(struct thermal_zone_device *tz) { - struct thermal_trip *trips = tz->trips; - struct thermal_zone_device_ops *ops = tz->ops; + struct thermal_trip *trips = tz->tzp->trips; + struct thermal_zone_device_ops *ops = tz->tzp->ops; thermal_zone_device_disable(tz); thermal_zone_device_unregister(tz); @@ -529,7 +529,7 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node * ret = thermal_zone_device_enable(tz); if (ret) { pr_err("Failed to enabled thermal zone '%s', id=%d: %d\n", - tz->type, tz->id, ret); + tz->tzp->type, tz->id, ret); thermal_of_zone_unregister(tz); return ERR_PTR(ret); } diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 3f5f4a04a754..87a20ced7864 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -28,7 +28,7 @@ type_show(struct device *dev, struct device_attribute *attr, char *buf) { struct thermal_zone_device *tz = to_thermal_zone(dev); - return sprintf(buf, "%s\n", tz->type); + return sprintf(buf, "%s\n", tz->tzp->type); } static ssize_t @@ -88,7 +88,7 @@ trip_point_type_show(struct device *dev, struct device_attribute *attr, if (sscanf(attr->attr.name, "trip_point_%d_type", &trip_id) != 1) return -EINVAL; - switch (tz->trips[trip_id].type) { + switch (tz->tzp->trips[trip_id].type) { case THERMAL_TRIP_CRITICAL: return sprintf(buf, "critical\n"); case THERMAL_TRIP_HOT: @@ -120,11 +120,11 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr, mutex_lock(&tz->lock); - trip = &tz->trips[trip_id]; + trip = &tz->tzp->trips[trip_id]; if (temp != trip->temperature) { - if (tz->ops->set_trip_temp) { - ret = tz->ops->set_trip_temp(tz, trip_id, temp); + if (tz->tzp->ops->set_trip_temp) { + ret = tz->tzp->ops->set_trip_temp(tz, trip_id, temp); if (ret) goto unlock; } @@ -150,7 +150,7 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr, if (sscanf(attr->attr.name, "trip_point_%d_temp", &trip_id) != 1) return -EINVAL; - return sprintf(buf, "%d\n", tz->trips[trip_id].temperature); + return sprintf(buf, "%d\n", tz->tzp->trips[trip_id].temperature); } static ssize_t @@ -171,11 +171,11 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr, mutex_lock(&tz->lock); - trip = &tz->trips[trip_id]; + trip = &tz->tzp->trips[trip_id]; if (hyst != trip->hysteresis) { - if (tz->ops->set_trip_hyst) { - ret = tz->ops->set_trip_hyst(tz, trip_id, hyst); + if (tz->tzp->ops->set_trip_hyst) { + ret = tz->tzp->ops->set_trip_hyst(tz, trip_id, hyst); if (ret) goto unlock; } @@ -201,7 +201,7 @@ trip_point_hyst_show(struct device *dev, struct device_attribute *attr, if (sscanf(attr->attr.name, "trip_point_%d_hyst", &trip_id) != 1) return -EINVAL; - return sprintf(buf, "%d\n", tz->trips[trip_id].hysteresis); + return sprintf(buf, "%d\n", tz->tzp->trips[trip_id].hysteresis); } static ssize_t @@ -250,10 +250,10 @@ emul_temp_store(struct device *dev, struct device_attribute *attr, mutex_lock(&tz->lock); - if (!tz->ops->set_emul_temp) + if (!tz->tzp->ops->set_emul_temp) tz->emul_temperature = temperature; else - ret = tz->ops->set_emul_temp(tz, temperature); + ret = tz->tzp->ops->set_emul_temp(tz, temperature); if (!ret) __thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); @@ -405,22 +405,22 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) int indx; /* This function works only for zones with at least one trip */ - if (tz->num_trips <= 0) + if (tz->tzp->num_trips <= 0) return -EINVAL; - tz->trip_type_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_type_attrs), + tz->trip_type_attrs = kcalloc(tz->tzp->num_trips, sizeof(*tz->trip_type_attrs), GFP_KERNEL); if (!tz->trip_type_attrs) return -ENOMEM; - tz->trip_temp_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_temp_attrs), + tz->trip_temp_attrs = kcalloc(tz->tzp->num_trips, sizeof(*tz->trip_temp_attrs), GFP_KERNEL); if (!tz->trip_temp_attrs) { kfree(tz->trip_type_attrs); return -ENOMEM; } - tz->trip_hyst_attrs = kcalloc(tz->num_trips, + tz->trip_hyst_attrs = kcalloc(tz->tzp->num_trips, sizeof(*tz->trip_hyst_attrs), GFP_KERNEL); if (!tz->trip_hyst_attrs) { @@ -429,7 +429,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) return -ENOMEM; } - attrs = kcalloc(tz->num_trips * 3 + 1, sizeof(*attrs), GFP_KERNEL); + attrs = kcalloc(tz->tzp->num_trips * 3 + 1, sizeof(*attrs), GFP_KERNEL); if (!attrs) { kfree(tz->trip_type_attrs); kfree(tz->trip_temp_attrs); @@ -437,7 +437,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) return -ENOMEM; } - for (indx = 0; indx < tz->num_trips; indx++) { + for (indx = 0; indx < tz->tzp->num_trips; indx++) { /* create trip type attribute */ snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH, "trip_point_%d_type", indx); @@ -464,7 +464,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) tz->trip_temp_attrs[indx].attr.store = trip_point_temp_store; } - attrs[indx + tz->num_trips] = &tz->trip_temp_attrs[indx].attr.attr; + attrs[indx + tz->tzp->num_trips] = &tz->trip_temp_attrs[indx].attr.attr; snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH, "trip_point_%d_hyst", indx); @@ -474,15 +474,15 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) tz->trip_hyst_attrs[indx].name; tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO; tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show; - if (tz->ops->set_trip_hyst) { + if (tz->tzp->ops->set_trip_hyst) { tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR; tz->trip_hyst_attrs[indx].attr.store = trip_point_hyst_store; } - attrs[indx + tz->num_trips * 2] = + attrs[indx + tz->tzp->num_trips * 2] = &tz->trip_hyst_attrs[indx].attr.attr; } - attrs[tz->num_trips * 3] = NULL; + attrs[tz->tzp->num_trips * 3] = NULL; tz->trips_attribute_group.attrs = attrs; @@ -522,7 +522,7 @@ int thermal_zone_create_device_groups(struct thermal_zone_device *tz, for (i = 0; i < size - 2; i++) groups[i] = thermal_zone_attribute_groups[i]; - if (tz->num_trips) { + if (tz->tzp->num_trips) { result = create_trip_attrs(tz, mask); if (result) { kfree(groups); @@ -543,7 +543,7 @@ void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz) if (!tz) return; - if (tz->num_trips) + if (tz->tzp->num_trips) destroy_trip_attrs(tz); kfree(tz->device.groups); diff --git a/drivers/thermal/thermal_trace.h b/drivers/thermal/thermal_trace.h index 459c8ce6cf3b..4bd8b0be4280 100644 --- a/drivers/thermal/thermal_trace.h +++ b/drivers/thermal/thermal_trace.h @@ -28,14 +28,14 @@ TRACE_EVENT(thermal_temperature, TP_ARGS(tz), TP_STRUCT__entry( - __string(thermal_zone, tz->type) + __string(thermal_zone, tz->tzp->type) __field(int, id) __field(int, temp_prev) __field(int, temp) ), TP_fast_assign( - __assign_str(thermal_zone, tz->type); + __assign_str(thermal_zone, tz->tzp->type); __entry->id = tz->id; __entry->temp_prev = tz->last_temperature; __entry->temp = tz->temperature; @@ -73,14 +73,14 @@ TRACE_EVENT(thermal_zone_trip, TP_ARGS(tz, trip, trip_type), TP_STRUCT__entry( - __string(thermal_zone, tz->type) + __string(thermal_zone, tz->tzp->type) __field(int, id) __field(int, trip) __field(enum thermal_trip_type, trip_type) ), TP_fast_assign( - __assign_str(thermal_zone, tz->type); + __assign_str(thermal_zone, tz->tzp->type); __entry->id = tz->id; __entry->trip = trip; __entry->trip_type = trip_type; diff --git a/drivers/thermal/thermal_trip.c b/drivers/thermal/thermal_trip.c index c875a26d5adf..9cccda973756 100644 --- a/drivers/thermal/thermal_trip.c +++ b/drivers/thermal/thermal_trip.c @@ -42,7 +42,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_for_each_trip); int thermal_zone_get_num_trips(struct thermal_zone_device *tz) { - return tz->num_trips; + return tz->tzp->num_trips; } EXPORT_SYMBOL_GPL(thermal_zone_get_num_trips); @@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_num_trips); * driver to let it set its own notification mechanism (usually an * interrupt). * - * This function must be called with tz->lock held. Both tz and tz->ops + * This function must be called with tz->lock held. Both tz and tz->tzp->ops * must be valid pointers. * * It does not return a value @@ -70,7 +70,7 @@ void __thermal_zone_set_trips(struct thermal_zone_device *tz) lockdep_assert_held(&tz->lock); - if (!tz->ops->set_trips) + if (!tz->tzp->ops->set_trips) return; for_each_trip(tz, trip) { @@ -114,7 +114,7 @@ void __thermal_zone_set_trips(struct thermal_zone_device *tz) * Set a temperature window. When this window is left the driver * must inform the thermal core via thermal_zone_device_update. */ - ret = tz->ops->set_trips(tz, low, high); + ret = tz->tzp->ops->set_trips(tz, low, high); if (ret) dev_err(&tz->device, "Failed to set trips: %d\n", ret); } @@ -122,10 +122,10 @@ void __thermal_zone_set_trips(struct thermal_zone_device *tz) int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id, struct thermal_trip *trip) { - if (!tz || !tz->trips || trip_id < 0 || trip_id >= tz->num_trips || !trip) + if (!tz || !tz->tzp->trips || trip_id < 0 || trip_id >= tz->tzp->num_trips || !trip) return -EINVAL; - *trip = tz->trips[trip_id]; + *trip = tz->tzp->trips[trip_id]; return 0; } EXPORT_SYMBOL_GPL(__thermal_zone_get_trip); @@ -150,7 +150,7 @@ int thermal_zone_trip_id(const struct thermal_zone_device *tz, * Assume the trip to be located within the bounds of the thermal * zone's trips[] table. */ - return trip - tz->trips; + return trip - tz->tzp->trips; } void thermal_zone_trip_updated(struct thermal_zone_device *tz, const struct thermal_trip *trip) diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 7a540b746703..65db38acd20b 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -122,16 +122,12 @@ struct thermal_cooling_device { /** * struct thermal_zone_device - structure for a thermal zone * @id: unique id number for each thermal zone - * @type: the thermal zone device type * @device: &struct device for this thermal zone * @removal: removal completion * @trip_temp_attrs: attributes for trip points for sysfs: trip temperature * @trip_type_attrs: attributes for trip points for sysfs: trip type * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis * @mode: current mode of this thermal zone - * @devdata: private pointer for device private data - * @trips: an array of struct thermal_trip - * @num_trips: number of trip points the thermal zone supports * @passive_delay_jiffies: number of jiffies to wait between polls when * performing passive cooling. * @polling_delay_jiffies: number of jiffies to wait between polls when @@ -148,7 +144,6 @@ struct thermal_cooling_device { * @prev_high_trip: the above current temperature if you've crossed a passive trip point. * @need_update: if equals 1, thermal_zone_device_update needs to be invoked. - * @ops: operations this &thermal_zone_device supports * @tzp: Thermal zone parameters * @tgp: Thermal zone governor parameters * @governor: pointer to the governor for this thermal zone @@ -164,7 +159,6 @@ struct thermal_cooling_device { */ struct thermal_zone_device { int id; - char type[THERMAL_NAME_LENGTH]; struct device device; struct completion removal; struct attribute_group trips_attribute_group; @@ -172,9 +166,6 @@ struct thermal_zone_device { struct thermal_attr *trip_type_attrs; struct thermal_attr *trip_hyst_attrs; enum thermal_device_mode mode; - void *devdata; - struct thermal_trip *trips; - int num_trips; unsigned long passive_delay_jiffies; unsigned long polling_delay_jiffies; int temperature; @@ -184,7 +175,6 @@ struct thermal_zone_device { int prev_low_trip; int prev_high_trip; atomic_t need_update; - struct thermal_zone_device_ops *ops; struct thermal_zone_platform_params *tzp; struct thermal_governor_params *tgp; struct thermal_governor *governor; From patchwork Tue Jan 30 11:12:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537304 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75B6DC46CD2 for ; Tue, 30 Jan 2024 11:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ENGVDR+4RyLhejxNgtzloa7w74VtRdAhkyQpCABHF6Q=; b=lCYxax0C6LVjXr ARWpPyVzuQvdUXXEn1Wbhg3R9zksVvlotKtEM+oAdNdbHAQP+lP+NTemGh8D3498/A6ME6D9r43g4 vgT929KZiaT6tXSeSeCFxfGT5NI2NfaE97wc3h9l3RRCHeAGoyQ5u/VuMJepRrrxFA6f+nvIN/JGP 9X/FBBLXQKA38mdUCXVTVW4iD2k01MHMDKGjg8RXoj1MalH6D7xS/z1K9sfIBzouUH7ri/to6+QWT 8JehiC7kEX9zejUG5vemwJe7k7sx7+WR0ORQMo7z5bE7MSvj88d2H1W3IDJeErcTaxLUGexCjqpvu rW8AfqeBWqE2tMZEDlww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3Z-0000000GMDQ-2jSb; Tue, 30 Jan 2024 11:13:33 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3L-0000000GM6C-3usv for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613198; bh=mEtrz7xMtfcpY7sT1iZb5MnMblxKwwvnwtCVasYjkwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sqhLf9jG5O6CWF4it6D6pVYOJQpzWwzFvcinU7Zeft6hwYnwmfrXbf+2t1IwFk8Q4 Jf/DV2lzIq8TtyVOjDcTp0VVAG5qi+hTTzkbRf0QyKwjIok6ThM8pHvLWnpvNsRgFk 9p1JDJ62axfSYIM9ZYQ+ZAEDWL4LY4Cuce8GziRGSHzF5hJKHD+X7u9jZEsW6Uo+Ym 9IHotLcKMgZG1zEBtur32SaJD1Kn9v7az07C6sw75agJ6vTBfVRNRLMyzYC4Rxsr6v HVzu1FoMLTL+swrjIii3lAKVuukF8AM/JeqT8ISdofcYKLc9AwLhlvVJEhkut3blLY QnEwj6svk9TLA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id B3B10378208F; Tue, 30 Jan 2024 11:13:16 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 04/18] thermal/drivers/da9062: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:36 +0100 Message-ID: <20240130111250.185718-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031320_192358_77D414B2 X-CRM114-Status: GOOD ( 11.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/da9062-thermal.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c index 160d64913057..13c7a6bc36c4 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -158,6 +158,13 @@ MODULE_DEVICE_TABLE(of, da9062_compatible_reg_id_table); static int da9062_thermal_probe(struct platform_device *pdev) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .ops = &da9062_thermal_ops, + .trips = trips, + .num_trips = ARRAY_SIZE(trips), + } + }; struct da9062 *chip = dev_get_drvdata(pdev->dev.parent); struct da9062_thermal *thermal; const struct of_device_id *match; @@ -196,10 +203,11 @@ static int da9062_thermal_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&thermal->work, da9062_thermal_poll_on); mutex_init(&thermal->lock); - thermal->zone = thermal_zone_device_register_with_trips(thermal->config->name, - trips, ARRAY_SIZE(trips), 0, thermal, - &da9062_thermal_ops, NULL, pp_tmp, - 0); + tzdp.tzp.type = thermal->config->name; + tzdp.tzp.devdata = thermal; + tzdp.tzp.passive_delay = pp_tmp; + + thermal->zone = thermal_zone_device_register(&tzdp); if (IS_ERR(thermal->zone)) { dev_err(&pdev->dev, "Cannot register thermal zone device\n"); ret = PTR_ERR(thermal->zone); From patchwork Tue Jan 30 11:12:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C27E4C48285 for ; Tue, 30 Jan 2024 11:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ll6vv4OXliNSY4LB2V8SEiLu0A5h8MLSmmknlsOEYnw=; b=VDRTAnSpyQe+iu cqEn77G2Hz4AsE1KRdVSMJ6ibFze5RONRaCqjZCik4mP6vBzipboAXiow92rCRrGLgWG8e/avR/Xp nmPhmDME0d18d0WieEJhatJyjBaJ3NaPEEME23xIDNEShGp635XIxkkDznM8isdjR8uKJTqJ5vE8e 0Cf+jn7jWQhZLTeL+DgjCwVgpWWE+pAvsg22vXoclmIX7hUjZwxLSg5fqUb8ZqQim/Gl/7Kj24R4L ujeKO7VjfKvv2OlTzqtZCMwS+TvrnaEZBKMBLPRafD1TCiHg6ddDufkU32tt+aSNtpmtO3+MSEeyA IgKuQI0IA6eYKpwtgVsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3i-0000000GMJq-27Cg; Tue, 30 Jan 2024 11:13:42 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3O-0000000GM7M-0qXQ for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613201; bh=X32Bcgql6uQHTDnzXYAHs6Ep92uAw8IaBvn5qiYUvoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ktna+Kv7gfh7dk/63on+MZmh7HvZIJKzc/m0yfqmwGfo5hx0NNfEha4GXbFQvmHwR OJ6fj4vz1P+UE5mn5+5GlaDR23qM5foBhIcP5qvh41k44f6y95fFJhmajFqInrtlDl SEHtJY3yfUyQOELakeI944UolMKSxiqY5VPbIg3KmluUPJkE6Trjr7qcJirhFdsdrW Gd90I/qARmjUPlohsvCbZMBc9ML05RSKKNkOLDS7TgXhvq7gBX4tJta6QqkFhk1pjU zHCWcBu6WA9LNkz5OLhfGx4Muwjtzfwnr5khGaOQpMp03aCHRyDV7/s+LS4muL819z 5NFPmb2KLjhGA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id EAED0378208D; Tue, 30 Jan 2024 11:13:18 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 05/18] thermal/drivers/imx: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:37 +0100 Message-ID: <20240130111250.185718-6-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031322_447098_BEA30808 X-CRM114-Status: GOOD ( 11.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/imx_thermal.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 7019c4fdd549..16fb49194fb3 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -599,6 +599,15 @@ static inline void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data static int imx_thermal_probe(struct platform_device *pdev) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "imx_thermal_zone", + .ops = &imx_tz_ops, + .mask = BIT(IMX_TRIP_PASSIVE), + .passive_delay = IMX_PASSIVE_DELAY, + .polling_delay = IMX_POLLING_DELAY, + } + }; struct imx_thermal_data *data; struct regmap *map; int measure_freq; @@ -696,13 +705,11 @@ static int imx_thermal_probe(struct platform_device *pdev) goto legacy_cleanup; } - data->tz = thermal_zone_device_register_with_trips("imx_thermal_zone", - trips, - ARRAY_SIZE(trips), - BIT(IMX_TRIP_PASSIVE), data, - &imx_tz_ops, NULL, - IMX_PASSIVE_DELAY, - IMX_POLLING_DELAY); + tzdp.tzp.devdata = data; + tzdp.tzp.trips = &trips; + tzdp.tzp.num_trips = ARRAY_SIZE(trips); + + data->tz = thermal_zone_device_register(&tzdp); if (IS_ERR(data->tz)) { ret = PTR_ERR(data->tz); dev_err(&pdev->dev, From patchwork Tue Jan 30 11:12:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537309 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 300CCC48285 for ; Tue, 30 Jan 2024 11:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9xbtp/eROVqHNKn58BcwLkvfJwFdS82asZputWG2XkI=; b=Rm1O9cPGk4QEFe CPN10zvDnyAtI1YTfvk8P4AIxS0AwPLTicD1UW9EPvTU+apAURkQ+1zKdBKAVFDAD67u0JPfnuzKl 8AXnhm77wYQ1G18enGYU0eHpT4Kr+U+mKCySXE61D/HQWasfj3Ugb9oAETbh12qGu1O/KKBKOVRqq KvJzLre+/7cpemGsIaHmFW0+UHfw8ir2DPdDJT5fTDmLw2ZyesDl/CCiFkcMOV8Apx/1Kz3zcQsIN W+xegCJXkWUEyd8ZwiZXLJhYgAJ9d4Zk1NR2UCuUfnlxsmHEg5O8ewSaCmcwdS+DY496NCGUI/9kI ZEzOFwUZXrVlkXzK5pkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4R-0000000GMpW-0xWt; Tue, 30 Jan 2024 11:14:27 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3Q-0000000GM8l-1rNU for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613203; bh=r/xN4hRek8FnzGLHk7xH3AKDZREzhfirE5eGw3Eh9wk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eOE1anLR0sO7qCXb2Ly395jDZB0e2lOHZp+jq/MN4nKFjriQu6xikVzStKQwrKmOi 2H7ywpnHpoYkH0NSc3UHHA4WsYigVt6ai/LainhNcERcpv3SM9UvMtr0ntytWcJWMG Bhluz7E0AOJWfyyfn5J9V4Ixomum4G+KWETHtLs0N3wjk+HKgTXsx1Ov8HBCUdWAjF kMHAMkfNNKS9Qcn4FwcWlE7K3MnWE8wKtSdM7IpTzGiATHcMXEjjbueaZpajKy8HoD YMvaKhIPPN+kQzAGAWNs25N/T0MZiYGc3sP98BHD/obDuercnC4wX8JqY0qrbcYlVn Frp7116h8Pbhg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 31A333782081; Tue, 30 Jan 2024 11:13:21 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 06/18] thermal/drivers/rcar: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:38 +0100 Message-ID: <20240130111250.185718-7-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031324_716959_06B9BF4F X-CRM114-Status: GOOD ( 11.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Geert Uytterhoeven Reviewed-by: Niklas Söderlund --- drivers/thermal/rcar_thermal.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index feb848d595fa..7bf9c1611a00 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -488,10 +488,17 @@ static int rcar_thermal_probe(struct platform_device *pdev) dev, i, priv, &rcar_thermal_zone_ops); } else { - priv->zone = thermal_zone_device_register_with_trips( - "rcar_thermal", trips, ARRAY_SIZE(trips), 0, priv, - &rcar_thermal_zone_ops, NULL, 0, - idle); + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "rcar_thermal", + .ops = &rcar_thermal_zone_ops, + .devdata = priv, + .trips = trips, + .num_trips = ARRAY_SIZE(trips), + .polling_delay = idle, + } + }; + priv->zone = thermal_zone_device_register(&tzdp); ret = thermal_zone_device_enable(priv->zone); if (ret) { From patchwork Tue Jan 30 11:12:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7604C46CD2 for ; Tue, 30 Jan 2024 11:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LmJUx31YBiyA9+oI2rjB/szOfav1U0T28hs8f+9bqjY=; b=NYmEgqBVVF9dxz Pf++WD5v7kxkbrWOMAfmNfABpD4FN4OgXtXuMMN0+qcQNOvTIY8mAayAEm+NM61nfH6r0rxpPrL/4 WpTIZTve8pQUtvq0yT9HMq9SCXlPKxp50OA2m7DOFGZoTVRsx7HqQ65C9qqTnBul0Q1p7bnB3mPz1 Kimku0T9Wn6Bx8TeQSnWiKWLz7CnZj2RrSnHUngULgGn6tXm5UiuqlhbRf9fCNe1A3uMkBeaQGPUB CPO4GzY0yJm1Ms6SMY28YUZKLLQJEF1eMoru/jdEASKjGuc1dSNJ0m7iaNEEilfrrIdRB6yMa/KCF 0xqjcmflUZFUy7sWfupw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4T-0000000GMqz-1dIh; Tue, 30 Jan 2024 11:14:29 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3S-0000000GMA6-2hgD for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613205; bh=SKppNY4y88YWZiAw2UK5DtE27VayRH8M42y87uCkgxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lVC64xCk8sDHIzLwI/8kQl+6GHoL27D7uzAPQWBJkq5e7JFhlBhhkhJMqNBJk4bBn kgfQuTfqBtn+R1qVhTIv6C/Af26MyfOrr6eBJxf5EKSl2FyRvWjZ7Y2POcJIfvCWYB hGqNxr1xbCWw9fmsK4YRuFVUfRj/5f4zukWxF3N0KERLN5CBh9Tw1X1Zqy6LqsfMaG ghuwbM5CuK9ntb2PXesJJsn10fwh4TfLlwN1wKLlXZUVkr3cI5BXQFdP6YgfGo8GiH 1zcE71dkgHMFFnsyW2+CTsDHZdYKFWdax2ZMtrLO+gBEef2YOjoh70cxKyhDClknqq QWJI8+H3T6Udg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 6BB713782089; Tue, 30 Jan 2024 11:13:23 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 07/18] thermal/drivers/st: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:39 +0100 Message-ID: <20240130111250.185718-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031326_893498_73B1DC58 X-CRM114-Status: GOOD ( 11.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/st/st_thermal.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 0d6249b36609..2f7b22764bd0 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -143,9 +143,9 @@ int st_thermal_register(struct platform_device *pdev, struct st_thermal_sensor *sensor; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; + struct thermal_zone_device_params tzdp; const struct of_device_id *match; - int polling_delay; int ret; if (!np) { @@ -197,14 +197,17 @@ int st_thermal_register(struct platform_device *pdev, if (ret) goto sensor_off; - polling_delay = sensor->ops->register_enable_irq ? 0 : 1000; - trip.temperature = sensor->cdata->crit_temp; trip.type = THERMAL_TRIP_CRITICAL; - sensor->thermal_dev = - thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, 0, sensor, - &st_tz_ops, NULL, 0, polling_delay); + tzdp.tzp.type = dev_name(dev); + tzdp.tzp.ops = &st_tz_ops; + tzdp.tzp.devdata = sensor; + tzdp.tzp.trips = &trip; + tzdp.tzp.num_trips = 1; + tzdp.tzp.polling_delay = sensor->ops->register_enable_irq ? 0 : 1000; + + sensor->thermal_dev = thermal_zone_device_register(&tzdp); if (IS_ERR(sensor->thermal_dev)) { dev_err(dev, "failed to register thermal zone device\n"); ret = PTR_ERR(sensor->thermal_dev); From patchwork Tue Jan 30 11:12:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A64A3C46CD2 for ; Tue, 30 Jan 2024 11:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZgVT66xr6bL8C1PUs8CrRv1aU0wMQolCdkvwQn6Fjzg=; b=ipRPST0WD1R//n TTtcAI+lPUcI8pMVjTBuNH0Qdut8tvykvwNTAjQNBkb9yp3YKxq0xD/MlQu8886YiJniVALSHc2BR OOpe0s9hCYZw+keHDguWxpOLrfE9rSmdyeEIh2tvPO3HoDo+wCMzFiFPddRBp7vUIUzV8qTF3JZmu pfFNn4FwLrRk6l0naTqHkqI5G+UC8UX8DTlbfphwS8Aky/WnHP3s4w1irWd3OqFzuVnyy/TxCgTe9 cjp9KQH1G9YOuCShYctLOz22yNNwBkFy6wPL5QtbzQhqwebpZPaeAntOkgHn9JcwSlA2tVCuHP0J3 VSMx/OM85sAcWssiyoGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4N-0000000GMmY-2DbH; Tue, 30 Jan 2024 11:14:23 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3U-0000000GMAp-3mx0 for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613207; bh=tALIom+m2UHdd4MK7i96Hl0n8kwKYP1fIX+bHaIVr5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rUFMvo3sF6288p/svf/iiNTjMvBJ7/BzP6UOsscYf7QMifiGGb/vb+JQk3FOhdIlV eng+RaU5Qt3T075W1v3+urH/MHY1FTo3LdDa8NoJIOiR56zC01WrRBxGL5R8qBxCZN aaXVTNue3NnAdoG91/1g1oibI7B2clwdqRiimkUFJqvFDTQkmJCTlNocNxxgfA5OBi b0HM2hwvOPecrep4f6scSKICFvS2pt8OdSWh8If65gshtAKNMIhZDhbtK9xE400ZXo 172jBuREMQ7r3jwu1zN54kdDUJHPkBOmicQKy5cikJTyUltYPFYGvBW+8VM/fLezf+ qt2Ro2VCKxj6Q== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id A4B29378208B; Tue, 30 Jan 2024 11:13:25 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 08/18] thermal: intel: pch_thermal: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:40 +0100 Message-ID: <20240130111250.185718-9-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031329_978940_6928946D X-CRM114-Status: GOOD ( 10.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/intel/intel_pch_thermal.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index b3905e34c507..73d7c2ac7dbc 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -160,6 +160,7 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev, const struct pci_device_id *id) { enum pch_board_ids board_id = id->driver_data; + struct thermal_zone_device_params tzdp; struct pch_thermal_device *ptd; int nr_trips = 0; u16 trip_temp; @@ -233,10 +234,13 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev, nr_trips += pch_wpt_add_acpi_psv_trip(ptd, nr_trips); - ptd->tzd = thermal_zone_device_register_with_trips(board_names[board_id], - ptd->trips, nr_trips, - 0, ptd, &tzd_ops, - NULL, 0, 0); + tzdp.tzp.type = board_names[board_id]; + tzdp.tzp.devdata = ptd; + tzdp.tzp.trips = ptd->trips; + tzdp.tzp.num_trips = nr_trips; + tzdp.tzp.ops = &tzd_ops; + + ptd->tzd = thermal_zone_device_register(&tzdp); if (IS_ERR(ptd->tzd)) { dev_err(&pdev->dev, "Failed to register thermal zone %s\n", board_names[board_id]); From patchwork Tue Jan 30 11:12:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537312 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3CBA7C47DDF for ; Tue, 30 Jan 2024 11:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VG8sRHgYFxLZ+gpoh4tSDCdE2v8lUbTBBStgor9Ex00=; b=PVxtqCCOKdqZRP +tM6bWidaVn5jU17JwjwW9pN5K1uiavQYba0kQlK8GJjpyVJb+v5zLQ/0bj9xTiN3c8Ih5PoSNKV4 4kwCFmUga2rCkumoFnVZ9rB3sZxt7Vb68Ubian+Ohr/Vel/wzYBOQQ0ZuYQoPTvqMZgRzk61zp9/8 ow5hEGjX4/cQC71AjGecG6NLrzkYMrIfpbUQO4DvpwdUc2CqRoh1BzIX9n/IjjIdYVY5NZSD8Kdc1 z2NVnVrl+JMhafp3xbUsi5j8YYcsJOkOcnNUzrz250J5wQ8auDahWwGfX0iLWZeHixJxTA4hdkR6/ O1KM52PCmzLSGx4fkgdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4V-0000000GMsd-1wa0; Tue, 30 Jan 2024 11:14:31 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3X-0000000GMBT-0IlG for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613209; bh=8N3xJcRXf5FIbTK9mPZ0ZQQ16s2NrrH6F3ME5uc5zQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tWaiuBHNkYHdwGEZcneAwBntZrHzXW7ISd87Cvuu5+408yDYsOzKNRnEFUUez+XUf 7FwwYW6QEa6WduKNur0YASEp2wWVy8IrRF8cckY7rbHNlPtL6oewASwConO4RSbKi2 jLgQgE0VX03qVmZq5gPx4lPPZ/nZBqNvQpWzZn4AWWaBarl+tzh+ocwt9EkyNHdrEY QT2nAEUAwZ05ZL99FEYAiaK4fsbjMOFlYQm3IOVsDELaG0H1CPn2GexXNrvyQK1c98 xMBUq03IsVewGMSN/pBHme2dby0PVyhgGMAHR6pdZ1fdkB3LvTxQtQfelJKlHwoXSH pReTHx90gVLsg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id E3823378208C; Tue, 30 Jan 2024 11:13:27 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 09/18] thermal: intel: quark_dts: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:41 +0100 Message-ID: <20240130111250.185718-10-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031331_812875_96C27534 X-CRM114-Status: GOOD ( 11.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- .../thermal/intel/intel_quark_dts_thermal.c | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/intel/intel_quark_dts_thermal.c b/drivers/thermal/intel/intel_quark_dts_thermal.c index 646ca8bd40a9..381a806d5f62 100644 --- a/drivers/thermal/intel/intel_quark_dts_thermal.c +++ b/drivers/thermal/intel/intel_quark_dts_thermal.c @@ -320,10 +320,16 @@ static void free_soc_dts(struct soc_sensor_entry *aux_entry) static struct soc_sensor_entry *alloc_soc_dts(void) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "quark_dts", + .ops = &tzone_ops, + .polling_delay = polling_delay, + } + }; struct soc_sensor_entry *aux_entry; int err; u32 out; - int wr_mask; aux_entry = kzalloc(sizeof(*aux_entry), GFP_KERNEL); if (!aux_entry) { @@ -339,10 +345,10 @@ static struct soc_sensor_entry *alloc_soc_dts(void) if (out & QRK_DTS_LOCK_BIT) { aux_entry->locked = true; - wr_mask = QRK_DTS_WR_MASK_CLR; + tzdp.tzp.mask = QRK_DTS_WR_MASK_CLR; } else { aux_entry->locked = false; - wr_mask = QRK_DTS_WR_MASK_SET; + tzdp.tzp.mask = QRK_DTS_WR_MASK_SET; } /* Store DTS default state if DTS registers are not locked */ @@ -368,12 +374,11 @@ static struct soc_sensor_entry *alloc_soc_dts(void) aux_entry->trips[QRK_DTS_ID_TP_HOT].temperature = get_trip_temp(QRK_DTS_ID_TP_HOT); aux_entry->trips[QRK_DTS_ID_TP_HOT].type = THERMAL_TRIP_HOT; - aux_entry->tzone = thermal_zone_device_register_with_trips("quark_dts", - aux_entry->trips, - QRK_MAX_DTS_TRIPS, - wr_mask, - aux_entry, &tzone_ops, - NULL, 0, polling_delay); + tzdp.tzp.devdata = aux_entry; + tzdp.tzp.trips = aux_entry->trips; + tzdp.tzp.num_trips = QRK_MAX_DTS_TRIPS; + + aux_entry->tzone = thermal_zone_device_register(&tzdp); if (IS_ERR(aux_entry->tzone)) { err = PTR_ERR(aux_entry->tzone); goto err_ret; From patchwork Tue Jan 30 11:12:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DEAF7C46CD2 for ; Tue, 30 Jan 2024 11:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Hx/JBqSpwQJ1ugpLDfXKtzOwFWrit3dyoKqx+9iIyXQ=; b=NEq6elXruhXHgc qIMkx5mH82Q3AymKz/KRJGvli/8cFjJSQu0trRLinvMgv/gI+RCIBsxsZK0kb2QJPTv7BDWVWOhC4 1kS9MEZnWphtZ/K+rB7vHmmz4p96J2M+7qsMCJVAgfeK1uDIOpHEbdxUTo6zoyeAWLWl4Gm9qaof8 UdRebs+8ubu0l+MS8AR5sbWS6BRV/z/nqzhGZmcmSoxesPoRkBtoY+IR8C4kmh3T6Iys+RaEpGYd9 gY+y5FMWK5mIFRr9/SkTy7ZP7keSnEG1q3Ks2GUBquewci0JqckEiJzKx3rX9eXnyiYXgIZd4/yZn UFoz2nWLDkhUIQZHqxHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4P-0000000GMoW-2fq7; Tue, 30 Jan 2024 11:14:25 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3Z-0000000GMD0-1UMX for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613212; bh=xF+/wSXIq5fE1Hx9RSY2i9M69cbEXmtjt5ngzeA8uxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qPNQW+T201OxgVKSszDbRWd4p2jvdQZiIVNgD0+YhC88KZXrs8xyKLIoqBhTBe9n9 ZpYyl7yX7PLi3/dqS+rkh8PfILSkQvsk3thd0Lm6P3wr7rdcu04lDun1EqwB4Lx7iq 3G17PLpzNJ6mHBUYU2R3Js8SUe2oK6B0Kve84Ab1n5Uuu1j5wwEiqeFqA2qU1qg+Dw b8s+24AN+Cw+I/M3KOknDvG04jW9+PTzAOAX6NZ6uojs0pQI8gyapk7lnXJFjP6Oky txbeThlekjBx0ybhCGCWhXZuBpSGVyBQRzlAcaGvROTGSrICiKWNrOBPXLKHvnVicY l3EZfinvdpXLw== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 220C23782084; Tue, 30 Jan 2024 11:13:30 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 10/18] thermal: intel: soc_dts_iosf: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:42 +0100 Message-ID: <20240130111250.185718-11-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031333_722386_D989E3C9 X-CRM114-Status: GOOD ( 11.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/intel/intel_soc_dts_iosf.c | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c index d00def3c4703..78dceb117ed8 100644 --- a/drivers/thermal/intel/intel_soc_dts_iosf.c +++ b/drivers/thermal/intel/intel_soc_dts_iosf.c @@ -220,8 +220,15 @@ static void remove_dts_thermal_zone(struct intel_soc_dts_sensor_entry *dts) static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts, bool critical_trip) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .devdata = dts, + .ops = &tzone_ops, + .trips = dts->trips, + .num_trips = SOC_MAX_DTS_TRIPS, + } + }; int writable_trip_cnt = SOC_MAX_DTS_TRIPS; - char name[10]; unsigned long trip; int trip_mask; unsigned long ptps; @@ -253,12 +260,15 @@ static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts, trip_mask &= ~BIT(i / 8); } dts->trip_mask = trip_mask; - snprintf(name, sizeof(name), "soc_dts%d", id); - dts->tzone = thermal_zone_device_register_with_trips(name, dts->trips, - SOC_MAX_DTS_TRIPS, - trip_mask, - dts, &tzone_ops, - NULL, 0, 0); + + tzdp.tzp.type = kasprintf(GFP_KERNEL, "soc_dts%d", id); + if (!tzdp.tzp.type) + return -ENOMEM; + + tzdp.tzp.mask = trip_mask; + + dts->tzone = thermal_zone_device_register(&tzdp); + kfree(tzdp.tzp.type); if (IS_ERR(dts->tzone)) { ret = PTR_ERR(dts->tzone); goto err_ret; From patchwork Tue Jan 30 11:12:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52BF2C47DDF for ; Tue, 30 Jan 2024 11:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FMPxAYle63pPflwUgogmIDTygWaOxrkacMZN5uxjYWo=; b=ApW4BrwmiJZbeE AF/96KIQlBJzjJdcYPhZmIhaU4UJOy7gvK4eWD/2fUWuZMD3zauoQvMweWIb1QITP3aiHSp3NIlOM xaJ5jTDUZBm4Yh3OuK87XsFGa5pztnv7i4K5Pl5rKKwfQQLvpseE11QwFQ9yQmOBNzHN+rMnQ1JII WZ5xmb0WATINgtQm4u9n5AkeNyHW6WwsN9mxhzIAH/yC7EJ4B8FVad2nfFOQv4A1IKGii6H3k6CTR a+EDCBQwuDhuGbGpEiFCo//g7TGVxUN2Hg2pkxQq455Li+xa1wL04jBsvII4JhccidQn/cq0xUNtx jhelFZfRGZsnS1SrIr5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4Z-0000000GMvl-1usQ; Tue, 30 Jan 2024 11:14:35 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3b-0000000GMEQ-2Fhz for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613214; bh=Cr03L1qxC5Q5WcLgoejwkJaADJOROHbQJiExrCsEGkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oEg3xFX7Jo2dtz39P1RXwHf92Vd+CpqUiqOfyEun+kFMsXU5d1P7gO3hdBRg5tOLj YEmmprOkAwFT7346a1DvKeVi34HfmxdmxAaIZCeyDaN1I4GNAzdC01KHfvDZ9DxSKj 7kkV5gAZBwaNm464JDkFnr9lttUHscHadJ+qAZLRJw4GkxtQQkRD0Aj6YoZJY/1vRa UE0bkqA7vN2O+VbW6hsmdQvMBTjgZvij+wIQDiR83c9DSMuL17CimRsKTw3Bedd1pQ hIsVqzE96wp2Y7rFG3YUlQ6hzxeafJuqJoWUSm0dIxaBJAw3a/Mp77jNj3wa1wkcKV KcDTQWuxsxPXQ== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 563763780FC7; Tue, 30 Jan 2024 11:13:32 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 11/18] thermal: intel: int340x: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:43 +0100 Message-ID: <20240130111250.185718-12-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031335_894589_9BCCE88E X-CRM114-Status: GOOD ( 11.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- .../int340x_thermal/int340x_thermal_zone.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c index 3e4bfe817fac..e45fdd36db55 100644 --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -118,19 +118,17 @@ static int int340x_thermal_read_trips(struct acpi_device *zone_adev, return trip_cnt; } -static struct thermal_zone_params int340x_thermal_params = { - .governor_name = "user_space", - .no_hwmon = true, -}; - struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, int (*get_temp) (struct thermal_zone_device *, int *)) { + struct thermal_governor_params tgp = { + .governor_name = "user_space" + }; struct int34x_thermal_zone *int34x_zone; + struct thermal_zone_device_params tzdp; struct thermal_trip *zone_trips; unsigned long long trip_cnt = 0; unsigned long long hyst; - int trip_mask = 0; acpi_status status; int i, ret; @@ -153,7 +151,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, status = acpi_evaluate_integer(adev->handle, "PATC", NULL, &trip_cnt); if (ACPI_SUCCESS(status)) { int34x_zone->aux_trip_nr = trip_cnt; - trip_mask = BIT(trip_cnt) - 1; + tzdp.tzp.mask = BIT(trip_cnt) - 1; } zone_trips = kzalloc(sizeof(*zone_trips) * (trip_cnt + INT340X_THERMAL_MAX_TRIP_COUNT), @@ -183,13 +181,15 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, int34x_zone->lpat_table = acpi_lpat_get_conversion_table(adev->handle); - 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); + tzdp.tzp.type = acpi_device_bid(adev); + tzdp.tzp.ops = int34x_zone->ops; + tzdp.tzp.devdata = int34x_zone; + tzdp.tzp.trips = zone_trips; + tzdp.tzp.num_trips = trip_cnt; + tzdp.tzp.no_hwmon = true; + tzdp.tgp = &tgp; + + int34x_zone->zone = thermal_zone_device_register(&tzdp); if (IS_ERR(int34x_zone->zone)) { ret = PTR_ERR(int34x_zone->zone); goto err_thermal_zone; From patchwork Tue Jan 30 11:12:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537314 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42669C46CD2 for ; Tue, 30 Jan 2024 11:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XaB4VPGGDiyslPuR2hDcM/0rZTJ8PTqxtDkIzkp/JaM=; b=wYbNP3Mysg14YY IT2UwvBCFIi3Tpn0uY7xUI5MivuiXGI0W8zQUgFNBGzI3j9waReqaR8k5Ws7Zw77rhsVwD00lRLYs RcOGlD9bhpLxPZeM4YVGlYDml98sFWrJrf29az0FZZRbVlvWPZva+IXe+Q0P5SnfqmxXATBPb264q a5QIX0prJ091GqANBf52wmNyoalBp4TAKiEkiKeEd44ua8dzL+LPtJer0mMDImXe9m4302glfNvTr V6CsBVTB+pf8abpXHQY8AeBWGaEDzNbb1wV3eaPvQe1QYhkR4V+jMU14ZXUnshSwfPPjqrxAin+xW 2urHBxpcGTwKzOhcsfaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4e-0000000GMzh-1eXs; Tue, 30 Jan 2024 11:14:40 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3e-0000000GMFB-1574 for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613216; bh=jX8eexMy1avLh8dlPbkEyo4c5yBA7XPn/CK+R650NbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1lPMjJgzotfkB90XRVoWGZlENgOEHhc7wkebDfMVFSons4LdaXxnWLlgTJHquu3bj qUlJ/KqMhF7Uc0qtf1K+jYdXnrE7z+HcfdPmomI02IXIZHGrZCRVDj+2t+rZewbuW4 n598Lj0/FjURzHIjqSgv2/oqR1kf253bx9CdsfW0H9eSlo8+uPYsxDlPabyqpH1o8V L7Xr3HvHtpGH5eJVVzO2ReIXQrIQiIsz5zK4C7IKCz1Y3O847OruuGHb4hd4L2sJ+9 OcxXiixsSuIFTxXRN060iKRrO5hTnD7grEagsne3m7VK4O2rPBVmQmISKwnNEZXYX1 65zueO5ac3IxA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 7A9043782081; Tue, 30 Jan 2024 11:13:34 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 12/18] thermal: int340x: processor: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:44 +0100 Message-ID: <20240130111250.185718-13-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031339_168479_6DE4AAF3 X-CRM114-Status: GOOD ( 11.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- .../processor_thermal_device_pci.c | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c index d7495571dd5d..3170eab57e32 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -242,13 +242,19 @@ static struct thermal_zone_device_ops tzone_ops = { .set_trip_temp = sys_set_trip_temp, }; -static struct thermal_zone_params tzone_params = { - .governor_name = "user_space", - .no_hwmon = true, -}; - static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "TCPU_PCI", + .mask = 1, + .no_hwmon = true, + .ops = &tzone_ops, + }, + }; + struct thermal_governor_params tgp = { + .governor_name = "user_space" + }; struct proc_thermal_device *proc_priv; struct proc_thermal_pci *pci_info; int irq_flag = 0, irq, ret; @@ -289,10 +295,12 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_ psv_trip.temperature = get_trip_temp(pci_info); - pci_info->tzone = thermal_zone_device_register_with_trips("TCPU_PCI", &psv_trip, - 1, 1, pci_info, - &tzone_ops, - &tzone_params, 0, 0); + tzdp.tzp.devdata = pci_info; + tzdp.tzp.trips = &psv_trip; + tzdp.tzp.num_trips = 1; + tzdp.tgp = &tgp; + + pci_info->tzone = thermal_zone_device_register(&tzdp); if (IS_ERR(pci_info->tzone)) { ret = PTR_ERR(pci_info->tzone); goto err_del_legacy; From patchwork Tue Jan 30 11:12:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1BB3BC48285 for ; Tue, 30 Jan 2024 11:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XTcRIT8yTOlNHxzw1OvMqWWDBf85kvC+IvVWfzlNpzM=; b=CF6z0gDmDG+EAY /hXzVfn6OLLoqx0q24LPeJZsI4TtFqNa875Zz6MuRA8YGtiJe9I8EQ6cUsVIMM6YVfyPicR4s+/2w WJxMDgxdIfTXayEaYgrQyoH9M3ZMrv+y1x8m3ktfrc4eBfJKmxzaoleUzxx0OR0c5DP38ikkOmueK 6XnoI44gGacfMB0geMGuaqnrVrNY2p3TTabUNIGy179oQEYq/vXflVZl27MxbU/F7cs811WYBlwae /q/jIMRDGJnhnVwZPb6V7PJIr7o0u/IwcZIWBGxV+k6XeskR/LmQ9w0AWEfPr83sZ5XJMmk0h9Ht2 RkyKUFo0Y/JuhrIoFzKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4i-0000000GN2o-1a6S; Tue, 30 Jan 2024 11:14:44 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3g-0000000GMGf-0CqD for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613218; bh=ltmDsQGVDHJUuzGsD5EBKmLtvB2i4AwTm6AwkiKQz8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k+Pvr5PF/8OxlEHtizkNA/wV73S/GSrIoeFwPktq0CskoU8oQXYyLAEuk8CIaMWxn 8CP1kdqXu/0cmNm/3gXAwvo3oGNxPidoEY5x8GHSEJAxXfFXVeRc+IeTsDAFk7alxv Poxq+hn/Khi/0drMbOAkawG7UKkBUlPWEVMRsC38VDQr8QajxwXfZbbctOLADiCaYY batYvsGFo1vSTbspongqTUZXtw2xX7/byFMPIE14Bqulw0HF70MzLrdBcjvLRvhPaY VKgMK7Q0lzxsC184UtpQATd5PJDool3nqAgSCweQOWiWAFdOuXNN3ig5Q/4UYqu2Sq HyC5l1edePZxw== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id B154237811F4; Tue, 30 Jan 2024 11:13:36 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 13/18] thermal: intel: x86_pkg_temp: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:45 +0100 Message-ID: <20240130111250.185718-14-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031340_450898_751A6923 X-CRM114-Status: GOOD ( 12.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/intel/x86_pkg_temp_thermal.c | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c index 11a7f8108bbb..0bdc1d1855e2 100644 --- a/drivers/thermal/intel/x86_pkg_temp_thermal.c +++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c @@ -57,10 +57,6 @@ struct zone_device { struct cpumask cpumask; }; -static struct thermal_zone_params pkg_temp_tz_params = { - .no_hwmon = true, -}; - /* Keep track of how many zone pointers we allocated in init() */ static int max_id __read_mostly; /* Array of zone pointers */ @@ -312,6 +308,13 @@ static struct thermal_trip *pkg_temp_thermal_trips_init(int cpu, int tj_max, int static int pkg_temp_thermal_device_add(unsigned int cpu) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "x86_pkg_temp", + .ops = &tzone_ops, + .no_hwmon = true, + } + }; int id = topology_logical_die_id(cpu); u32 eax, ebx, ecx, edx; struct zone_device *zonedev; @@ -344,10 +347,13 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) INIT_DELAYED_WORK(&zonedev->work, pkg_temp_thermal_threshold_work_fn); zonedev->cpu = cpu; - zonedev->tzone = thermal_zone_device_register_with_trips("x86_pkg_temp", - zonedev->trips, thres_count, - (thres_count == MAX_NUMBER_OF_TRIPS) ? 0x03 : 0x01, - zonedev, &tzone_ops, &pkg_temp_tz_params, 0, 0); + + tzdp.tzp.devdata = zonedev; + tzdp.tzp.trips = zonedev->trips; + tzdp.tzp.num_trips = thres_count; + tzdp.tzp.mask = (thres_count == MAX_NUMBER_OF_TRIPS) ? 0x03 : 0x01; + + zonedev->tzone = thermal_zone_device_register(&tzdp); if (IS_ERR(zonedev->tzone)) { err = PTR_ERR(zonedev->tzone); goto out_kfree_trips; From patchwork Tue Jan 30 11:12:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537316 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CBB29C46CD2 for ; Tue, 30 Jan 2024 11:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VWIilpcCRqBQXC/hKxsXYFwB1uWJPxihIPBGkH7d5Pc=; b=OYUBnYBbCGbr5n Dixrj3rc9MLmVJFClSBL65/dui2IY1MIFyrJZw5O8NZm1DA8g9p3AIYaoAVO8Sb2TRQPb8ybgmPt+ 5hWrZ/mQwwv/hBY44N4yUswUaXhjpeZNyo8G0vsrYBdMx7wXhJtKN5tVT7BgwhA/HRfccpaAHFpgK b6IYzbudRsinu/nstVso5EQo9IFCDGSICWdZyVDBvevPy4cmcvhFMxmMjQ3G2yVe3oHeb/7t9NvnC 5g61MLmnXAhVXMRDSEJiMG0Vd83j1G+6MWRar4U1pp+OGxlojFnOthL2KS/PgIGVxIjlAJto5n+mT aQdxDwOhLGdlNeBRy+hQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4m-0000000GN5m-0gsf; Tue, 30 Jan 2024 11:14:48 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3i-0000000GMJ9-0wJP for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613221; bh=+RsoYewyOO14ouzshvdt3gaki76JepljIejGBDHOp2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mQShp5b1PaO4pA1N+3guPpQZJZY4gb3CAPdmzQX6EG9oF+WTF3rCekCrmOSuETOu6 YtEcPGn/EqC6U2JFbtiqOk2+ZU7Q7K9DWbUM1Cy/ncgnUsLKGblrHVRN83nJClmULc HqD4TzRhxRlKWOMXbznz/UNNyWdDgm/XVCbRr5lND+3/+/vcK9UR6f7Jig7il28Q5Y Hq70U3yTeQMUoy0NaPd8COeuZJ1+ZMDvwqeaiRqLbQZ0DasqVXManUz2jGZFoHy/zc 1VJtPAoszlMx1E/Xpjqpm9fkQvdH/Qmz4VOsbbtYoalHnXlemVubDaOwVBGXVTyFmN dH1HBGS/Mi9eg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id E9A86378208B; Tue, 30 Jan 2024 11:13:38 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 14/18] thermal/drivers/armada: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:46 +0100 Message-ID: <20240130111250.185718-15-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031342_654421_C2BAA913 X-CRM114-Status: GOOD ( 12.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Miquel Raynal --- drivers/thermal/armada_thermal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index f783547ef964..e07bee0440fe 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -864,8 +864,16 @@ static int armada_thermal_probe(struct platform_device *pdev) * into it, which requires the use of regmaps across all the driver. */ if (IS_ERR(syscon_node_to_regmap(pdev->dev.parent->of_node))) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .ops = &legacy_ops, + .devdata = priv + } + }; + /* Ensure device name is correct for the thermal core */ armada_set_sane_name(pdev, priv); + tzdp.tzp.type = priv->zone_name; ret = armada_thermal_probe_legacy(pdev, priv); if (ret) @@ -876,9 +884,7 @@ static int armada_thermal_probe(struct platform_device *pdev) /* Wait the sensors to be valid */ armada_wait_sensor_validity(priv); - tz = thermal_tripless_zone_device_register(priv->zone_name, - priv, &legacy_ops, - NULL); + tz = thermal_zone_device_register(&tzdp); if (IS_ERR(tz)) { dev_err(&pdev->dev, "Failed to register thermal zone device\n"); From patchwork Tue Jan 30 11:12:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 898EFC46CD2 for ; Tue, 30 Jan 2024 11:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LHHfKyZDwTFFwPR3Yhnpa4cgaGqgNTgw2FqQss7hqyo=; b=r5t5fcwJtYcLqv AptRzekmxOGpAGw96mA9U1SxDbLA14dhwZA3MBDOHxCidys5p3Y02KxKAU9Q60cHSeaskG08T+/PA bAbutGS8g6LY7FuaMFRSWZJGO5v0D2hskgznwGtQAc3xzkOQSCg6lYXh2xfcw3vZmghpBnCYFvr3D DNDtjb2wsFjEQgq4H+eZBamR+ViX8Lw4LyeVSxk2Kd8ilHuXUfBVsg0Os1MQUVetF5K9+DAQbGEaF BKJYkLWZ390mfCOqJ8ExhMHqc85Ub3uu/xzpG+11XwQVyDJcs3VUNqS07iyjLA9hJ9woBfyFMEH95 eR1dP91kbdTmKSUV0tIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4q-0000000GN9Q-0JIx; Tue, 30 Jan 2024 11:14:52 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3k-0000000GML5-1uPt for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613223; bh=74pBxa4eqyP7xDLl0IJ2wAmK6Mm6EIaDrqz4NKVOn8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pG6nb0WXa9Riuum74Ymqdy/5z9NzqXRXNJst9PisOt6izsigDuGpHvC2n3Iv6wbVd r/yo6W0+PKjfYEq1sAMgxznKRCJB6TBMfT1sxSK5B3rGaLdTd65hypVrylhDNH01Fu RL7YivWDdBoXAfesJDhQkL7CpL5gtQBxpCZVu3WXqyhZs7/kKle4XgNNkiQY+JLCG1 D1G3qZW4IPOKIASzMXYIP3845Jb+j3hTxCjV422rINPbbCkFUeN7EPOZWvDZ1/eQti EnHCChfSFwxxrYIYF0EftUrw/dNOLe/IZF0SSpt3pXkHzLdTYNujqFRHFWSd6a1cct XVrp/WAy/LYGQ== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 283DE3782090; Tue, 30 Jan 2024 11:13:41 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 15/18] thermal/drivers/dove: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:47 +0100 Message-ID: <20240130111250.185718-16-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031344_893571_ECAAFC6A X-CRM114-Status: GOOD ( 12.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/dove_thermal.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index ac30de3c0a5f..256c5dc45779 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c @@ -117,6 +117,12 @@ static const struct of_device_id dove_thermal_id_table[] = { static int dove_thermal_probe(struct platform_device *pdev) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "dove_thermal", + .ops = &ops + } + }; struct thermal_zone_device *thermal = NULL; struct dove_thermal_priv *priv; int ret; @@ -139,8 +145,8 @@ static int dove_thermal_probe(struct platform_device *pdev) return ret; } - thermal = thermal_tripless_zone_device_register("dove_thermal", priv, - &ops, NULL); + tzdp.tzp.devdata = priv; + thermal = thermal_zone_device_register(&tzdp); if (IS_ERR(thermal)) { dev_err(&pdev->dev, "Failed to register thermal zone device\n"); From patchwork Tue Jan 30 11:12:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537318 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B2F37C46CD2 for ; Tue, 30 Jan 2024 11:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VY0yM09oTOQG1f4O9CtEAvY1dODbJRoevxypJV1qNZg=; b=FOGkqfeaHYoJDc PtHnc9kVfTTQew9met/aSudI1GbLEEIw0HUxdQBgOa3xl4THjNxytwq9T3TjxLvl2P/qNoLAqh79O GiTUWYvqx3VuoRDY5LM2AhLKhTrJAS7rKCioCRcLzLa8o0gi3kQQZuLIsUKJMP70q1jnaU8v0ejlo NUB8XAYL6yiAnsUYsf4t9Yu7JpZ+iagMBAqQMvEGK3ZUvm1FTzRc7RSiLKYswsxqZIXTu7BBQV8BB EjbydAtQ8ABAmZW7MDJt3SDpcGD5QxFzqUWB3r6Ra4cbQKOy0SicxQ8WNRofqZ+WQgH+jDoDN74hU n9WN4uRCBhhKO2FOnZTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4t-0000000GNC5-1AN2; Tue, 30 Jan 2024 11:14:55 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3m-0000000GMMz-2vnF for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613225; bh=lvc56XBEENzj3l1vBHl7W+VJWa9O58KHS2L6cWEnb0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s72H3QsUQJtWRsvyRQo2gC69r8xWecWDNtEu34plUdOpog/Hur9EDM0g+aCe08MxJ YOA4Qu0/x5kpR4+jO1IB0l+U2xa9VSjbAXnLYIfTQu2R3dMjk1S9LSv5uzkQez/vE/ 8icQBb2gXuJ+2KTC41lYp0YzpsAWXPJCAiyejzit/s5yqoPLhwt51J2C86uCQGK1T+ jCGbNe+Dg4B2xdBI4gfs0ulYbYZiQ1vy6yXMqYbrPqKAhpcHPraKVXWfFyPuKPPjt+ 0HIzjC16W+YWOV/lyHwygw9Dui/JIaoNyjpjPmoKldYhog3+LsTlXYsgvV57eRIGRL TyqycCMQP/9ew== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 5C188378208C; Tue, 30 Jan 2024 11:13:43 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 16/18] thermal/drivers/kirkwood: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:48 +0100 Message-ID: <20240130111250.185718-17-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031347_347665_4975369D X-CRM114-Status: GOOD ( 13.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/kirkwood_thermal.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index a18158ebe65f..0e4f24a91bb0 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c @@ -59,6 +59,12 @@ static const struct of_device_id kirkwood_thermal_id_table[] = { static int kirkwood_thermal_probe(struct platform_device *pdev) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "kirkwood_thermal", + .ops = &ops + } + }; struct thermal_zone_device *thermal = NULL; struct kirkwood_thermal_priv *priv; int ret; @@ -71,8 +77,8 @@ static int kirkwood_thermal_probe(struct platform_device *pdev) if (IS_ERR(priv->sensor)) return PTR_ERR(priv->sensor); - thermal = thermal_tripless_zone_device_register("kirkwood_thermal", - priv, &ops, NULL); + tzdp.tzp.devdata = priv; + thermal = thermal_zone_device_register(&tzdp); if (IS_ERR(thermal)) { dev_err(&pdev->dev, "Failed to register thermal zone device\n"); From patchwork Tue Jan 30 11:12:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3BB8BC46CD2 for ; Tue, 30 Jan 2024 11:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KDmNy4yR/YCesuuE7YeEblzKyGsdm+oqgY+aAswuc1E=; b=nJSlVwz3C3obeY x4s0uhL3VI8StJvXAEjHQR+hThE9e7ozoc75TdbaVQI92jhBKS715dgrum2s3+3RxdSXmOE8ZPBw9 ckwaZjSy2viTkG3cYe/Nk0xkYWuDqjUGUPXNcZS4je0EU2aBkX35vrLn455CvN9scyaurFof3FgGY a7mchxFTEeCECLBEWO7osCbnX3oJAPPHhgeLjIPz1DteK6ZlSI8a0CxjlRpJWEOFhcNi+Fgy3PTVi BdXoAisQcYakEUyu+oNdd2Il5GA6K0Apie97NZX01CRSRWTeHLvsS/h7i7lbstRWcvNcqRpNsI+Ti 69LcV+Q0LYtxCgrGetZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm4w-0000000GNEA-00sI; Tue, 30 Jan 2024 11:14:58 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3o-0000000GMPM-3qt8 for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613227; bh=2ZKqENqpAr73vIHtNbsLJ6VTnTTnQUPyIm0ECac1PpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lNNKbDd230nPVBc5Dswzw1++sfC6N1W7A5bjffWPJyPxl1qXg+utW4brmK9q344sh orLi0A4xhEJWRQMRACKu65cbxxI519HRkCPMMUO/ifl5xxEiaAJl/y8MFjOVETSHx7 ZMgVajrBdjGyRpBGeTuvdXyuRxuht8AzFzygiAg6yzt8oA/l3iSe/QwaWZ4L7Nb86i kP2lqQLMebNDDP4GsXjt875WjeRicU9+3fZuvBfuVD8LA1FzCqGla1VB3gTKGyalgO t1CfatFej3rXJSqnpVaaNSoEq17i7YTR6nWhkqr7tvDfH6JRK7QKMPWpqQnN1doOxd 1D+j1fbzGALIA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 92A673782091; Tue, 30 Jan 2024 11:13:45 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 17/18] thermal/drivers/spear: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:49 +0100 Message-ID: <20240130111250.185718-18-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031349_449202_C2C1CCBC X-CRM114-Status: GOOD ( 12.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/spear_thermal.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c index 60a871998b07..7d65f4bc95be 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c @@ -88,6 +88,12 @@ static SIMPLE_DEV_PM_OPS(spear_thermal_pm_ops, spear_thermal_suspend, static int spear_thermal_probe(struct platform_device *pdev) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "spear_thermal", + .ops = &ops + } + }; struct thermal_zone_device *spear_thermal = NULL; struct spear_thermal_dev *stdev; struct device_node *np = pdev->dev.of_node; @@ -122,8 +128,8 @@ static int spear_thermal_probe(struct platform_device *pdev) stdev->flags = val; writel_relaxed(stdev->flags, stdev->thermal_base); - spear_thermal = thermal_tripless_zone_device_register("spear_thermal", - stdev, &ops, NULL); + tzdp.tzp.devdata = stdev; + spear_thermal = thermal_zone_device_register(&tzdp); if (IS_ERR(spear_thermal)) { dev_err(&pdev->dev, "thermal zone device is NULL\n"); ret = PTR_ERR(spear_thermal); From patchwork Tue Jan 30 11:12:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13537320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBDDBC47DDF for ; Tue, 30 Jan 2024 11:15:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=p6+eGtMWheyhQdr8M+XKWMMvLnSx5HSSgaFStzYukzI=; b=CVOUneVA4TJQTQ 6LVbtBjkMlFORcSf8YiCMnaa+7gBmiP819yn57aJLGwpxtP7Usck/mUjnm9u+ekKMLX++68Ou7V/e aST1dx/CPDi+4tjUpBit7rtDYb3h79wLtmncT/H5uPCbRIbJbR4bw6/OByhTmLzv3RF1/WCtV6way 4lTZnlIyTZPgPTBoMRcXCAJ/54fB4Jhha7uajwIdISbC8ejenEwrLpV72HbYrx4wOp1zOXvMujm6y qIUSClDTHCCGp8mhEX6imvDZNMv9eXM9igCZah8+ceuMYHCoifcyRcvUoPS3QC/ReJ+I9pL+yUUGN ihAerLe2I6/97XswIUVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm51-0000000GNIY-0H1c; Tue, 30 Jan 2024 11:15:03 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUm3r-0000000GMRj-0Hdy for linux-arm-kernel@lists.infradead.org; Tue, 30 Jan 2024 11:13:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613229; bh=1MaXaoAlGaux22185ES05zD+Vc6KSQlHot9SWkJLGp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HlU33HM8DXvNnHd5pfL0Un12V2JosWoeboB5m/VaZSU7mn27JZRL7n0hOSbYmEV63 nbQXPRYgNnV9Tg09ybHmHOhmVp5umMRDpOApeet2UUjPgeUG/2TZDKp/Kpyz+HgXZG HjC+6zWpXXGHJzQMPFzdZYEqaqQZxazoLeLlMmgd8mLUOxWzvFSmQESaHg+0Dz/Gh2 HAyBQd2ww0Hzr2aKjZ1depqQEX+Q9jSqA9P+yS8KR91henEbqscmEDj2/qaW9sT9sq 9WWEE88qf6woeJXZQ4+1zKcYguqf9dKIOVMXS0iAcsTnVywM4v2EaqrU0mJlnhEql4 bXn5tAHgulcXA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id CCFE93780FC7; Tue, 30 Jan 2024 11:13:47 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 18/18] thermal/drivers/int340x: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:50 +0100 Message-ID: <20240130111250.185718-19-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_031351_680186_F693257D X-CRM114-Status: GOOD ( 12.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- .../intel/int340x_thermal/int3400_thermal.c | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index 427d370648d5..d8ca7ed37950 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -536,11 +536,6 @@ static struct thermal_zone_device_ops int3400_thermal_ops = { .change_mode = int3400_thermal_change_mode, }; -static struct thermal_zone_params int3400_thermal_params = { - .governor_name = "user_space", - .no_hwmon = true, -}; - static void int3400_setup_gddv(struct int3400_thermal_priv *priv) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -572,6 +567,16 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv) static int int3400_thermal_probe(struct platform_device *pdev) { struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "INT3400 Thermal", + .no_hwmon = true, + .ops = &int3400_thermal_ops, + } + }; + struct thermal_governor_params tgp = { + .governor_name = "user_space" + }; struct int3400_thermal_priv *priv; int result; @@ -609,9 +614,8 @@ static int int3400_thermal_probe(struct platform_device *pdev) evaluate_odvp(priv); - priv->thermal = thermal_tripless_zone_device_register("INT3400 Thermal", priv, - &int3400_thermal_ops, - &int3400_thermal_params); + tzdp.tgp = &tgp; + priv->thermal = thermal_zone_device_register(&tzdp); if (IS_ERR(priv->thermal)) { result = PTR_ERR(priv->thermal); goto free_art_trt;