[RFC,13/26] thermal: int340x: processor: Migrate to thermal_zone_device_register()

Message ID 20231221124825.149141-14-angelogioacchino.delregno@collabora.com
State New
Headers
Series Add thermal zones names and new registration func |

Commit Message

AngeloGioacchino Del Regno Dec. 21, 2023, 12:48 p.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            | 23 +++++++++++--------
 1 file changed, 14 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..1e7b9172e11d 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,17 @@  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 = {
+		.type = "TCPU_PCI",
+		.tzp = {
+			.governor_name = "user_space",
+			.no_hwmon = true,
+		},
+		.ops = &tzone_ops,
+		.mask = 1,
+	};
 	struct proc_thermal_device *proc_priv;
 	struct proc_thermal_pci *pci_info;
 	int irq_flag = 0, irq, ret;
@@ -289,10 +293,11 @@  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.devdata = pci_info;
+	tzdp.trips = &psv_trip;
+	tzdp.num_trips = 1;
+
+	pci_info->tzone = thermal_zone_device_register(&tzdp);
 	if (IS_ERR(pci_info->tzone)) {
 		ret = PTR_ERR(pci_info->tzone);
 		goto err_del_legacy;