linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2] thermal: consistently use int for trip temp
       [not found] ` <56DD3A84.4080304@nvidia.com>
@ 2016-03-08  3:24   ` Wei Ni
  2016-03-08 21:09     ` Eduardo Valentin
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Ni @ 2016-03-08  3:24 UTC (permalink / raw)
  To: rui.zhang, edubezval; +Cc: linux-kernel, linux-pm



On 2016年03月07日 16:23, Wei Ni wrote:
> There had a build error in previous patch.
> Fixed it in this version.
> Please review it.

Add CC: linux-pm@vger.kernel.org

> 
> Thanks.
> Wei.
> 
> On 2016年03月03日 17:33, Wei Ni wrote:
>> The commit 17e8351a7739 consistently use int for temperature,
>> however it missed a few in trip temperature and thermal_core.
>>
>> In current codes, the trip->temperature used "unsigned long"
>> and zone->temperature used"int", if the temperature is negative
>> value, it will get wrong result when compare temperature with
>> trip temperature.
>>
>> This patch can fix it.
>>
>> Signed-off-by: Wei Ni <wni@nvidia.com>
>> ---
>>  drivers/thermal/thermal_core.c | 8 ++++----
>>  include/linux/thermal.h        | 4 ++--
>>  2 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
>> index a0a8fd1235e2..e838786fedd8 100644
>> --- a/drivers/thermal/thermal_core.c
>> +++ b/drivers/thermal/thermal_core.c
>> @@ -684,7 +684,7 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr,
>>  {
>>  	struct thermal_zone_device *tz = to_thermal_zone(dev);
>>  	int trip, ret;
>> -	unsigned long temperature;
>> +	int temperature;
>>  
>>  	if (!tz->ops->set_trip_temp)
>>  		return -EPERM;
>> @@ -692,7 +692,7 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr,
>>  	if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip))
>>  		return -EINVAL;
>>  
>> -	if (kstrtoul(buf, 10, &temperature))
>> +	if (kstrtoint(buf, 10, &temperature))
>>  		return -EINVAL;
>>  
>>  	ret = tz->ops->set_trip_temp(tz, trip, temperature);
>> @@ -895,9 +895,9 @@ emul_temp_store(struct device *dev, struct device_attribute *attr,
>>  {
>>  	struct thermal_zone_device *tz = to_thermal_zone(dev);
>>  	int ret = 0;
>> -	unsigned long temperature;
>> +	int temperature;
>>  
>> -	if (kstrtoul(buf, 10, &temperature))
>> +	if (kstrtoint(buf, 10, &temperature))
>>  		return -EINVAL;
>>  
>>  	if (!tz->ops->set_emul_temp) {
>> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
>> index e13a1ace50e9..eee0b7ddd2c1 100644
>> --- a/include/linux/thermal.h
>> +++ b/include/linux/thermal.h
>> @@ -350,8 +350,8 @@ struct thermal_zone_of_device_ops {
>>  
>>  struct thermal_trip {
>>  	struct device_node *np;
>> -	unsigned long int temperature;
>> -	unsigned long int hysteresis;
>> +	int temperature;
>> +	int hysteresis;
>>  	enum thermal_trip_type type;
>>  };
>>  
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] thermal: consistently use int for trip temp
  2016-03-08  3:24   ` [PATCH v2] thermal: consistently use int for trip temp Wei Ni
@ 2016-03-08 21:09     ` Eduardo Valentin
  2016-03-14  9:44       ` Wei Ni
  0 siblings, 1 reply; 4+ messages in thread
From: Eduardo Valentin @ 2016-03-08 21:09 UTC (permalink / raw)
  To: Wei Ni; +Cc: rui.zhang, linux-kernel, linux-pm

On Tue, Mar 08, 2016 at 11:24:39AM +0800, Wei Ni wrote:
> 
> 
> On 2016年03月07日 16:23, Wei Ni wrote:
> > There had a build error in previous patch.
> > Fixed it in this version.
> > Please review it.
> 
> Add CC: linux-pm@vger.kernel.org
> 
> > 
> > Thanks.
> > Wei.
> > 
> > On 2016年03月03日 17:33, Wei Ni wrote:
> >> The commit 17e8351a7739 consistently use int for temperature,
> >> however it missed a few in trip temperature and thermal_core.
> >>
> >> In current codes, the trip->temperature used "unsigned long"
> >> and zone->temperature used"int", if the temperature is negative
> >> value, it will get wrong result when compare temperature with
> >> trip temperature.
> >>
> >> This patch can fix it.
> >>
> >> Signed-off-by: Wei Ni <wni@nvidia.com>

Rui are you collecting this one?

Acked-by: Eduardo Valentin <edubezval@gmail.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] thermal: consistently use int for trip temp
  2016-03-08 21:09     ` Eduardo Valentin
@ 2016-03-14  9:44       ` Wei Ni
  2016-04-12  8:51         ` Wei Ni
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Ni @ 2016-03-14  9:44 UTC (permalink / raw)
  To: rui.zhang; +Cc: Eduardo Valentin, linux-kernel, linux-pm



On 2016年03月09日 05:09, Eduardo Valentin wrote:
> On Tue, Mar 08, 2016 at 11:24:39AM +0800, Wei Ni wrote:
>>
>>
>> On 2016年03月07日 16:23, Wei Ni wrote:
>>> There had a build error in previous patch.
>>> Fixed it in this version.
>>> Please review it.
>>
>> Add CC: linux-pm@vger.kernel.org
>>

Hi Rui,
Will you take this patch?

>>>
>>> Thanks.
>>> Wei.
>>>
>>> On 2016年03月03日 17:33, Wei Ni wrote:
>>>> The commit 17e8351a7739 consistently use int for temperature,
>>>> however it missed a few in trip temperature and thermal_core.
>>>>
>>>> In current codes, the trip->temperature used "unsigned long"
>>>> and zone->temperature used"int", if the temperature is negative
>>>> value, it will get wrong result when compare temperature with
>>>> trip temperature.
>>>>
>>>> This patch can fix it.
>>>>
>>>> Signed-off-by: Wei Ni <wni@nvidia.com>
> 
> Rui are you collecting this one?
> 
> Acked-by: Eduardo Valentin <edubezval@gmail.com>
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] thermal: consistently use int for trip temp
  2016-03-14  9:44       ` Wei Ni
@ 2016-04-12  8:51         ` Wei Ni
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Ni @ 2016-04-12  8:51 UTC (permalink / raw)
  To: rui.zhang; +Cc: Eduardo Valentin, linux-kernel, linux-pm



On 2016年03月14日 17:44, Wei Ni wrote:
> 
> 
> On 2016年03月09日 05:09, Eduardo Valentin wrote:
>> On Tue, Mar 08, 2016 at 11:24:39AM +0800, Wei Ni wrote:
>>>
>>>
>>> On 2016年03月07日 16:23, Wei Ni wrote:
>>>> There had a build error in previous patch.
>>>> Fixed it in this version.
>>>> Please review it.
>>>
>>> Add CC: linux-pm@vger.kernel.org
>>>
> 
> Hi Rui,
> Will you take this patch?

Rui, could you please take a look this patch?

> 
>>>>
>>>> Thanks.
>>>> Wei.
>>>>
>>>> On 2016年03月03日 17:33, Wei Ni wrote:
>>>>> The commit 17e8351a7739 consistently use int for temperature,
>>>>> however it missed a few in trip temperature and thermal_core.
>>>>>
>>>>> In current codes, the trip->temperature used "unsigned long"
>>>>> and zone->temperature used"int", if the temperature is negative
>>>>> value, it will get wrong result when compare temperature with
>>>>> trip temperature.
>>>>>
>>>>> This patch can fix it.
>>>>>
>>>>> Signed-off-by: Wei Ni <wni@nvidia.com>
>>
>> Rui are you collecting this one?
>>
>> Acked-by: Eduardo Valentin <edubezval@gmail.com>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-12  8:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1456997626-28298-1-git-send-email-wni@nvidia.com>
     [not found] ` <56DD3A84.4080304@nvidia.com>
2016-03-08  3:24   ` [PATCH v2] thermal: consistently use int for trip temp Wei Ni
2016-03-08 21:09     ` Eduardo Valentin
2016-03-14  9:44       ` Wei Ni
2016-04-12  8:51         ` Wei Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).