From e6885f6fcaa8c5be8157a5b4bafc5834de1aebce Mon Sep 17 00:00:00 2001 From: Tuukka Tikkanen Date: Thu, 12 Mar 2015 10:43:30 +0200 Subject: Fix merge_pstates The function merge_pstates did not work as advertised. This patch fixes the implementation. Signed-off-by: Tuukka Tikkanen Signed-off-by: Amit Kucheria --- idlestat.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/idlestat.c b/idlestat.c index 22a9781..4d773f4 100644 --- a/idlestat.c +++ b/idlestat.c @@ -696,21 +696,11 @@ static void merge_pstates(struct cpuidle_datas *datas, percpu_a = &(datas->pstates[cpu]); percpu_b = &(baseline->pstates[cpu]); - for (idx = 0; idx < percpu_a->max && idx < percpu_b->max; ) { - if (percpu_a->pstate[idx].freq > - percpu_b->pstate[idx].freq) { - assert(alloc_pstate(percpu_b, - percpu_a->pstate[idx].freq) == idx); - continue; - } - if (percpu_a->pstate[idx].freq < - percpu_b->pstate[idx].freq) { - assert(alloc_pstate(percpu_a, - percpu_b->pstate[idx].freq) == idx); - continue; - } - ++idx; - } + for (idx = 0; idx < percpu_a->max; ++idx) + alloc_pstate(percpu_b, percpu_a->pstate[idx].freq); + + for (idx = 0; idx < percpu_b->max; ++idx) + alloc_pstate(percpu_a, percpu_b->pstate[idx].freq); } } -- cgit v1.2.3