linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal/drivers/cpufreq_cooling: Fix return of cpufreq_set_cur_state
@ 2020-03-21  9:27 Willy Wolff
  2020-03-23  3:17 ` Viresh Kumar
  2020-03-23 21:05 ` Amit Kucheria
  0 siblings, 2 replies; 5+ messages in thread
From: Willy Wolff @ 2020-03-21  9:27 UTC (permalink / raw)
  To: Amit Daniel Kachhap, Viresh Kumar, Javi Merino, Zhang Rui,
	Daniel Lezcano, Amit Kucheria, linux-pm, linux-kernel,
	Rafael J.Wysocki

The function freq_qos_update_request returns 0 or 1 describing update
effectiveness, and a negative error code on failure. However,
cpufreq_set_cur_state returns 0 on success or an error code otherwise.

Signed-off-by: Willy Wolff <willy.mh.wolff.ml@gmail.com>
---
 drivers/thermal/cpufreq_cooling.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
index fe83d7a210d4..af55ac08e1bd 100644
--- a/drivers/thermal/cpufreq_cooling.c
+++ b/drivers/thermal/cpufreq_cooling.c
@@ -431,6 +431,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
 				 unsigned long state)
 {
 	struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
+	int ret;
 
 	/* Request state should be less than max_level */
 	if (WARN_ON(state > cpufreq_cdev->max_level))
@@ -442,8 +443,9 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
 
 	cpufreq_cdev->cpufreq_state = state;
 
-	return freq_qos_update_request(&cpufreq_cdev->qos_req,
-				get_state_freq(cpufreq_cdev, state));
+	ret = freq_qos_update_request(&cpufreq_cdev->qos_req,
+				      get_state_freq(cpufreq_cdev, state));
+	return ret < 0 ? ret : 0;
 }
 
 /* Bind cpufreq callbacks to thermal cooling device ops */
-- 
2.20.1


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

* Re: [PATCH] thermal/drivers/cpufreq_cooling: Fix return of cpufreq_set_cur_state
  2020-03-21  9:27 [PATCH] thermal/drivers/cpufreq_cooling: Fix return of cpufreq_set_cur_state Willy Wolff
@ 2020-03-23  3:17 ` Viresh Kumar
  2020-03-23 21:05 ` Amit Kucheria
  1 sibling, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2020-03-23  3:17 UTC (permalink / raw)
  To: Willy Wolff
  Cc: Amit Daniel Kachhap, Javi Merino, Zhang Rui, Daniel Lezcano,
	Amit Kucheria, linux-pm, linux-kernel, Rafael J.Wysocki

On 21-03-20, 09:27, Willy Wolff wrote:
> The function freq_qos_update_request returns 0 or 1 describing update
> effectiveness, and a negative error code on failure. However,
> cpufreq_set_cur_state returns 0 on success or an error code otherwise.
> 
> Signed-off-by: Willy Wolff <willy.mh.wolff.ml@gmail.com>
> ---
>  drivers/thermal/cpufreq_cooling.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
> index fe83d7a210d4..af55ac08e1bd 100644
> --- a/drivers/thermal/cpufreq_cooling.c
> +++ b/drivers/thermal/cpufreq_cooling.c
> @@ -431,6 +431,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>  				 unsigned long state)
>  {
>  	struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
> +	int ret;
>  
>  	/* Request state should be less than max_level */
>  	if (WARN_ON(state > cpufreq_cdev->max_level))
> @@ -442,8 +443,9 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>  
>  	cpufreq_cdev->cpufreq_state = state;
>  
> -	return freq_qos_update_request(&cpufreq_cdev->qos_req,
> -				get_state_freq(cpufreq_cdev, state));
> +	ret = freq_qos_update_request(&cpufreq_cdev->qos_req,
> +				      get_state_freq(cpufreq_cdev, state));
> +	return ret < 0 ? ret : 0;
>  }
>  
>  /* Bind cpufreq callbacks to thermal cooling device ops */

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

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

* Re: [PATCH] thermal/drivers/cpufreq_cooling: Fix return of cpufreq_set_cur_state
  2020-03-21  9:27 [PATCH] thermal/drivers/cpufreq_cooling: Fix return of cpufreq_set_cur_state Willy Wolff
  2020-03-23  3:17 ` Viresh Kumar
@ 2020-03-23 21:05 ` Amit Kucheria
  2020-03-23 21:08   ` Daniel Lezcano
  1 sibling, 1 reply; 5+ messages in thread
From: Amit Kucheria @ 2020-03-23 21:05 UTC (permalink / raw)
  To: Willy Wolff
  Cc: Amit Daniel Kachhap, Viresh Kumar, Javi Merino, Zhang Rui,
	Daniel Lezcano, Linux PM list, LKML, Rafael J.Wysocki

Hi Willy,

On Sat, Mar 21, 2020 at 2:57 PM Willy Wolff <willy.mh.wolff.ml@gmail.com> wrote:
>
> The function freq_qos_update_request returns 0 or 1 describing update
> effectiveness, and a negative error code on failure. However,
> cpufreq_set_cur_state returns 0 on success or an error code otherwise.
>

Please improve the commit message with context from your earlier bug
report thread and a summary of how the problem shows up.

Thanks,
Amit



> Signed-off-by: Willy Wolff <willy.mh.wolff.ml@gmail.com>
> ---
>  drivers/thermal/cpufreq_cooling.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
> index fe83d7a210d4..af55ac08e1bd 100644
> --- a/drivers/thermal/cpufreq_cooling.c
> +++ b/drivers/thermal/cpufreq_cooling.c
> @@ -431,6 +431,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>                                  unsigned long state)
>  {
>         struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
> +       int ret;
>
>         /* Request state should be less than max_level */
>         if (WARN_ON(state > cpufreq_cdev->max_level))
> @@ -442,8 +443,9 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>
>         cpufreq_cdev->cpufreq_state = state;
>
> -       return freq_qos_update_request(&cpufreq_cdev->qos_req,
> -                               get_state_freq(cpufreq_cdev, state));
> +       ret = freq_qos_update_request(&cpufreq_cdev->qos_req,
> +                                     get_state_freq(cpufreq_cdev, state));
> +       return ret < 0 ? ret : 0;
>  }
>
>  /* Bind cpufreq callbacks to thermal cooling device ops */
> --
> 2.20.1
>

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

* Re: [PATCH] thermal/drivers/cpufreq_cooling: Fix return of cpufreq_set_cur_state
  2020-03-23 21:05 ` Amit Kucheria
@ 2020-03-23 21:08   ` Daniel Lezcano
  2020-03-24  7:45     ` Willy Wolff
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Lezcano @ 2020-03-23 21:08 UTC (permalink / raw)
  To: Amit Kucheria, Willy Wolff
  Cc: Amit Daniel Kachhap, Viresh Kumar, Javi Merino, Zhang Rui,
	Linux PM list, LKML, Rafael J.Wysocki

On 23/03/2020 22:05, Amit Kucheria wrote:
> Hi Willy,
> 
> On Sat, Mar 21, 2020 at 2:57 PM Willy Wolff <willy.mh.wolff.ml@gmail.com> wrote:
>>
>> The function freq_qos_update_request returns 0 or 1 describing update
>> effectiveness, and a negative error code on failure. However,
>> cpufreq_set_cur_state returns 0 on success or an error code otherwise.
>>
> 
> Please improve the commit message with context from your earlier bug
> report thread and a summary of how the problem shows up.

I've improved the commit message when applied:

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/commit/?h=testing&id=ff44f672d74178b3be19d41a169b98b3e391d4ce

>> Signed-off-by: Willy Wolff <willy.mh.wolff.ml@gmail.com>
>> ---
>>  drivers/thermal/cpufreq_cooling.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
>> index fe83d7a210d4..af55ac08e1bd 100644
>> --- a/drivers/thermal/cpufreq_cooling.c
>> +++ b/drivers/thermal/cpufreq_cooling.c
>> @@ -431,6 +431,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>>                                  unsigned long state)
>>  {
>>         struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
>> +       int ret;
>>
>>         /* Request state should be less than max_level */
>>         if (WARN_ON(state > cpufreq_cdev->max_level))
>> @@ -442,8 +443,9 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>>
>>         cpufreq_cdev->cpufreq_state = state;
>>
>> -       return freq_qos_update_request(&cpufreq_cdev->qos_req,
>> -                               get_state_freq(cpufreq_cdev, state));
>> +       ret = freq_qos_update_request(&cpufreq_cdev->qos_req,
>> +                                     get_state_freq(cpufreq_cdev, state));
>> +       return ret < 0 ? ret : 0;
>>  }
>>
>>  /* Bind cpufreq callbacks to thermal cooling device ops */
>> --
>> 2.20.1
>>


-- 
 <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


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

* Re: [PATCH] thermal/drivers/cpufreq_cooling: Fix return of cpufreq_set_cur_state
  2020-03-23 21:08   ` Daniel Lezcano
@ 2020-03-24  7:45     ` Willy Wolff
  0 siblings, 0 replies; 5+ messages in thread
From: Willy Wolff @ 2020-03-24  7:45 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Amit Kucheria, Amit Daniel Kachhap, Viresh Kumar, Javi Merino,
	Zhang Rui, Linux PM list, LKML, Rafael J.Wysocki

Many thanks.

On Mon, Mar 23, 2020 at 10:08:38PM +0100, Daniel Lezcano wrote:
>On 23/03/2020 22:05, Amit Kucheria wrote:
>> Hi Willy,
>>
>> On Sat, Mar 21, 2020 at 2:57 PM Willy Wolff <willy.mh.wolff.ml@gmail.com> wrote:
>>>
>>> The function freq_qos_update_request returns 0 or 1 describing update
>>> effectiveness, and a negative error code on failure. However,
>>> cpufreq_set_cur_state returns 0 on success or an error code otherwise.
>>>
>>
>> Please improve the commit message with context from your earlier bug
>> report thread and a summary of how the problem shows up.
>
>I've improved the commit message when applied:
>
>https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/commit/?h=testing&id=ff44f672d74178b3be19d41a169b98b3e391d4ce
>
>>> Signed-off-by: Willy Wolff <willy.mh.wolff.ml@gmail.com>
>>> ---
>>>  drivers/thermal/cpufreq_cooling.c | 6 ++++--
>>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
>>> index fe83d7a210d4..af55ac08e1bd 100644
>>> --- a/drivers/thermal/cpufreq_cooling.c
>>> +++ b/drivers/thermal/cpufreq_cooling.c
>>> @@ -431,6 +431,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>>>                                  unsigned long state)
>>>  {
>>>         struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
>>> +       int ret;
>>>
>>>         /* Request state should be less than max_level */
>>>         if (WARN_ON(state > cpufreq_cdev->max_level))
>>> @@ -442,8 +443,9 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>>>
>>>         cpufreq_cdev->cpufreq_state = state;
>>>
>>> -       return freq_qos_update_request(&cpufreq_cdev->qos_req,
>>> -                               get_state_freq(cpufreq_cdev, state));
>>> +       ret = freq_qos_update_request(&cpufreq_cdev->qos_req,
>>> +                                     get_state_freq(cpufreq_cdev, state));
>>> +       return ret < 0 ? ret : 0;
>>>  }
>>>
>>>  /* Bind cpufreq callbacks to thermal cooling device ops */
>>> --
>>> 2.20.1
>>>
>
>
>-- 
> <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
>

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

end of thread, other threads:[~2020-03-24  7:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-21  9:27 [PATCH] thermal/drivers/cpufreq_cooling: Fix return of cpufreq_set_cur_state Willy Wolff
2020-03-23  3:17 ` Viresh Kumar
2020-03-23 21:05 ` Amit Kucheria
2020-03-23 21:08   ` Daniel Lezcano
2020-03-24  7:45     ` Willy Wolff

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).