diff mbox series

[RFC,1/3] cpufreq: fix the return value in 'cpufreq_boost_set_sw()'

Message ID 1588929064-30270-2-git-send-email-wangxiongfeng2@huawei.com (mailing list archive)
State RFC, archived
Headers show
Series add SW BOOST support for CPPC | expand

Commit Message

Xiongfeng Wang May 8, 2020, 9:11 a.m. UTC
When I try to add SW BOOST support for CPPC, I got the following error:
cpufreq: cpufreq_boost_trigger_state: Cannot enable BOOST
cpufreq: store_boost: Cannot enable BOOST!

It is because return value 1 of 'freq_qos_update_request()' means the
effective constraint value has changed, not a error code on failures.
But for 'cpufreq_driver.set_boost()', a nonzero return value means
failure. So change 'ret' to zero when 'freq_qos_update_request()'
returns a positive value.

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 drivers/cpufreq/cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Rafael J. Wysocki May 14, 2020, 1:54 p.m. UTC | #1
On Friday, May 8, 2020 11:11:02 AM CEST Xiongfeng Wang wrote:
> When I try to add SW BOOST support for CPPC, I got the following error:
> cpufreq: cpufreq_boost_trigger_state: Cannot enable BOOST
> cpufreq: store_boost: Cannot enable BOOST!
> 
> It is because return value 1 of 'freq_qos_update_request()' means the
> effective constraint value has changed, not a error code on failures.
> But for 'cpufreq_driver.set_boost()', a nonzero return value means
> failure. So change 'ret' to zero when 'freq_qos_update_request()'
> returns a positive value.
> 
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> ---
>  drivers/cpufreq/cpufreq.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 4adac3a..475fb1b 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2522,6 +2522,8 @@ static int cpufreq_boost_set_sw(int state)
>  		ret = freq_qos_update_request(policy->max_freq_req, policy->max);
>  		if (ret < 0)
>  			break;
> +		else
> +			ret = 0;
>  	}
>  
>  	return ret;
>

I would change cpufreq_boost_trigger_state() to take the 1 into account properly
instead.

Thanks!
Xiongfeng Wang May 15, 2020, 1:28 a.m. UTC | #2
Hi Rafael,

Thanks for your reply !

On 2020/5/14 21:54, Rafael J. Wysocki wrote:
> On Friday, May 8, 2020 11:11:02 AM CEST Xiongfeng Wang wrote:
>> When I try to add SW BOOST support for CPPC, I got the following error:
>> cpufreq: cpufreq_boost_trigger_state: Cannot enable BOOST
>> cpufreq: store_boost: Cannot enable BOOST!
>>
>> It is because return value 1 of 'freq_qos_update_request()' means the
>> effective constraint value has changed, not a error code on failures.
>> But for 'cpufreq_driver.set_boost()', a nonzero return value means
>> failure. So change 'ret' to zero when 'freq_qos_update_request()'
>> returns a positive value.
>>
>> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
>> ---
>>  drivers/cpufreq/cpufreq.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 4adac3a..475fb1b 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -2522,6 +2522,8 @@ static int cpufreq_boost_set_sw(int state)
>>  		ret = freq_qos_update_request(policy->max_freq_req, policy->max);
>>  		if (ret < 0)
>>  			break;
>> +		else
>> +			ret = 0;
>>  	}
>>  
>>  	return ret;
>>
> 
> I would change cpufreq_boost_trigger_state() to take the 1 into account properly
> instead.

Thanks for your suggestion. I will change it in the next version.

Thanks,
Xiongfeng

> 
> Thanks!
> 
> 
> 
> 
> .
>
diff mbox series

Patch

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 4adac3a..475fb1b 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2522,6 +2522,8 @@  static int cpufreq_boost_set_sw(int state)
 		ret = freq_qos_update_request(policy->max_freq_req, policy->max);
 		if (ret < 0)
 			break;
+		else
+			ret = 0;
 	}
 
 	return ret;