Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor
From: Balsam CHIHI
Date: Mon Feb 20 2023 - 05:34:53 EST
On Sun, Feb 19, 2023 at 3:37 PM Daniel Lezcano
<daniel.lezcano@xxxxxxxxxx> 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 <daniel.lezcano@xxxxxxxxxx>
> ---
[...]
> drivers/thermal/mediatek/lvts_thermal.c | 4 ++--
[...]
> 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 <bchihi@xxxxxxxxxxxx>