diff mbox

[1/3] cpupower: mperf monitor: Correct use of ! and &

Message ID 1406650340-38644-1-git-send-email-trenn@suse.de (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Thomas Renninger July 29, 2014, 4:12 p.m. UTC
From: Himangi Saraogi <himangi774@gmail.com>

In commit ae91d60ba88ef0bdb1b5e9b2363bd52fc45d2af7, a bug was fixed that
involved converting !x & y to !(x & y).  The code below shows the same
pattern, and thus should perhaps be fixed in the same way.

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@@ expression E1,E2; @@
(
  !E1 & !E2
|
- !E1 & E2
+ !(E1 & E2)
)
// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
 .../cpupower/utils/idle_monitor/mperf_monitor.c    |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Rafael J. Wysocki July 30, 2014, 12:28 a.m. UTC | #1
On Tuesday, July 29, 2014 06:12:18 PM Thomas Renninger wrote:
> From: Himangi Saraogi <himangi774@gmail.com>
> 
> In commit ae91d60ba88ef0bdb1b5e9b2363bd52fc45d2af7, a bug was fixed that
> involved converting !x & y to !(x & y).  The code below shows the same
> pattern, and thus should perhaps be fixed in the same way.
> 
> The Coccinelle semantic patch that makes this change is as follows:
> 
> // <smpl>
> @@ expression E1,E2; @@
> (
>   !E1 & !E2
> |
> - !E1 & E2
> + !(E1 & E2)
> )
> // </smpl>
> 
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> Signed-off-by: Thomas Renninger <trenn@suse.de>

All three queued up for 3.17, thanks!

> ---
>  .../cpupower/utils/idle_monitor/mperf_monitor.c    |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
> index 5650ab5..90a8c4f 100644
> --- a/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
> +++ b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
> @@ -237,7 +237,7 @@ static int init_maxfreq_mode(void)
>  	unsigned long long hwcr;
>  	unsigned long min;
>  
> -	if (!cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC)
> +	if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC))
>  		goto use_sysfs;
>  
>  	if (cpupower_cpu_info.vendor == X86_VENDOR_AMD) {
>
diff mbox

Patch

diff --git a/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
index 5650ab5..90a8c4f 100644
--- a/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
+++ b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
@@ -237,7 +237,7 @@  static int init_maxfreq_mode(void)
 	unsigned long long hwcr;
 	unsigned long min;
 
-	if (!cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC)
+	if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC))
 		goto use_sysfs;
 
 	if (cpupower_cpu_info.vendor == X86_VENDOR_AMD) {