PM / devfreq: Move statistics to separate struct devfreq_stats

Count time and transitions between devfreq frequencies in separate
struct devfreq_stats for improved code readability and maintenance.

Signed-off-by: Kamil Konieczny <k.konieczny@samsung.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
[cw00.choi: Fix the merge conflict in trasn_stat_store
 and use 'devfreq->stats.*' style for consistent coding style
 and restore the clean-up code of 'devfreq->profile->*']
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This commit is contained in:
Kamil Konieczny 2019-12-06 13:46:39 +09:00 committed by Chanwoo Choi
parent 14a3439681
commit 1ebd0bc0e8
2 changed files with 40 additions and 30 deletions

View file

@ -107,6 +107,20 @@ struct devfreq_dev_profile {
unsigned int max_state;
};
/**
* struct devfreq_stats - Statistics of devfreq device behavior
* @total_trans: Number of devfreq transitions.
* @trans_table: Statistics of devfreq transitions.
* @time_in_state: Statistics of devfreq states.
* @last_update: The last time stats were updated.
*/
struct devfreq_stats {
unsigned int total_trans;
unsigned int *trans_table;
u64 *time_in_state;
u64 last_update;
};
/**
* struct devfreq - Device devfreq structure
* @node: list node - contains the devices with devfreq that have been
@ -132,10 +146,7 @@ struct devfreq_dev_profile {
* @suspend_freq: frequency of a device set during suspend phase.
* @resume_freq: frequency of a device set in resume phase.
* @suspend_count: suspend requests counter for a device.
* @total_trans: Number of devfreq transitions
* @trans_table: Statistics of devfreq transitions
* @time_in_state: Statistics of devfreq states
* @last_stat_updated: The last time stat updated
* @stats: Statistics of devfreq device behavior
* @transition_notifier_list: list head of DEVFREQ_TRANSITION_NOTIFIER notifier
* @nb_min: Notifier block for DEV_PM_QOS_MIN_FREQUENCY
* @nb_max: Notifier block for DEV_PM_QOS_MAX_FREQUENCY
@ -174,11 +185,8 @@ struct devfreq {
unsigned long resume_freq;
atomic_t suspend_count;
/* information for device frequency transition */
unsigned int total_trans;
unsigned int *trans_table;
u64 *time_in_state;
u64 last_stat_updated;
/* information for device frequency transitions */
struct devfreq_stats stats;
struct srcu_notifier_head transition_notifier_list;