lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <90c85105-b9f4-e7cb-fa93-17127b3b369d@linaro.org>
Date:   Mon, 11 Jul 2022 12:41:57 +0200
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     Daniel Lezcano <daniel.lezcano@...exp.org>,
        daniel.lezcano@...aro.org, rafael@...nel.org
Cc:     rui.zhang@...el.com, khilman@...libre.com, abailon@...libre.com,
        amitk@...nel.org, linux-kernel@...r.kernel.org,
        linux-pm@...r.kernel.org,
        Bartlomiej Zolnierkiewicz <bzolnier@...il.com>,
        Alim Akhtar <alim.akhtar@...sung.com>,
        "open list:SAMSUNG THERMAL DRIVER" 
        <linux-samsung-soc@...r.kernel.org>,
        "moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v1 31/33] thermal/drivers/samsung: Switch to new of
 thermal API

On 10/07/2022 23:24, Daniel Lezcano wrote:
> The thermal OF code has a new API allowing to migrate the OF
> initialization to a simpler approach.
> 
> Use this new API.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@...exp.org>
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index f4ab4c5b4b62..2bd7b3b57b28 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -650,9 +650,9 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
>  	writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
>  }
>  
> -static int exynos_get_temp(void *p, int *temp)
> +static int exynos_get_temp(struct thermal_zone_device *tz, int *temp)
>  {
> -	struct exynos_tmu_data *data = p;
> +	struct exynos_tmu_data *data = tz->devdata;
>  	int value, ret = 0;
>  
>  	if (!data || !data->tmu_read)
> @@ -728,9 +728,9 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
>  	writel(val, data->base + emul_con);
>  }
>  
> -static int exynos_tmu_set_emulation(void *drv_data, int temp)
> +static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp)
>  {
> -	struct exynos_tmu_data *data = drv_data;
> +	struct exynos_tmu_data *data = tz->devdata;
>  	int ret = -EINVAL;
>  
>  	if (data->soc == SOC_ARCH_EXYNOS4210)
> @@ -750,7 +750,7 @@ static int exynos_tmu_set_emulation(void *drv_data, int temp)
>  }
>  #else
>  #define exynos4412_tmu_set_emulation NULL
> -static int exynos_tmu_set_emulation(void *drv_data, int temp)
> +static int exynos_tmu_set_emulation(struct thermal_zone *tz, int temp)
>  	{ return -EINVAL; }
>  #endif /* CONFIG_THERMAL_EMULATION */
>  
> @@ -997,7 +997,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static const struct thermal_zone_of_device_ops exynos_sensor_ops = {
> +static struct thermal_zone_device_ops exynos_sensor_ops = {
>  	.get_temp = exynos_get_temp,
>  	.set_emul_temp = exynos_tmu_set_emulation,
>  };
> @@ -1091,8 +1091,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>  	 * data->tzd must be registered before calling exynos_tmu_initialize(),
>  	 * requesting irq and calling exynos_tmu_control().
>  	 */
> -	data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
> -						    &exynos_sensor_ops);
> +	data->tzd = devm_thermal_of_zone_register(&pdev->dev, 0, data,
> +						  &exynos_sensor_ops);
>  	if (IS_ERR(data->tzd)) {
>  		ret = PTR_ERR(data->tzd);
>  		if (ret != -EPROBE_DEFER)
> @@ -1118,7 +1118,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>  	return 0;
>  
>  err_thermal:
> -	thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
> +	thermal_of_zone_unregister(data->tzd);

You use now devm, so this should not be needed.

>  err_sclk:
>  	clk_disable_unprepare(data->sclk);
>  err_clk:
> @@ -1138,7 +1138,7 @@ static int exynos_tmu_remove(struct platform_device *pdev)
>  	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
>  	struct thermal_zone_device *tzd = data->tzd;
>  
> -	thermal_zone_of_sensor_unregister(&pdev->dev, tzd);
> +	thermal_of_zone_unregister(tzd);

This as well.



Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ