[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63d459cc-23f0-ce8d-9fe4-b0015b4e41ab@kernel.org>
Date: Fri, 12 Aug 2022 13:01:35 +0300
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Daniel Lezcano <daniel.lezcano@...aro.org>, rafael@...nel.org
Cc: rui.zhang@...el.com, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Bartlomiej Zolnierkiewicz <bzolnier@...il.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Amit Kucheria <amitk@...nel.org>,
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 v2 07/26] thermal/drivers/exynos: Use generic
thermal_zone_get_trip() function
On 10/08/2022 01:04, Daniel Lezcano wrote:
> The thermal framework gives the possibility to register the trip
> points with the thermal zone. When that is done, no get_trip_* ops are
> needed and they can be removed.
>
> Convert ops content logic into generic trip points and register them with the
> thermal zone.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
> ---
> drivers/thermal/samsung/exynos_tmu.c | 41 ++++++++++------------------
> 1 file changed, 15 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 51874d0a284c..5204e343d5b0 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -260,16 +260,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
> {
> struct exynos_tmu_data *data = platform_get_drvdata(pdev);
> struct thermal_zone_device *tzd = data->tzd;
> - const struct thermal_trip * const trips =
> - of_thermal_get_trip_points(tzd);
> unsigned int status;
> - int ret = 0, temp, hyst;
> -
> - if (!trips) {
> - dev_err(&pdev->dev,
> - "Cannot get trip points from device tree!\n");
> - return -ENODEV;
> - }
> + int ret = 0, temp;
>
> if (data->soc != SOC_ARCH_EXYNOS5433) /* FIXME */
> ret = tzd->ops->get_crit_temp(tzd, &temp);
> @@ -303,19 +295,16 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
>
> /* Write temperature code for rising and falling threshold */
> for (i = 0; i < ntrips; i++) {
> - /* Write temperature code for rising threshold */
> - ret = tzd->ops->get_trip_temp(tzd, i, &temp);
> - if (ret)
> - goto err;
> - temp /= MCELSIUS;
> - data->tmu_set_trip_temp(data, i, temp);
>
> - /* Write temperature code for falling threshold */
> - ret = tzd->ops->get_trip_hyst(tzd, i, &hyst);
> + struct thermal_trip trip;
> +
> + ret = thermal_zone_get_trip(tzd, i, &trip);
> if (ret)
> goto err;
> - hyst /= MCELSIUS;
> - data->tmu_set_trip_hyst(data, i, temp, hyst);
> +
> + data->tmu_set_trip_temp(data, i, trip.temperature / MCELSIUS);
> + data->tmu_set_trip_hyst(data, i, trip.temperature / MCELSIUS,
> + trip.hysteresis / MCELSIUS);
> }
>
> data->tmu_clear_irqs(data);
> @@ -360,21 +349,21 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
> }
>
> static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data,
> - int trip, u8 temp)
> + int trip_id, u8 temp)
> {
> - const struct thermal_trip * const trips =
> - of_thermal_get_trip_points(data->tzd);
> + struct thermal_trip trip;
> u8 ref, th_code;
>
> - ref = trips[0].temperature / MCELSIUS;
> -
> - if (trip == 0) {
> + thermal_zone_get_trip(data->tzd, 0, &trip);
This can return error and trip will be uninitialized.
Best regards,
Krzysztof
Powered by blists - more mailing lists