Commit a3b3dd38 authored by Daniel Lezcano's avatar Daniel Lezcano Committed by Daniel Lezcano

thermal/drivers/exynos: of_thermal_get_ntrips()

The thermal core framework allows to get the number of thermal trips,
use it instead of visiting the thermal core structure internals.
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20221003092602.1323944-9-daniel.lezcano@linaro.org
parent ca38255e
...@@ -260,6 +260,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -260,6 +260,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
{ {
struct exynos_tmu_data *data = platform_get_drvdata(pdev); struct exynos_tmu_data *data = platform_get_drvdata(pdev);
struct thermal_zone_device *tzd = data->tzd; struct thermal_zone_device *tzd = data->tzd;
int num_trips = thermal_zone_get_num_trips(tzd);
unsigned int status; unsigned int status;
int ret = 0, temp; int ret = 0, temp;
...@@ -271,12 +272,12 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -271,12 +272,12 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
goto out; goto out;
} }
if (of_thermal_get_ntrips(tzd) > data->ntrip) { if (num_trips > data->ntrip) {
dev_info(&pdev->dev, dev_info(&pdev->dev,
"More trip points than supported by this TMU.\n"); "More trip points than supported by this TMU.\n");
dev_info(&pdev->dev, dev_info(&pdev->dev,
"%d trip points should be configured in polling mode.\n", "%d trip points should be configured in polling mode.\n",
(of_thermal_get_ntrips(tzd) - data->ntrip)); num_trips - data->ntrip);
} }
mutex_lock(&data->lock); mutex_lock(&data->lock);
...@@ -289,7 +290,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -289,7 +290,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
ret = -EBUSY; ret = -EBUSY;
} else { } else {
int i, ntrips = int i, ntrips =
min_t(int, of_thermal_get_ntrips(tzd), data->ntrip); min_t(int, num_trips, data->ntrip);
data->tmu_initialize(pdev); data->tmu_initialize(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment