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

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


On 16/06/2023 16:34, Daniel Lezcano wrote:
The thermal zone device won't be accessible directly anymore.

Use the private data accessor.

To be folded with your next version

Thanks

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);
}

--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog