linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq
@ 2016-09-09 17:25 Laura Abbott
  2016-09-23 16:17 ` Shilpasri G Bhat
  0 siblings, 1 reply; 2+ messages in thread
From: Laura Abbott @ 2016-09-09 17:25 UTC (permalink / raw)
  To: Thomas Renninger; +Cc: Laura Abbott, linux-pm, linux-kernel

When converting to a shared library in ac5a181d065d ("cpupower: Add
cpuidle parts into library"), cpu_freq_cpu_exists was converted to
cpupower_is_cpu_online. cpu_req_cpu_exists returned 0 on success and
-ENOSYS on failure whereas cpupower_is_cpu_online returns 1 on success.
Check for the correct return value in cpufreq-set.

See https://bugzilla.redhat.com/show_bug.cgi?id=1374212

Fixes: ac5a181d065d ("cpupower: Add cpuidle parts into library")
Reported-by: Julian Seward <jseward@acm.org>
Signed-off-by: Laura Abbott <labbott@redhat.com>
---
 tools/power/cpupower/utils/cpufreq-set.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
index b4bf769..8971d71 100644
--- a/tools/power/cpupower/utils/cpufreq-set.c
+++ b/tools/power/cpupower/utils/cpufreq-set.c
@@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv)
 			struct cpufreq_affected_cpus *cpus;
 
 			if (!bitmask_isbitset(cpus_chosen, cpu) ||
-			    cpupower_is_cpu_online(cpu))
+			    cpupower_is_cpu_online(cpu) != 1)
 				continue;
 
 			cpus = cpufreq_get_related_cpus(cpu);
@@ -316,7 +316,7 @@ int cmd_freq_set(int argc, char **argv)
 	     cpu <= bitmask_last(cpus_chosen); cpu++) {
 
 		if (!bitmask_isbitset(cpus_chosen, cpu) ||
-		    cpupower_is_cpu_online(cpu))
+		    cpupower_is_cpu_online(cpu) != 1)
 			continue;
 
 		if (cpupower_is_cpu_online(cpu) != 1)
-- 
2.10.0


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

* Re: [PATCH] cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq
  2016-09-09 17:25 [PATCH] cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq Laura Abbott
@ 2016-09-23 16:17 ` Shilpasri G Bhat
  0 siblings, 0 replies; 2+ messages in thread
From: Shilpasri G Bhat @ 2016-09-23 16:17 UTC (permalink / raw)
  To: Laura Abbott, Thomas Renninger; +Cc: linux-pm, linux-kernel

Hi,

On 09/09/2016 10:55 PM, Laura Abbott wrote:
> When converting to a shared library in ac5a181d065d ("cpupower: Add
> cpuidle parts into library"), cpu_freq_cpu_exists was converted to
> cpupower_is_cpu_online. cpu_req_cpu_exists returned 0 on success and
> -ENOSYS on failure whereas cpupower_is_cpu_online returns 1 on success.
> Check for the correct return value in cpufreq-set.
> 
> See https://bugzilla.redhat.com/show_bug.cgi?id=1374212
> 
> Fixes: ac5a181d065d ("cpupower: Add cpuidle parts into library")
> Reported-by: Julian Seward <jseward@acm.org>
> Signed-off-by: Laura Abbott <labbott@redhat.com>
> ---
>  tools/power/cpupower/utils/cpufreq-set.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
> index b4bf769..8971d71 100644
> --- a/tools/power/cpupower/utils/cpufreq-set.c
> +++ b/tools/power/cpupower/utils/cpufreq-set.c
> @@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv)
>  			struct cpufreq_affected_cpus *cpus;
> 
>  			if (!bitmask_isbitset(cpus_chosen, cpu) ||
> -			    cpupower_is_cpu_online(cpu))
> +			    cpupower_is_cpu_online(cpu) != 1)
>  				continue;
> 
>  			cpus = cpufreq_get_related_cpus(cpu);
> @@ -316,7 +316,7 @@ int cmd_freq_set(int argc, char **argv)
>  	     cpu <= bitmask_last(cpus_chosen); cpu++) {
> 
>  		if (!bitmask_isbitset(cpus_chosen, cpu) ||
> -		    cpupower_is_cpu_online(cpu))
> +		    cpupower_is_cpu_online(cpu) != 1)
>  			continue;
> 
>  		if (cpupower_is_cpu_online(cpu) != 1)
		^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Can you also remove the above check where the same condition
'cpupower_is_cpu_online(cpu) != 1' is tested twice ?

Thanks and Regards,
Shilpa


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

end of thread, other threads:[~2016-09-23 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-09 17:25 [PATCH] cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq Laura Abbott
2016-09-23 16:17 ` Shilpasri G Bhat

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