Skip to content

Commit de15b84

Browse files
Daniel Lezcanodlezcano
authored andcommitted
iio/drivers/sun4i_gpadc: Switch to new of thermal API
The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Acked-by: Jernej Skrabec <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent e518133 commit de15b84

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/iio/adc/sun4i-gpadc-iio.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)
412412
return 0;
413413
}
414414

415-
static int sun4i_gpadc_get_temp(void *data, int *temp)
415+
static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp)
416416
{
417-
struct sun4i_gpadc_iio *info = data;
417+
struct sun4i_gpadc_iio *info = tz->devdata;
418418
int val, scale, offset;
419419

420420
if (sun4i_gpadc_temp_read(info->indio_dev, &val))
@@ -428,7 +428,7 @@ static int sun4i_gpadc_get_temp(void *data, int *temp)
428428
return 0;
429429
}
430430

431-
static const struct thermal_zone_of_device_ops sun4i_ts_tz_ops = {
431+
static const struct thermal_zone_device_ops sun4i_ts_tz_ops = {
432432
.get_temp = &sun4i_gpadc_get_temp,
433433
};
434434

@@ -637,9 +637,9 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
637637
pm_runtime_enable(&pdev->dev);
638638

639639
if (IS_ENABLED(CONFIG_THERMAL_OF)) {
640-
info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
641-
0, info,
642-
&sun4i_ts_tz_ops);
640+
info->tzd = devm_thermal_of_zone_register(info->sensor_device,
641+
0, info,
642+
&sun4i_ts_tz_ops);
643643
/*
644644
* Do not fail driver probing when failing to register in
645645
* thermal because no thermal DT node is found.
@@ -681,8 +681,6 @@ static int sun4i_gpadc_remove(struct platform_device *pdev)
681681
if (!IS_ENABLED(CONFIG_THERMAL_OF))
682682
return 0;
683683

684-
thermal_zone_of_sensor_unregister(info->sensor_device, info->tzd);
685-
686684
if (!info->no_irq)
687685
iio_map_array_unregister(indio_dev);
688686

0 commit comments

Comments
 (0)