diff mbox series

thermal/drivers/loongson2: Fix thermal zone private data access

Message ID 20230616143407.689515-1-daniel.lezcano@linaro.org
State New
Headers show
Series thermal/drivers/loongson2: Fix thermal zone private data access | expand

Commit Message

Daniel Lezcano June 16, 2023, 2:34 p.m. UTC
The thermal zone device won't be accessible directly anymore.

Use the private data accessor.

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

Comments

Daniel Lezcano June 16, 2023, 2:35 p.m. UTC | #1
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@loongson.cn>
> Cc: Yinbo Zhu <zhuyinbo@loongson.cn>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>   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);
>   }
Yinbo Zhu June 17, 2023, 1:52 a.m. UTC | #2
在 2023/6/16 下午10:35, Daniel Lezcano 写道:
> 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
> 


okay, If I understand correctly, I will make this patch as a independent
[3/3] patch of the v15 series patch.

Thanks,
Yinbo
Daniel Lezcano June 17, 2023, 7:12 a.m. UTC | #3
On 17/06/2023 03:52, zhuyinbo wrote:
> 
> 
> 在 2023/6/16 下午10:35, Daniel Lezcano 写道:
>> 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
>>
> 
> 
> okay, If I understand correctly, I will make this patch as a independent
> [3/3] patch of the v15 series patch.

It is better to merge it with your patch 2 in order to prevent a git 
bisecting error (no need to add a my signoff or whatever)
Yinbo Zhu June 17, 2023, 7:23 a.m. UTC | #4
在 2023/6/17 下午3:12, Daniel Lezcano 写道:
> On 17/06/2023 03:52, zhuyinbo wrote:
>>
>>
>> 在 2023/6/16 下午10:35, Daniel Lezcano 写道:
>>> 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
>>>
>>
>>
>> okay, If I understand correctly, I will make this patch as a independent
>> [3/3] patch of the v15 series patch.
> 
> It is better to merge it with your patch 2 in order to prevent a git 
> bisecting error (no need to add a my signoff or whatever)


okay, I got it.

Thanks,
Yinbo
>
diff mbox series

Patch

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