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: 13537260 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B6C5664AE; Tue, 30 Jan 2024 11:13:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613197; cv=none; b=ZZTncZ47W62MGa2Wc7ABxCURX8/bdOu1VXiRuE5AbJqknVhiZWxVJnKyi5cTc32JMuFFlnA760DiyqE8TjOhZ83OwCrhGZI1PjZfxZ27ZHgPVAlp3wRHcxEPzI1Q7fARAEmWt932tnbhnKaUdYxkWEZcaQt5qnCLTLddnznG1VI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613197; c=relaxed/simple; bh=NMhqSFdRSjNI1p1vyp5dOffkk1ADZ0MeWiy+ifEvnrE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a6A+YXIeqtedJSq1x3qSAwDSBg17IFFcZu0iFAc1qPE1fm8iu7FoWRPTrzn8d7GB8bak/k9QxmQtSrJ3LNYtr3tMuDKkxULbL4OW6rVWIESSECkeUb0/neYZQmQTMyH4pV4ldI0fTVLzJYngnDBVTZFm89ECfo4UrZCfjjgU1bU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=Qt0nsFEZ; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Qt0nsFEZ" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537262 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01C15664CC; Tue, 30 Jan 2024 11:13:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613198; cv=none; b=sdlA7vQgYunIVbgatbIaydNbBT0VNSXehnuKyWyVXlYFKvLWm4ZEh3u+bCA2yZXlEG0QlZMCNzg7fENC7BdiDfxSiRFcl4KLQclj0fgRniFGRrSigIuwk1q328tQ9ja/GV19+OVuv/jWA62wTHHQTo2QqLI/qtj74qoQKO+xW8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613198; c=relaxed/simple; bh=B2pHEkbuVDb5/8B80P9qFpRxNFIT7wXDUKIRSMeB/Vk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MSOWrwmgKz/Q7nlazPJTZjqRasJtsLHRRhyfxq39xTt/MYvGGXoiLKWjXUaVYCmLEnRVHWHkdTMB03zQpBtxSGMbLU2M11BeUKyrPJqA0DN725suI02detzNc71N5kxLyjYFLEPz8O5M4s1iCgpDXv9hrGNiWt5atpJ9tcwFs3M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=O3Woz7M2; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="O3Woz7M2" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537263 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 112BD66B5E; Tue, 30 Jan 2024 11:13:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613200; cv=none; b=hbk9tC1LPtbNWJNo7ovBwOYvy9mIfmi1EuKepMJuVR+gPapso26JV0FJd1A3KHMx/EitL1I3dsFoi85qyCXIIimzEESI6yIqHm2UoUu0w8012xcrjDXn0y3teYOE0qbCh5fVj84kVrWbH2ja60undy5EAyB1KNbH2RUgS4GHE2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613200; c=relaxed/simple; bh=K9DIWCqRftNmAdLpTI5zlUjzjPBqeZyH/4bsZP2hZCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XhYsd+XyVo2eL/unuwl4dbCkEjEDskx8WmJA4HqamZW1+aep1nx+AL+6xRpIyduesr7XjoeAaKg0NoxkoBtYHUfT06lUT8b0k4p3IEz/VU9FeFTYQfA/6blUx9a3cJ4IkCVYlQTr8ljz1zwj8vmRAnNUJWH+KqGCAtgPMYavYno= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=Z9tPo+Z7; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Z9tPo+Z7" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537264 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C64B46772E; Tue, 30 Jan 2024 11:13:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613202; cv=none; b=Elje3v4VWVNvGCRgdoMP+5xkvopBH3xB50kshXwdBFKnBp8YSqC7yYI5uC1WWKftonHkXGuBF8lD4eUxLR2d4iy7rFVivx0sTmSGCLOBg1Hlkvv3/wPdfuc9K3rIdFSyl4Xc35InscJw5y3l07KhXOsF6tWcjD51HKyhmq9kUTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613202; c=relaxed/simple; bh=mEtrz7xMtfcpY7sT1iZb5MnMblxKwwvnwtCVasYjkwk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OUC7sXZshlbygV2lAcoCd0GkEHnJJ+2Vb9tpD9T9ZQ53cZyTp1luf8CiHi97fdKwqzzCH7uKvTCgCIgtxg3NSLv4Zkn69jjUYQAe3oJbSomAe8/emPVGWH2ye3obBb1bMU/QGukXqlO1Ex0ZAaZwbpczl9DmwcZjkWe4+KWRhhc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=sqhLf9jG; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="sqhLf9jG" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537265 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D2B367A0B; Tue, 30 Jan 2024 11:13:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613204; cv=none; b=bXUyspxzM9KPy8nVY1IdewpdJrrXVltlhwm+7vRv1ZX+kaEi+46CWckP2854cZIKTLWW++wcGZ5nR+pl5azVCMJB0XbFLtv4KaESd6T0yNh+8dJRdbA9OMHp9bxirSv7Q2tZ8gQUkUimAxTfHvEvw1ohAqfU2emkKy4JJrN5/lU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613204; c=relaxed/simple; bh=X32Bcgql6uQHTDnzXYAHs6Ep92uAw8IaBvn5qiYUvoE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oU+ICtqbzYe+y5kq/Z0xJJeC89QeA6P17Awb0PLsczbXjghqFAsGVsDDzBQWGBd94XMDUzZYWU9rhzUEj0eHPz79pAUEz5vq21/XC+uKwW8nMtxVofEEVkxlQos1l/n0rmbRqYaPxYb0rbCQhtzcDsjv+Mlzfx+VdfMK2J1UAik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=ktna+Kv7; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="ktna+Kv7" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537266 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 968FC6A036; Tue, 30 Jan 2024 11:13:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613206; cv=none; b=Eme6cqG85gRvkZtz8jYG9aCspK14+NdBr/ldqWggMrjt9Ac2tNKhYEW6lRuc6o9nFO5iT3NKFZ3HsZxV7Sw8+A79WuW+YyqzmnBMQUaDex9JE3lqyG/O29/h1Iq0Efnkp540G0YPCMeuc1mtSNALhVYqBlKMZuS/OG+IwcreB7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613206; c=relaxed/simple; bh=r/xN4hRek8FnzGLHk7xH3AKDZREzhfirE5eGw3Eh9wk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fPrxubwrE3p2hAICLgaCTFlA4zcuMYZddKeWtOQ/9yRUbL9lZuJaoIqMa31zNtdV8shel4CWZy0ff6uvoiFsgSmtdqRd7sFTwuJc93fYJJ/SQlHkOD0tjFt42leO7mpJZ+bdJQVR2XD8p2nOmq5l1gVEzu/Lcnbr8hArN1gYVts= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=eOE1anLR; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="eOE1anLR" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537267 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F30AF6A35F; Tue, 30 Jan 2024 11:13:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613208; cv=none; b=lH0sDFFCpz6KJ+s5NQreeJNo6oRfXQTUD2ZJGVQQ0kSJVKfj3EH72mJ1ZTkq6LCKpcSmtrXbPpn0gIAGsr30zDZb+l6ZDH/F+iRJOSVJc65YCfo/XOrlx7D0DKjM7GLkm9yA+gz4RFWSyH7y4YaYj/ZDSEMaH4Q8Y0kI/xKQ8u0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613208; c=relaxed/simple; bh=SKppNY4y88YWZiAw2UK5DtE27VayRH8M42y87uCkgxQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GliNzxGXyUX7aOe6q7vxxZhRrQjM2YR/l2cZKiXXqfFFtsb7RzpW0jC8FbKd8rXRNVD/gKl0d+tWso16plAVMtvSm/D8tJEXXVOqlloYL0HlezcKDPcvfHm2MkQ4DQdqXBAxKIE9e2loBBGpaUx5/xO072cZIsB5cmQTgsJ85Dc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=lVC64xCk; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="lVC64xCk" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537268 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18A436BB4B; Tue, 30 Jan 2024 11:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613211; cv=none; b=qgz5RtnZbliwZAK8pRS3glGgo/li0zbe5hvgZ/Wo1AY5arNt6BmjQta26PLt4AM77OgEzQbxxC5MwyPeha2MTe7FwMcebqFz9/04PgO/WBsIonqy8xCgi9nuJstfmAKx0aXHDSAQGrcVrraqi6LpKRtHu+VIR68VpL8PqgDcRu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613211; c=relaxed/simple; bh=tALIom+m2UHdd4MK7i96Hl0n8kwKYP1fIX+bHaIVr5c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TSRwgsKrdKhNH5OMWQ/AyavFD80puuCq3GmmNfeC7/kuSwCxPxuxpQU7Uy25TjK0oCkbQNOuMI/l737eBFP+amB7pQl/3MdkZkeeQogyrVx+DSrinZtSWLLmRIzMBhiI8M6pTELn9Wc4vhjv+j+yT5w/PmY+n7Mr/j+95atMJIM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=rUFMvo3s; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="rUFMvo3s" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537269 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7365D6D1C2; Tue, 30 Jan 2024 11:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613213; cv=none; b=idnZdRo5ZzvIy01zCX3gB3tmp85ewV8VlQ8+4Mp2CfPGifoAlkrJOwk4HAOXNff2CftbtxNligzgX1VOWOlg9FyBTB9yVDNA1GoqbBCm0tlkIAso97eDZLYSPzuedqzPDms7S/CaqkQ9ryc58C2A5KMcccAzsVFXobBmCqEbUzs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613213; c=relaxed/simple; bh=8N3xJcRXf5FIbTK9mPZ0ZQQ16s2NrrH6F3ME5uc5zQE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GQS5DZL0appBnpHmLD51H0QB2KhZColBWmle1B/P01nzzBDaHmYvVcaQeUTelU0oTqoagDVqr7zlBdMZeumU6fkaBKWAE7Erb87oQ6nGqETKooh/CtfeLZYrZz9lclNbPehjmQIT53RFRPSZZSdWwIzfchGM943rxoJotKCOliE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=tWaiuBHN; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="tWaiuBHN" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537270 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF4166DD09; Tue, 30 Jan 2024 11:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613215; cv=none; b=ZgBlxaFh11kKCwPQ48q92nK3gRicQO38pYtnHXcNkEnMA+zBep3zeV5WSIo5z2QZJYhrZIwFNWahhRqc7S3f+XAUEQO/82PK8bqiIk/k17JSL0fHk7k5heuG66IFKqgT3WuqT1crTKUst6vObbtLHKIna7E+XrQhkmDbjJfbwlI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613215; c=relaxed/simple; bh=xF+/wSXIq5fE1Hx9RSY2i9M69cbEXmtjt5ngzeA8uxo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qREj2fU4Okjw9eOl2i0lhkp5CMxDl5ihQBZmI5XfZrPRP1Ef6/KLL2R7SFLEkOGEi7cUBWfXWH2Jox0RkgPzb9q4uE/cnepsKdPdtrHTzFLDOhdBW62HVgfJnYmbnbIVDttneMfkKH43hhwKhiLnPLQbDbRRX3TpM570MYPlqog= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=qPNQW+T2; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="qPNQW+T2" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537271 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0FF56EB65; Tue, 30 Jan 2024 11:13:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613217; cv=none; b=rZQwgzPo6l44BJPVTAyMS+3yEqNSMClciEx0ufiUfbum2+9oMWJ9tm5TPpsiHcJqjZk1xLX0AHJc3stxiASJAXEkzKRyhZh8UgLMR8ld+bPY291KQ70fb6Ow0NNFlREXP3svVbSNqwNhirNR4E8/fT4Ca8iIt3lQv5dbvwuyALU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613217; c=relaxed/simple; bh=Cr03L1qxC5Q5WcLgoejwkJaADJOROHbQJiExrCsEGkM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W5l/3C8Yhq0VRCmLNk50JOrmmIuURjyn/XHCQBcq820Cg1iNzRLBkWViKbJIQeOmTfJ+r43jCd0V/wsClkBFRDwrzwLSHAmRMCNpnnQltWioua7iQMPwIU2T0+5+8lT3XH2EwpZIleeGco3gncF2JD52WuybzoNPnC3mLIQSQTQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=oEg3xFX7; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="oEg3xFX7" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537272 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0F6274E0D; Tue, 30 Jan 2024 11:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613219; cv=none; b=NTmg5F1FQWf83lhqxDdjVXonyiSZsDSUnZw6mY6aZxBqcsMEHXImpA07CxQRWU0r2aL+0l7c8rcpeXV0FNO15ixX2RgLFXo4YYTJP6uX0Ze9pPrIIyHwfGI1r842Kk+UqZ409GASG1e4eThcZs0R3nLy6M7WufDEHRVtJSZOVHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613219; c=relaxed/simple; bh=jX8eexMy1avLh8dlPbkEyo4c5yBA7XPn/CK+R650NbY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FNVaqNxAXpB49wac9i9G/Vzsk/7M0p5ZowglsoYR6W1/Ubu4roTmCrn7AVqBYFtlSfhi9SY6JtRlrp6+aI8LvSeEpvib+aEqWz7CofqGFlaMHiXVJltpNCJ8aWjBzCP/VTtdFR3TzMHE3SpzSZNgMMtKQCT4QxBA32/2Pei29bU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=1lPMjJgz; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="1lPMjJgz" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537273 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18FEE76040; Tue, 30 Jan 2024 11:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613221; cv=none; b=V/PMxD0o3Lf3swVFYHXl1UiJrRqwvelONKLbzJudhtwzlkZ1K9j+2v6+7Nzj9VmFvcVjqlw592tibO2hWWaPlY99tdQCUqa2P8iDatjSpCZ04BhtIoKlWjdNh08aOVtqRTVaXWAHe5zKR5/jABScvllLYn+mni7bWWnYrl2PvyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613221; c=relaxed/simple; bh=ltmDsQGVDHJUuzGsD5EBKmLtvB2i4AwTm6AwkiKQz8A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dF54fArChTJG3uzj0bPxfd6536DHv1YjxAkCdri0B6E6pUf9huEDj1BuiZnBEip/EHU003LS6faTBZ4ruZjXxqUgBA3SWn1FuuRBHZDkPDLCBnlCo10ndnaN88byTcjjDrWotx2/5A9T31b6kQVgpQs57jUrOm00S/QrSPeuK5w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=k+Pvr5PF; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="k+Pvr5PF" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537274 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F54B77627; Tue, 30 Jan 2024 11:13:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613224; cv=none; b=ejeeEIxbKDEHeUJAb8M9VSTILcYdTJ1vIND+Q3mv7FlGYehPK33L0gnHto9SgVJXgSCdesIvf9SArUJhGTyTSg4EhuZvQosY4xv8P4UOwYh+piYHINS1O0E33bnWQW0JN1Ig4ith8zDU2xScKVWLhU1fhzM2tGy5/ciF/qPtjF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613224; c=relaxed/simple; bh=+RsoYewyOO14ouzshvdt3gaki76JepljIejGBDHOp2g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ede6puU50NDxRJ8M28WgJ+JZhUjQibl5cKmsNbWHhyK0tuDOy04pP11mH18RTHd5fXXfdnSWi42+sWUqINclT8rbUm0C9esH1BZJwVKpZbeT0sMzBx7xVUBtujq/0dUDSP4Pyqx9saVJVoOdMTEBAHGx+O9aMDnQRaycPOvJdAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=mQShp5b1; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="mQShp5b1" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537275 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 865BB7C0A9; Tue, 30 Jan 2024 11:13:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613226; cv=none; b=WZ7CPUScgOcVjxiqyJGn+QteU3xrv5YA18dyy6c4fobGNoWIavmFEP8PdEaUJIAu1BCI1+IYTL0D5A+wqMbpkCHu62muqRxCcfakFXDCSgj6/8ebBGXqYzcYOgvB1vOb9XzIpGlIsNxAck1nroh37I+RXjHFxeDilFYrVJlF6ak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613226; c=relaxed/simple; bh=74pBxa4eqyP7xDLl0IJ2wAmK6Mm6EIaDrqz4NKVOn8c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AwRgR6yiquABPiIngOzXybT+KGemkpOcdt8EGY85ejuI+pybNHfCV5ujc6zw4zgES8+T79M+7RypYCouZ4pJ0be+0JMc4lAWi/z4cicDELZEscKwTu8fk2onKssjzgk+kyZUVhJUsjtA+5vmNpqpEK50OW3JKUVvvhhs0kKUalw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=pG6nb0WX; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="pG6nb0WX" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537276 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7EFC7E578; Tue, 30 Jan 2024 11:13:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613228; cv=none; b=FIyGAxUuAJ5PzWnAyEXyscpdVys9vbv1kcMERFEcOg7aEtmb1lUsA4mug33QaqAxQoJyvn68iGQZivcPqlbCJ8nH32RSzdgEsscbac/NIVX2Pip5D8mXPl341XxhYFB0dhXPXbIQdVkdzkHQ2M7b9mZVvBcOpifO5bt6MWFCyAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613228; c=relaxed/simple; bh=lvc56XBEENzj3l1vBHl7W+VJWa9O58KHS2L6cWEnb0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qCI2lDpPsqLzNCmHAOZDTU+9nYyV3nm+x8H4qrtTj4xihiEaGvyCr+CIcvw407FiFJBunYXeRwmYwkbh+KOZvi9wfAo05PYgEQeV8nyo/1Uzkrp3AxcNAH9EhubAJI7qlVDCk4ZT3ynLszu3GJZsOjq+g2payNYoIeHJITUce6M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=s72H3QsU; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="s72H3QsU" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537277 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 376E281AB6; Tue, 30 Jan 2024 11:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613230; cv=none; b=bXTqBA7jp54pcN82n5KJM1st9DraB6YKNgzkxpcwrngPx120Em6qlQfHTjg23Op+QX8KHqiLPSKh6F3d/c6xeKDJ9UKU/cO/b+EyeOyWjWz3pQhKvarBj207tvwH/bV8dixGFtJPI/N7vfX+tdG9lE4/6lZrncNIWoGPq9C9x2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613230; c=relaxed/simple; bh=2ZKqENqpAr73vIHtNbsLJ6VTnTTnQUPyIm0ECac1PpE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i7oHnU2mWIhlUy6ORMc5ZyV2QtDcH8ULzvD+D6ISxXcvybgaGc/YF6B+kXpPE/shwHnlpkAxa2M7yQwlsvPvDJYd8j9nq/LxG117lv9LO3o6+iBL/FpDV1Zyfcsce90vG6xtRhuS+wmjTWg/PeGTSqDxewWZP6bbw5m+S8oqMNM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=lNNKbDd2; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="lNNKbDd2" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13537278 X-Patchwork-Delegate: geert@linux-m68k.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38AE56EB50; Tue, 30 Jan 2024 11:13:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613232; cv=none; b=de3e41KbJzTCrRGcIsvKrM9xsWOQw5+8tayIIFiSQmmPcpkw5yp/0s8non8PoE/PuLJyTT6GXUm9fq0mV+TIxMoiAekGjXViBmSJfBzIo9gqxjumNZwoSGa3JsfjxP+diVBZaNaZV8MA6C57ejNjt01K53L79WaY8n6ptMLiGG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613232; c=relaxed/simple; bh=1MaXaoAlGaux22185ES05zD+Vc6KSQlHot9SWkJLGp0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m/TtpW19r7WBY8lBgKcbGa/sVEKE1PDQeaiJpBOxQuOiBUbPQfTLJhPxXuP4wFISCSYKQHSaG/DmtCkSrroMqUh+R1XomHpaslMYLMouxDHz49bS1AkK2C+CJDgdLvHUGUrgCUq0qKLsMU+aPEHVIg4p9pbGwMx0qGnw8iDmPVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=HlU33HM8; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="HlU33HM8" 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> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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;