Skip to content

Commit 7ea98f7

Browse files
Daniel Lezcanodlezcano
authored andcommitted
thermal/drivers/samsung: 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]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent 826855f commit 7ea98f7

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

drivers/thermal/samsung/exynos_tmu.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,9 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
650650
writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
651651
}
652652

653-
static int exynos_get_temp(void *p, int *temp)
653+
static int exynos_get_temp(struct thermal_zone_device *tz, int *temp)
654654
{
655-
struct exynos_tmu_data *data = p;
655+
struct exynos_tmu_data *data = tz->devdata;
656656
int value, ret = 0;
657657

658658
if (!data || !data->tmu_read)
@@ -728,9 +728,9 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
728728
writel(val, data->base + emul_con);
729729
}
730730

731-
static int exynos_tmu_set_emulation(void *drv_data, int temp)
731+
static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp)
732732
{
733-
struct exynos_tmu_data *data = drv_data;
733+
struct exynos_tmu_data *data = tz->devdata;
734734
int ret = -EINVAL;
735735

736736
if (data->soc == SOC_ARCH_EXYNOS4210)
@@ -750,7 +750,7 @@ static int exynos_tmu_set_emulation(void *drv_data, int temp)
750750
}
751751
#else
752752
#define exynos4412_tmu_set_emulation NULL
753-
static int exynos_tmu_set_emulation(void *drv_data, int temp)
753+
static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp)
754754
{ return -EINVAL; }
755755
#endif /* CONFIG_THERMAL_EMULATION */
756756

@@ -997,7 +997,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
997997
return 0;
998998
}
999999

1000-
static const struct thermal_zone_of_device_ops exynos_sensor_ops = {
1000+
static const struct thermal_zone_device_ops exynos_sensor_ops = {
10011001
.get_temp = exynos_get_temp,
10021002
.set_emul_temp = exynos_tmu_set_emulation,
10031003
};
@@ -1091,8 +1091,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
10911091
* data->tzd must be registered before calling exynos_tmu_initialize(),
10921092
* requesting irq and calling exynos_tmu_control().
10931093
*/
1094-
data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
1095-
&exynos_sensor_ops);
1094+
data->tzd = devm_thermal_of_zone_register(&pdev->dev, 0, data,
1095+
&exynos_sensor_ops);
10961096
if (IS_ERR(data->tzd)) {
10971097
ret = PTR_ERR(data->tzd);
10981098
if (ret != -EPROBE_DEFER)
@@ -1104,21 +1104,19 @@ static int exynos_tmu_probe(struct platform_device *pdev)
11041104
ret = exynos_tmu_initialize(pdev);
11051105
if (ret) {
11061106
dev_err(&pdev->dev, "Failed to initialize TMU\n");
1107-
goto err_thermal;
1107+
goto err_sclk;
11081108
}
11091109

11101110
ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq,
11111111
IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data);
11121112
if (ret) {
11131113
dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq);
1114-
goto err_thermal;
1114+
goto err_sclk;
11151115
}
11161116

11171117
exynos_tmu_control(pdev, true);
11181118
return 0;
11191119

1120-
err_thermal:
1121-
thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
11221120
err_sclk:
11231121
clk_disable_unprepare(data->sclk);
11241122
err_clk:
@@ -1136,9 +1134,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
11361134
static int exynos_tmu_remove(struct platform_device *pdev)
11371135
{
11381136
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
1139-
struct thermal_zone_device *tzd = data->tzd;
11401137

1141-
thermal_zone_of_sensor_unregister(&pdev->dev, tzd);
11421138
exynos_tmu_control(pdev, false);
11431139

11441140
clk_disable_unprepare(data->sclk);

0 commit comments

Comments
 (0)