thermal/drivers/broadcom: Use generic thermal_zone_get_trip() function
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 3 Oct 2022 09:25:56 +0000 (11:25 +0200)
committerDaniel Lezcano <daniel.lezcano@kernel.org>
Fri, 6 Jan 2023 13:14:48 +0000 (14:14 +0100)
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@linaro.org>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20221003092602.1323944-24-daniel.lezcano@linaro.org
drivers/thermal/broadcom/bcm2835_thermal.c

index 2c67841a111514f0dde39297154aa00727369d5a..5485e59d03a9272c7a458efc059f6500c7a83288 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/platform_device.h>
 #include <linux/thermal.h>
 
+#include "../thermal_core.h"
 #include "../thermal_hwmon.h"
 
 #define BCM2835_TS_TSENSCTL                    0x00
@@ -224,7 +225,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
         */
        val = readl(data->regs + BCM2835_TS_TSENSCTL);
        if (!(val & BCM2835_TS_TSENSCTL_RSTB)) {
-               int trip_temp, offset, slope;
+               struct thermal_trip trip;
+               int offset, slope;
 
                slope = thermal_zone_get_slope(tz);
                offset = thermal_zone_get_offset(tz);
@@ -232,7 +234,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
                 * For now we deal only with critical, otherwise
                 * would need to iterate
                 */
-               err = tz->ops->get_trip_temp(tz, 0, &trip_temp);
+               err = thermal_zone_get_trip(tz, 0, &trip);
                if (err < 0) {
                        dev_err(&pdev->dev,
                                "Not able to read trip_temp: %d\n",
@@ -249,7 +251,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
                val |= (0xFE << BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT);
 
                /*  trip_adc value from info */
-               val |= bcm2835_thermal_temp2adc(trip_temp,
+               val |= bcm2835_thermal_temp2adc(trip.temperature,
                                                offset,
                                                slope)
                        << BCM2835_TS_TSENSCTL_THOLD_SHIFT;