[PATCH] thermal/drivers/loongson2: Fix thermal zone private data access

From: Daniel Lezcano
Date: Fri Jun 16 2023 - 10:34:34 EST


The thermal zone device won't be accessible directly anymore.

Use the private data accessor.

Cc: zhuyinbo <zhuyinbo@xxxxxxxxxxx>
Cc: Yinbo Zhu <zhuyinbo@xxxxxxxxxxx>
Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
---
drivers/thermal/loongson2_thermal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/loongson2_thermal.c b/drivers/thermal/loongson2_thermal.c
index 6a338e6e490e..9a07409c3bd2 100644
--- a/drivers/thermal/loongson2_thermal.c
+++ b/drivers/thermal/loongson2_thermal.c
@@ -56,7 +56,7 @@ static int loongson2_thermal_set(struct loongson2_thermal_data *data,
static int loongson2_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{
u32 reg_val;
- struct loongson2_thermal_data *data = tz->devdata;
+ struct loongson2_thermal_data *data = thermal_zone_device_priv(tz);

reg_val = readl(data->regs + LOONGSON2_TSENSOR_OUT);
*temp = ((reg_val & 0xff) - 100) * 1000;
@@ -67,7 +67,7 @@ static int loongson2_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
static irqreturn_t loongson2_thermal_irq_thread(int irq, void *dev)
{
struct thermal_zone_device *tzd = dev;
- struct loongson2_thermal_data *data = tzd->devdata;
+ struct loongson2_thermal_data *data = thermal_zone_device_priv(tzd);

/* clear interrupt */
writeb(0x3, data->regs + LOONGSON2_TSENSOR_STATUS);
@@ -79,7 +79,7 @@ static irqreturn_t loongson2_thermal_irq_thread(int irq, void *dev)

static int loongson2_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
{
- struct loongson2_thermal_data *data = tz->devdata;
+ struct loongson2_thermal_data *data = thermal_zone_device_priv(tz);

return loongson2_thermal_set(data, low/1000, high/1000, true);
}
--
2.34.1