cpufreq: intel_pstate: Simplify P state adjustment logic.
authorStratos Karafotis <stratosk@semaphore.gr>
Fri, 18 Jul 2014 15:37:26 +0000 (08:37 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 21 Jul 2014 11:43:19 +0000 (13:43 +0200)
Simplify the code by removing the inline functions pstate_increase and
pstate_decrease and use directly the intel_pstate_set_pstate.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c

index 129ffb2853dcb7ba71fe8bab86ec81ac3cde2345..2ff85f665f93925563e7dd30cc819d393c31170d 100644 (file)
@@ -530,21 +530,6 @@ static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate)
        pstate_funcs.set(cpu, pstate);
 }
 
-static inline void intel_pstate_pstate_increase(struct cpudata *cpu, int steps)
-{
-       int target;
-       target = cpu->pstate.current_pstate + steps;
-
-       intel_pstate_set_pstate(cpu, target);
-}
-
-static inline void intel_pstate_pstate_decrease(struct cpudata *cpu, int steps)
-{
-       int target;
-       target = cpu->pstate.current_pstate - steps;
-       intel_pstate_set_pstate(cpu, target);
-}
-
 static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
 {
        cpu->pstate.min_pstate = pstate_funcs.get_min();
@@ -632,20 +617,15 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu)
 {
        int32_t busy_scaled;
        struct _pid *pid;
-       signed int ctl = 0;
-       int steps;
+       signed int ctl;
 
        pid = &cpu->pid;
        busy_scaled = intel_pstate_get_scaled_busy(cpu);
 
        ctl = pid_calc(pid, busy_scaled);
 
-       steps = abs(ctl);
-
-       if (ctl < 0)
-               intel_pstate_pstate_increase(cpu, steps);
-       else
-               intel_pstate_pstate_decrease(cpu, steps);
+       /* Negative values of ctl increase the pstate and vice versa */
+       intel_pstate_set_pstate(cpu, cpu->pstate.current_pstate - ctl);
 }
 
 static void intel_pstate_timer_func(unsigned long __data)