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

Sebastian Reichel sebastian.reichel at collabora.com
Mon Feb 20 05:23:25 PST 2023


Hi,

On Sun, Feb 19, 2023 at 03:36:41PM +0100, Daniel Lezcano 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 at linaro.org>
> ---

...

>  drivers/power/supply/power_supply_core.c         |  2 +-

...

> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index 7c790c41e2fe..166f0aacc797 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -1142,7 +1142,7 @@ static int power_supply_read_temp(struct thermal_zone_device *tzd,
>  	int ret;
>  
>  	WARN_ON(tzd == NULL);
> -	psy = tzd->devdata;
> +	psy = thermal_zone_device_get_data(tzd);
>  	ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &val);
>  	if (ret)
>  		return ret;

Acked-by: Sebastian Reichel <sebastian.reichel at collabora.com>

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20230220/7c74558d/attachment.sig>


More information about the Linux-mediatek mailing list