Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM / devfreq: account suspend/resume for stats

devfreq stats is not taking device suspend and resume into
account. Fix it.

Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

authored by

Rajagopal Venkat and committed by
MyungJoo Ham
39688ce6 6ccce699

+12 -3
+12 -3
drivers/devfreq/devfreq.c
··· 271 271 return; 272 272 } 273 273 274 + devfreq_update_status(devfreq, devfreq->previous_freq); 274 275 devfreq->stop_polling = true; 275 276 mutex_unlock(&devfreq->lock); 276 277 cancel_delayed_work_sync(&devfreq->work); ··· 288 287 */ 289 288 void devfreq_monitor_resume(struct devfreq *devfreq) 290 289 { 290 + unsigned long freq; 291 + 291 292 mutex_lock(&devfreq->lock); 292 293 if (!devfreq->stop_polling) 293 294 goto out; ··· 298 295 devfreq->profile->polling_ms) 299 296 queue_delayed_work(devfreq_wq, &devfreq->work, 300 297 msecs_to_jiffies(devfreq->profile->polling_ms)); 298 + 299 + devfreq->last_stat_updated = jiffies; 301 300 devfreq->stop_polling = false; 301 + 302 + if (devfreq->profile->get_cur_freq && 303 + !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq)) 304 + devfreq->previous_freq = freq; 302 305 303 306 out: 304 307 mutex_unlock(&devfreq->lock); ··· 914 905 { 915 906 struct devfreq *devfreq = to_devfreq(dev); 916 907 ssize_t len; 917 - int i, j, err; 908 + int i, j; 918 909 unsigned int max_state = devfreq->profile->max_state; 919 910 920 - err = devfreq_update_status(devfreq, devfreq->previous_freq); 921 - if (err) 911 + if (!devfreq->stop_polling && 912 + devfreq_update_status(devfreq, devfreq->previous_freq)) 922 913 return 0; 923 914 924 915 len = sprintf(buf, " From : To\n");