No idea when 'old_index == new_index' in transition notifier (probably never?), but if this happens, we aren't supposed to update time_in_state by calling cpufreq_stats_update(). Its only relevant when we are changing frequencies.
So, move the call after matching indexes.
Reviewed-by: Prarit Bhargava prarit@redhat.com Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- drivers/cpufreq/cpufreq_stats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index c0c2ddece8fe..7701532b32c8 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -293,11 +293,11 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb, if (old_index == -1 || new_index == -1) return 0;
- cpufreq_stats_update(stat); - if (old_index == new_index) return 0;
+ cpufreq_stats_update(stat); + spin_lock(&cpufreq_stats_lock); stat->last_index = new_index; #ifdef CONFIG_CPU_FREQ_STAT_DETAILS