[RFC PATCH 03/26] platform/x86: acerhdf: Migrate to thermal_zone_device_register()

From: AngeloGioacchino Del Regno
Date: Thu Dec 21 2023 - 07:49:12 EST


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 <angelogioacchino.delregno@xxxxxxxxxxxxx>
---
drivers/platform/x86/acerhdf.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 74bcb3d13104..f7c1710f736c 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -267,14 +267,6 @@ static const struct bios_settings bios_tbl[] __initconst = {
{"", "", "", 0, 0, {0, 0}, 0}
};

-/*
- * this struct is used to instruct thermal layer to use bang_bang instead of
- * default governor for acerhdf
- */
-static struct thermal_zone_params acerhdf_zone_params = {
- .governor_name = "bang_bang",
-};
-
static int acerhdf_get_temp(int *temp)
{
u8 read_temp;
@@ -669,6 +661,18 @@ static void acerhdf_unregister_platform(void)

static int __init acerhdf_register_thermal(void)
{
+ struct thermal_zone_device_params tzdp = {
+ .type = "acerhdf",
+ /*
+ * this struct is used to instruct thermal layer to use
+ * bang_bang instead of default governor for acerhdf
+ */
+ .tzp = { .governor_name = "bang_bang" },
+ .ops = &acerhdf_dev_ops,
+ .trips = trips,
+ .num_trips = ARRAY_SIZE(trips),
+ .polling_delay = kernelmode ? interval * 1000 : 0,
+ };
int ret;

cl_dev = thermal_cooling_device_register("acerhdf-fan", NULL,
@@ -677,10 +681,7 @@ static int __init acerhdf_register_thermal(void)
if (IS_ERR(cl_dev))
return -EINVAL;

- thz_dev = thermal_zone_device_register_with_trips("acerhdf", trips, ARRAY_SIZE(trips),
- 0, NULL, &acerhdf_dev_ops,
- &acerhdf_zone_params, 0,
- (kernelmode) ? interval*1000 : 0);
+ thz_dev = thermal_zone_device_register(&tzdp);
if (IS_ERR(thz_dev))
return -EINVAL;

--
2.43.0