cpufreq.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: intel_pstate: Remove sample parameter in intel_pstate_calc_busy
@ 2014-04-29 17:53 Stratos Karafotis
  2014-04-30  4:06 ` Viresh Kumar
  2014-05-01 16:04 ` Dirk Brandewie
  0 siblings, 2 replies; 3+ messages in thread
From: Stratos Karafotis @ 2014-04-29 17:53 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Dirk Brandewie
  Cc: cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, LKML

Since commit d37e2b7644 ("intel_pstate: remove unneeded sample buffers")
we use only one sample. So, there is no need to pass the sample
pointer to intel_pstate_calc_busy. Instead, get the pointer from
cpudata. Also, remove the unused SAMPLE_COUNT macro.

While at it, reformat the first line in this function.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
---
 drivers/cpufreq/intel_pstate.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 95b3958..8192ff1 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -32,8 +32,6 @@
 #include <asm/msr.h>
 #include <asm/cpu_device_id.h>
 
-#define SAMPLE_COUNT		3
-
 #define BYT_RATIOS		0x66a
 #define BYT_VIDS		0x66b
 #define BYT_TURBO_RATIOS	0x66c
@@ -553,14 +551,13 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
 	intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate);
 }
 
-static inline void intel_pstate_calc_busy(struct cpudata *cpu,
-					struct sample *sample)
+static inline void intel_pstate_calc_busy(struct cpudata *cpu)
 {
+	struct sample *sample = &cpu->sample;
 	int32_t core_pct;
 	int32_t c0_pct;
 
-	core_pct = div_fp(int_tofp((sample->aperf)),
-			int_tofp((sample->mperf)));
+	core_pct = div_fp(int_tofp(sample->aperf), int_tofp(sample->mperf));
 	core_pct = mul_fp(core_pct, int_tofp(100));
 	FP_ROUNDUP(core_pct);
 
@@ -595,7 +592,7 @@ static inline void intel_pstate_sample(struct cpudata *cpu)
 	cpu->sample.mperf -= cpu->prev_mperf;
 	cpu->sample.tsc -= cpu->prev_tsc;
 
-	intel_pstate_calc_busy(cpu, &cpu->sample);
+	intel_pstate_calc_busy(cpu);
 
 	cpu->prev_aperf = aperf;
 	cpu->prev_mperf = mperf;
-- 
1.9.0

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

* Re: [PATCH] cpufreq: intel_pstate: Remove sample parameter in intel_pstate_calc_busy
  2014-04-29 17:53 [PATCH] cpufreq: intel_pstate: Remove sample parameter in intel_pstate_calc_busy Stratos Karafotis
@ 2014-04-30  4:06 ` Viresh Kumar
  2014-05-01 16:04 ` Dirk Brandewie
  1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2014-04-30  4:06 UTC (permalink / raw)
  To: Stratos Karafotis
  Cc: Rafael J. Wysocki, Dirk Brandewie, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, LKML

On 29 April 2014 23:23, Stratos Karafotis <stratosk@semaphore.gr> wrote:
> Since commit d37e2b7644 ("intel_pstate: remove unneeded sample buffers")
> we use only one sample. So, there is no need to pass the sample
> pointer to intel_pstate_calc_busy. Instead, get the pointer from
> cpudata. Also, remove the unused SAMPLE_COUNT macro.
>
> While at it, reformat the first line in this function.
>
> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
> ---
>  drivers/cpufreq/intel_pstate.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

* Re: [PATCH] cpufreq: intel_pstate: Remove sample parameter in intel_pstate_calc_busy
  2014-04-29 17:53 [PATCH] cpufreq: intel_pstate: Remove sample parameter in intel_pstate_calc_busy Stratos Karafotis
  2014-04-30  4:06 ` Viresh Kumar
@ 2014-05-01 16:04 ` Dirk Brandewie
  1 sibling, 0 replies; 3+ messages in thread
From: Dirk Brandewie @ 2014-05-01 16:04 UTC (permalink / raw)
  To: Stratos Karafotis, Rafael J. Wysocki, Viresh Kumar
  Cc: dirk.j.brandewie, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, LKML

On 04/29/2014 10:53 AM, Stratos Karafotis wrote:
> Since commit d37e2b7644 ("intel_pstate: remove unneeded sample buffers")
> we use only one sample. So, there is no need to pass the sample
> pointer to intel_pstate_calc_busy. Instead, get the pointer from
> cpudata. Also, remove the unused SAMPLE_COUNT macro.
>
> While at it, reformat the first line in this function.
>
> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>

Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>

> ---
>   drivers/cpufreq/intel_pstate.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 95b3958..8192ff1 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -32,8 +32,6 @@
>   #include <asm/msr.h>
>   #include <asm/cpu_device_id.h>
>
> -#define SAMPLE_COUNT		3
> -
>   #define BYT_RATIOS		0x66a
>   #define BYT_VIDS		0x66b
>   #define BYT_TURBO_RATIOS	0x66c
> @@ -553,14 +551,13 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
>   	intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate);
>   }
>
> -static inline void intel_pstate_calc_busy(struct cpudata *cpu,
> -					struct sample *sample)
> +static inline void intel_pstate_calc_busy(struct cpudata *cpu)
>   {
> +	struct sample *sample = &cpu->sample;
>   	int32_t core_pct;
>   	int32_t c0_pct;
>
> -	core_pct = div_fp(int_tofp((sample->aperf)),
> -			int_tofp((sample->mperf)));
> +	core_pct = div_fp(int_tofp(sample->aperf), int_tofp(sample->mperf));
>   	core_pct = mul_fp(core_pct, int_tofp(100));
>   	FP_ROUNDUP(core_pct);
>
> @@ -595,7 +592,7 @@ static inline void intel_pstate_sample(struct cpudata *cpu)
>   	cpu->sample.mperf -= cpu->prev_mperf;
>   	cpu->sample.tsc -= cpu->prev_tsc;
>
> -	intel_pstate_calc_busy(cpu, &cpu->sample);
> +	intel_pstate_calc_busy(cpu);
>
>   	cpu->prev_aperf = aperf;
>   	cpu->prev_mperf = mperf;
>


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

end of thread, other threads:[~2014-05-01 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-29 17:53 [PATCH] cpufreq: intel_pstate: Remove sample parameter in intel_pstate_calc_busy Stratos Karafotis
2014-04-30  4:06 ` Viresh Kumar
2014-05-01 16:04 ` Dirk Brandewie

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