57bc910d3e3cc47f495a268060d1fbca10f507d5
[openwrt/staging/blocktrron.git] /
1 From 7d78bab533eb9aa0e5240e25a204e8f416723ed6 Mon Sep 17 00:00:00 2001
2 From: Daniel Lezcano <daniel.lezcano@linaro.org>
3 Date: Wed, 1 Mar 2023 21:14:30 +0100
4 Subject: [PATCH 07/42] thermal/core: Use the thermal zone 'devdata' accessor
5 in thermal located drivers
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 The thermal zone device structure is exposed to the different drivers
11 and obviously they access the internals while that should be
12 restricted to the core thermal code.
13
14 In order to self-encapsulate the thermal core code, we need to prevent
15 the drivers accessing directly the thermal zone structure and provide
16 accessor functions to deal with.
17
18 Use the devdata accessor introduced in the previous patch.
19
20 No functional changes intended.
21
22 [skipped drivers not relevant for mediatek target]
23
24 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
25 Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> #R-Car
26 Acked-by: Mark Brown <broonie@kernel.org>
27 Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> #MediaTek auxadc and lvts
28 Reviewed-by: Balsam CHIHI <bchihi@baylibre.com> #Mediatek lvts
29 Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> #da9062
30 Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> #spread
31 Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> #sun8i_thermal
32 Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
33 Acked-by: Florian Fainelli <f.fainelli@gmail.com> #Broadcom
34 Reviewed-by: Dhruva Gole <d-gole@ti.com> # K3 bandgap
35 Acked-by: Linus Walleij <linus.walleij@linaro.org>
36 Acked-by: Heiko Stuebner <heiko@sntech.de> #rockchip
37 Reviewed-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> #uniphier
38 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
39 ---
40 drivers/thermal/mediatek/auxadc_thermal.c | 2 +-
41 drivers/thermal/mediatek/lvts_thermal.c | 4 ++--
42 43 files changed, 71 insertions(+), 73 deletions(-)
43
44 --- a/drivers/thermal/mediatek/auxadc_thermal.c
45 +++ b/drivers/thermal/mediatek/auxadc_thermal.c
46 @@ -763,7 +763,7 @@ static int mtk_thermal_bank_temperature(
47
48 static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature)
49 {
50 - struct mtk_thermal *mt = tz->devdata;
51 + struct mtk_thermal *mt = thermal_zone_device_priv(tz);
52 int i;
53 int tempmax = INT_MIN;
54
55 --- a/drivers/thermal/mediatek/lvts_thermal.c
56 +++ b/drivers/thermal/mediatek/lvts_thermal.c
57 @@ -252,7 +252,7 @@ static u32 lvts_temp_to_raw(int temperat
58
59 static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
60 {
61 - struct lvts_sensor *lvts_sensor = tz->devdata;
62 + struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz);
63 void __iomem *msr = lvts_sensor->msr;
64 u32 value;
65
66 @@ -290,7 +290,7 @@ static int lvts_get_temp(struct thermal_
67
68 static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
69 {
70 - struct lvts_sensor *lvts_sensor = tz->devdata;
71 + struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz);
72 void __iomem *base = lvts_sensor->base;
73 u32 raw_low = lvts_temp_to_raw(low);
74 u32 raw_high = lvts_temp_to_raw(high);