[v1,12/18] thermal: int340x: processor: Migrate to thermal_zone_device_register()

Message ID 20240130111250.185718-13-angelogioacchino.delregno@collabora.com
State New
Headers
Series [v1,01/18] thermal: core: Change governor name to const char pointer |

Commit Message

AngeloGioacchino Del Regno Jan. 30, 2024, 11:12 a.m. UTC
  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@collabora.com>
---
 .../processor_thermal_device_pci.c            | 26 ++++++++++++-------
 1 file changed, 17 insertions(+), 9 deletions(-)
  

Patch

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;