intel_pstate: Fix type mismatch warning
Subsystems (2)
PATCH 1/1 intel_pstate: Fix type mismatch warning
From: Rafael J. Wysocki <[email protected]>
The expression in line 398 of intel_pstate.c causes the following warning to be emitted:
drivers/cpufreq/intel_pstate.c:398:3: warning: left shift count >= width of type
which is due to the fact that the pstate variable is of type int. Fix that by using a helper unsigned long variable and simplify the code slightly.
--- drivers/cpufreq/intel_pstate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/cpufreq/intel_pstate.c +4 -3
@@ -383,6 +383,7 @@ static void intel_pstate_get_min_max(strstatic void intel_pstate_set_pstate (struct cpudata *cpu,int pstate) {int max_perf, min_perf; +unsigned long val;intel_pstate_get_min_max (cpu, &min_perf, &max_perf);
@@ -394,11 +395,11 @@ static void intel_pstate_set_pstate(strutrace_cpu_frequency (pstate *100000 , cpu->cpu); cpu->pstate.current_pstate = pstate; + val = pstate <<8 ;if (limits.no_turbo) -wrmsrl (MSR_IA32_PERF_CTL ,BIT (32 ) | (pstate <<8 )); -else -wrmsrl (MSR_IA32_PERF_CTL , pstate <<8 ); + val |=BIT (32 ); +wrmsrl (MSR_IA32_PERF_CTL , val); }static inline void intel_pstate_pstate_increase (struct cpudata *cpu,int steps)
PATCH 1/1 intel_pstate: Fix type mismatch warning
From: Rafael J. Wysocki <[email protected]>
The expression in line 398 of intel_pstate.c causes the following warning to be emitted:
drivers/cpufreq/intel_pstate.c:398:3: warning: left shift count >= width of type
which happens because unsigned long is 32-bit on some architectures. Fix that by using a helper u64 variable and simplify the code slightly.
--- drivers/cpufreq/intel_pstate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/cpufreq/intel_pstate.c +4 -3
@@ -383,6 +383,7 @@ static void intel_pstate_get_min_max(strstatic void intel_pstate_set_pstate (struct cpudata *cpu,int pstate) {int max_perf, min_perf; +u64 val;intel_pstate_get_min_max (cpu, &min_perf, &max_perf);
@@ -394,11 +395,11 @@ static void intel_pstate_set_pstate(strutrace_cpu_frequency (pstate *100000 , cpu->cpu); cpu->pstate.current_pstate = pstate; + val = pstate <<8 ;if (limits.no_turbo) -wrmsrl (MSR_IA32_PERF_CTL ,BIT (32 ) | (pstate <<8 )); -else -wrmsrl (MSR_IA32_PERF_CTL , pstate <<8 ); + val |= (u64 )1 <<32 ; +wrmsrl (MSR_IA32_PERF_CTL , val); }static inline void intel_pstate_pstate_increase (struct cpudata *cpu,int steps)
Srinivas Pandruvada
maintainerQuoted 35 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The expression in line 398 of
intel_pstate.ccauses the following warning to be emitted:
drivers/cpufreq/intel_pstate.c:398:3: warning: left shift count >= width of typewhich happens because unsigned long is 32-bit on some architectures. Fix that by using a helper u64 variable and simplify the code slightly.
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/cpufreq/intel_pstate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)Index:
linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================drivers/cpufreq/intel_pstate.c +2
-0@@ -383,6 +383,7 @@ static void intel_pstate_get_min_max(strstatic void intel_pstate_set_pstate (struct cpudata *cpu,int pstate) {int max_perf, min_perf; +u64 val;intel_pstate_get_min_max (cpu, &min_perf, &max_perf);@@ -394,11 +395,11 @@ static void intel_pstate_set_pstate(strutrace_cpu_frequency (pstate *100000 , cpu->cpu); cpu->pstate.current_pstate = pstate; + val = pstate <<8 ;
drivers/cpufreq/intel_pstate.c static void intel_pstate_set_pstate(stru · line 405
Quoted 10 lines
drivers/cpufreq/intel_pstate.c +2
-3if (limits.no_turbo) -wrmsrl (MSR_IA32_PERF_CTL ,BIT (32 ) | (pstate <<8 )); -else -wrmsrl (MSR_IA32_PERF_CTL , pstate <<8 ); + val |= (u64 )1 <<32 ; +wrmsrl (MSR_IA32_PERF_CTL , val); }static inline void intel_pstate_pstate_increase (struct cpudata *cpu,int steps)
Tested with this change.
Thanks,
Srinivas
Quoted 40 lines · Srinivas Pandruvada
Quoted 39 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The expression in line 398 of
intel_pstate.ccauses the following warning to be emitted:
drivers/cpufreq/intel_pstate.c:398:3: warning: left shift count >= width of typewhich happens because unsigned long is 32-bit on some architectures. Fix that by using a helper u64 variable and simplify the code slightly.
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/cpufreq/intel_pstate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)Index:
linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================drivers/cpufreq/intel_pstate.c +3
-3@@ -383,6 +383,7 @@ static void intel_pstate_get_min_max(strstatic void intel_pstate_set_pstate (struct cpudata *cpu,int pstate) {int max_perf, min_perf; +u64 val;intel_pstate_get_min_max (cpu, &min_perf, &max_perf);@@ -394,11 +395,11 @@ static void intel_pstate_set_pstate(strutrace_cpu_frequency (pstate *100000 , cpu->cpu); cpu->pstate.current_pstate = pstate; + val = pstate <<8 ;if (limits.no_turbo) -wrmsrl (MSR_IA32_PERF_CTL ,BIT (32 ) | (pstate <<8 )); -else -wrmsrl (MSR_IA32_PERF_CTL , pstate <<8 ); + val |= (u64 )1 <<32 ;
Quoted 7 lines
drivers/cpufreq/intel_pstate.c static void intel_pstate_set_pstate(stru · line 405
Quoted 6 lines
drivers/cpufreq/intel_pstate.c +1
-0+wrmsrl (MSR_IA32_PERF_CTL , val); }static inline void intel_pstate_pstate_increase (struct cpudata *cpu,int steps)Tested with this change.
Cool, thanks!
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
PATCH RESEND 1/1 intel_pstate: Fix type mismatch warning
In reply to Srinivas PandruvadaFrom: Rafael J. Wysocki <[email protected]>
The expression in line 398 of intel_pstate.c causes the following warning to be emitted:
drivers/cpufreq/intel_pstate.c:398:3: warning: left shift count >= width of type
which happens because unsigned long is 32-bit on some architectures.
Fix that by using a helper u64 variable and simplify the code slightly.
--- drivers/cpufreq/intel_pstate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/cpufreq/intel_pstate.c +4 -3
@@ -383,6 +383,7 @@ static void intel_pstate_get_min_max(strstatic void intel_pstate_set_pstate (struct cpudata *cpu,int pstate) {int max_perf, min_perf; +u64 val;intel_pstate_get_min_max (cpu, &min_perf, &max_perf);
@@ -394,11 +395,11 @@ static void intel_pstate_set_pstate(strutrace_cpu_frequency (pstate *100000 , cpu->cpu); cpu->pstate.current_pstate = pstate; + val = pstate <<8 ;if (limits.no_turbo) -wrmsrl (MSR_IA32_PERF_CTL ,BIT (32 ) | (pstate <<8 )); -else -wrmsrl (MSR_IA32_PERF_CTL , pstate <<8 ); + val |= (u64 )1 <<32 ; +wrmsrl (MSR_IA32_PERF_CTL , val); }static inline void intel_pstate_pstate_increase (struct cpudata *cpu,int steps)