* [PATCH] intel_pstate: Fix type mismatch warning
@ 2013-10-15 23:09 Rafael J. Wysocki
2013-10-16 12:53 ` [Update][PATCH] " Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2013-10-15 23:09 UTC (permalink / raw)
To: Linux PM list; +Cc: dirk.brandewie, Dirk Brandewie, Srinivas Pandruvada
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
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.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/intel_pstate.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -383,6 +383,7 @@ static void intel_pstate_get_min_max(str
static 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(stru
trace_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)
^ permalink raw reply [flat|nested] 5+ messages in thread* [Update][PATCH] intel_pstate: Fix type mismatch warning
2013-10-15 23:09 [PATCH] intel_pstate: Fix type mismatch warning Rafael J. Wysocki
@ 2013-10-16 12:53 ` Rafael J. Wysocki
2013-10-16 17:24 ` Srinivas Pandruvada
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2013-10-16 12:53 UTC (permalink / raw)
To: Linux PM list; +Cc: dirk.brandewie, Dirk Brandewie, Srinivas Pandruvada
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
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.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/intel_pstate.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -383,6 +383,7 @@ static void intel_pstate_get_min_max(str
static 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(stru
trace_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)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Update][PATCH] intel_pstate: Fix type mismatch warning
2013-10-16 12:53 ` [Update][PATCH] " Rafael J. Wysocki
@ 2013-10-16 17:24 ` Srinivas Pandruvada
2013-10-16 20:52 ` Rafael J. Wysocki
2013-10-16 21:05 ` [Resend][PATCH] " Rafael J. Wysocki
0 siblings, 2 replies; 5+ messages in thread
From: Srinivas Pandruvada @ 2013-10-16 17:24 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux PM list, dirk.brandewie, Dirk Brandewie
On 10/16/2013 05:53 AM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> 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.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/cpufreq/intel_pstate.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> Index: linux-pm/drivers/cpufreq/intel_pstate.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/intel_pstate.c
> +++ linux-pm/drivers/cpufreq/intel_pstate.c
> @@ -383,6 +383,7 @@ static void intel_pstate_get_min_max(str
> static 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(stru
> trace_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)
>
>
Tested with this change.
Thanks,
Srinivas
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Update][PATCH] intel_pstate: Fix type mismatch warning
2013-10-16 17:24 ` Srinivas Pandruvada
@ 2013-10-16 20:52 ` Rafael J. Wysocki
2013-10-16 21:05 ` [Resend][PATCH] " Rafael J. Wysocki
1 sibling, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2013-10-16 20:52 UTC (permalink / raw)
To: Srinivas Pandruvada; +Cc: Linux PM list, dirk.brandewie, Dirk Brandewie
On Wednesday, October 16, 2013 10:24:46 AM Srinivas Pandruvada wrote:
> On 10/16/2013 05:53 AM, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > 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.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> > drivers/cpufreq/intel_pstate.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > Index: linux-pm/drivers/cpufreq/intel_pstate.c
> > ===================================================================
> > --- linux-pm.orig/drivers/cpufreq/intel_pstate.c
> > +++ linux-pm/drivers/cpufreq/intel_pstate.c
> > @@ -383,6 +383,7 @@ static void intel_pstate_get_min_max(str
> > static 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(stru
> > trace_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)
> >
> >
> Tested with this change.
Cool, thanks!
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 5+ messages in thread* [Resend][PATCH] intel_pstate: Fix type mismatch warning
2013-10-16 17:24 ` Srinivas Pandruvada
2013-10-16 20:52 ` Rafael J. Wysocki
@ 2013-10-16 21:05 ` Rafael J. Wysocki
1 sibling, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2013-10-16 21:05 UTC (permalink / raw)
To: Linux PM list; +Cc: Srinivas Pandruvada, dirk.brandewie, Dirk Brandewie, LKML
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
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.
Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/intel_pstate.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -383,6 +383,7 @@ static void intel_pstate_get_min_max(str
static 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(stru
trace_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)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-10-16 20:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 23:09 [PATCH] intel_pstate: Fix type mismatch warning Rafael J. Wysocki
2013-10-16 12:53 ` [Update][PATCH] " Rafael J. Wysocki
2013-10-16 17:24 ` Srinivas Pandruvada
2013-10-16 20:52 ` Rafael J. Wysocki
2013-10-16 21:05 ` [Resend][PATCH] " Rafael J. Wysocki
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).