Thread (16 messages) 16 messages, 12 authors, 2023-02-20

Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor

flat view

From: Balsam CHIHI <hidden>
Date: 2023-02-20 10:34:53
Also in: linux-acpi, linux-arm-msm, linux-hwmon, linux-ide, linux-iio, linux-mediatek, linux-omap, linux-pm, linux-renesas-soc, linux-samsung-soc, linux-sunxi, linux-tegra, linux-wireless, lkml, netdev

On Sun, Feb 19, 2023 at 3:37 PM Daniel Lezcano
[off-list ref] wrote:
The thermal zone device structure is exposed to the different drivers
and obviously they access the internals while that should be
restricted to the core thermal code.

In order to self-encapsulate the thermal core code, we need to prevent
the drivers accessing directly the thermal zone structure and provide
accessor functions to deal with.

Provide an accessor to the 'devdata' structure and make use of it in
the different drivers.

No functional changes intended.

Signed-off-by: Daniel Lezcano <redacted>
---
[...]
 drivers/thermal/mediatek/lvts_thermal.c          |  4 ++--
[...]
quoted hunk ↗ jump to hunk
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index 84ba65a27acf..86d280187c83 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -252,7 +252,7 @@ static u32 lvts_temp_to_raw(int temperature)

 static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-       struct lvts_sensor *lvts_sensor = tz->devdata;
+       struct lvts_sensor *lvts_sensor = thermal_zone_device_get_data(tz);
        void __iomem *msr = lvts_sensor->msr;
        u32 value;
@@ -290,7 +290,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)

 static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
 {
-       struct lvts_sensor *lvts_sensor = tz->devdata;
+       struct lvts_sensor *lvts_sensor = thermal_zone_device_get_data(tz);
        void __iomem *base = lvts_sensor->base;
        u32 raw_low = lvts_temp_to_raw(low);
        u32 raw_high = lvts_temp_to_raw(high);
for MediaTek LVTS :

Reviewed-by: Balsam CHIHI <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help