apm32: Fix cputime == jiffies assumption
authorFrederic Weisbecker <fweisbec@gmail.com>
Mon, 27 Oct 2014 16:16:04 +0000 (17:16 +0100)
committerFrederic Weisbecker <fweisbec@gmail.com>
Wed, 29 Jul 2015 13:44:58 +0000 (15:44 +0200)
That code wrongly assumes that cputime_t wraps jiffies_t. Lets use
the correct accessors/mutators.

No real harm now as that code can't be used with full dynticks.

Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc; John Stultz <john.stultz@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
arch/x86/kernel/apm_32.c

index 927ec92..052c9c3 100644 (file)
@@ -919,7 +919,7 @@ recalc:
        } else if (jiffies_since_last_check > idle_period) {
                unsigned int idle_percentage;
 
-               idle_percentage = stime - last_stime;
+               idle_percentage = cputime_to_jiffies(stime - last_stime);
                idle_percentage *= 100;
                idle_percentage /= jiffies_since_last_check;
                use_apm_idle = (idle_percentage > idle_threshold);