From: Frederic Weisbecker Date: Mon, 27 Oct 2014 16:16:04 +0000 (+0100) Subject: apm32: Fix cputime == jiffies assumption X-Git-Tag: v4.3-rc1~134^2^2~6 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=031a7f456adecaff692bc040b31a7d2262b4ee56;p=linux.git apm32: Fix cputime == jiffies assumption 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 Cc: Christoph Lameter Cc: Ingo Molnar Cc; John Stultz Cc: Peter Zijlstra Cc: Preeti U Murthy Cc: Rik van Riel Cc: Thomas Gleixner Cc: Viresh Kumar Signed-off-by: Frederic Weisbecker --- diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 927ec9235947..052c9c3026cc 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c @@ -919,7 +919,7 @@ static int apm_cpu_idle(struct cpuidle_device *dev, } 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);