cpufreq: governor: Rename some data types and variables

The ondemand and conservative governors are represented by
struct common_dbs_data whose name doesn't reflect the purpose it
is used for, so rename it to struct dbs_governor and rename
variables of that type accordingly.

No functional changes.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
Rafael J. Wysocki 2016-02-07 16:05:07 +01:00
parent af92618523
commit 7bdad34d08
5 changed files with 59 additions and 59 deletions

View File

@ -48,7 +48,7 @@ static unsigned int amd_powersave_bias_target(struct cpufreq_policy *policy,
struct dbs_data *od_data = policy->governor_data;
struct od_dbs_tuners *od_tuners = od_data->tuners;
struct od_cpu_dbs_info_s *od_info =
od_data->cdata->get_cpu_dbs_info_s(policy->cpu);
od_data->gov->get_cpu_dbs_info_s(policy->cpu);
if (!od_info->freq_table)
return freq_next;

View File

@ -119,7 +119,7 @@ static struct notifier_block cs_cpufreq_notifier_block = {
};
/************************** sysfs interface ************************/
static struct common_dbs_data cs_dbs_cdata;
static struct dbs_governor cs_dbs_gov;
static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data,
const char *buf, size_t count)
@ -328,7 +328,7 @@ define_get_cpu_dbs_routines(cs_cpu_dbs_info);
static int cs_cpufreq_governor_dbs(struct cpufreq_policy *policy,
unsigned int event);
static struct common_dbs_data cs_dbs_cdata = {
static struct dbs_governor cs_dbs_gov = {
.gov = {
.name = "conservative",
.governor = cs_cpufreq_governor_dbs,
@ -346,12 +346,12 @@ static struct common_dbs_data cs_dbs_cdata = {
.exit = cs_exit,
};
#define CPU_FREQ_GOV_CONSERVATIVE (&cs_dbs_cdata.gov)
#define CPU_FREQ_GOV_CONSERVATIVE (&cs_dbs_gov.gov)
static int cs_cpufreq_governor_dbs(struct cpufreq_policy *policy,
unsigned int event)
{
return cpufreq_governor_dbs(policy, &cs_dbs_cdata, event);
return cpufreq_governor_dbs(policy, &cs_dbs_gov, event);
}
static int dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val,

View File

@ -28,14 +28,14 @@ EXPORT_SYMBOL_GPL(dbs_data_mutex);
static struct attribute_group *get_sysfs_attr(struct dbs_data *dbs_data)
{
if (have_governor_per_policy())
return dbs_data->cdata->attr_group_gov_pol;
return dbs_data->gov->attr_group_gov_pol;
else
return dbs_data->cdata->attr_group_gov_sys;
return dbs_data->gov->attr_group_gov_sys;
}
void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)
{
struct cpu_dbs_info *cdbs = dbs_data->cdata->get_cpu_cdbs(cpu);
struct cpu_dbs_info *cdbs = dbs_data->gov->get_cpu_cdbs(cpu);
struct od_dbs_tuners *od_tuners = dbs_data->tuners;
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
struct cpufreq_policy *policy = cdbs->shared->policy;
@ -44,9 +44,9 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)
unsigned int ignore_nice;
unsigned int j;
if (dbs_data->cdata->governor == GOV_ONDEMAND) {
if (dbs_data->gov->governor == GOV_ONDEMAND) {
struct od_cpu_dbs_info_s *od_dbs_info =
dbs_data->cdata->get_cpu_dbs_info_s(cpu);
dbs_data->gov->get_cpu_dbs_info_s(cpu);
/*
* Sometimes, the ondemand governor uses an additional
@ -71,7 +71,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)
unsigned int load;
int io_busy = 0;
j_cdbs = dbs_data->cdata->get_cpu_cdbs(j);
j_cdbs = dbs_data->gov->get_cpu_cdbs(j);
/*
* For the purpose of ondemand, waiting for disk IO is
@ -79,7 +79,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)
* not that the system is actually idle. So do not add
* the iowait time to the cpu idle time.
*/
if (dbs_data->cdata->governor == GOV_ONDEMAND)
if (dbs_data->gov->governor == GOV_ONDEMAND)
io_busy = od_tuners->io_is_busy;
cur_idle_time = get_cpu_idle_time(j, &cur_wall_time, io_busy);
@ -160,7 +160,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)
max_load = load;
}
dbs_data->cdata->gov_check_cpu(cpu, max_load);
dbs_data->gov->gov_check_cpu(cpu, max_load);
}
EXPORT_SYMBOL_GPL(dbs_check_cpu);
@ -175,7 +175,7 @@ void gov_set_update_util(struct cpu_common_dbs_info *shared,
shared->last_sample_time = 0;
for_each_cpu(cpu, policy->cpus) {
struct cpu_dbs_info *cdbs = dbs_data->cdata->get_cpu_cdbs(cpu);
struct cpu_dbs_info *cdbs = dbs_data->gov->get_cpu_cdbs(cpu);
cpufreq_set_update_util_data(cpu, &cdbs->update_util);
}
@ -223,7 +223,7 @@ static void dbs_work_handler(struct work_struct *work)
* ondemand governor isn't updating the sampling rate in parallel.
*/
mutex_lock(&shared->timer_mutex);
delay = dbs_data->cdata->gov_dbs_timer(policy);
delay = dbs_data->gov->gov_dbs_timer(policy);
shared->sample_delay_ns = jiffies_to_nsecs(delay);
mutex_unlock(&shared->timer_mutex);
@ -282,7 +282,7 @@ static void dbs_update_util_handler(struct update_util_data *data, u64 time,
static void set_sampling_rate(struct dbs_data *dbs_data,
unsigned int sampling_rate)
{
if (dbs_data->cdata->governor == GOV_CONSERVATIVE) {
if (dbs_data->gov->governor == GOV_CONSERVATIVE) {
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
cs_tuners->sampling_rate = sampling_rate;
} else {
@ -292,7 +292,7 @@ static void set_sampling_rate(struct dbs_data *dbs_data,
}
static int alloc_common_dbs_info(struct cpufreq_policy *policy,
struct common_dbs_data *cdata)
struct dbs_governor *gov)
{
struct cpu_common_dbs_info *shared;
int j;
@ -304,7 +304,7 @@ static int alloc_common_dbs_info(struct cpufreq_policy *policy,
/* Set shared for all CPUs, online+offline */
for_each_cpu(j, policy->related_cpus)
cdata->get_cpu_cdbs(j)->shared = shared;
gov->get_cpu_cdbs(j)->shared = shared;
mutex_init(&shared->timer_mutex);
atomic_set(&shared->skip_work, 0);
@ -314,24 +314,24 @@ static int alloc_common_dbs_info(struct cpufreq_policy *policy,
}
static void free_common_dbs_info(struct cpufreq_policy *policy,
struct common_dbs_data *cdata)
struct dbs_governor *gov)
{
struct cpu_dbs_info *cdbs = cdata->get_cpu_cdbs(policy->cpu);
struct cpu_dbs_info *cdbs = gov->get_cpu_cdbs(policy->cpu);
struct cpu_common_dbs_info *shared = cdbs->shared;
int j;
mutex_destroy(&shared->timer_mutex);
for_each_cpu(j, policy->cpus)
cdata->get_cpu_cdbs(j)->shared = NULL;
gov->get_cpu_cdbs(j)->shared = NULL;
kfree(shared);
}
static int cpufreq_governor_init(struct cpufreq_policy *policy,
struct common_dbs_data *cdata)
struct dbs_governor *gov)
{
struct dbs_data *dbs_data = cdata->gdbs_data;
struct dbs_data *dbs_data = gov->gdbs_data;
unsigned int latency;
int ret;
@ -343,7 +343,7 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy,
if (WARN_ON(have_governor_per_policy()))
return -EINVAL;
ret = alloc_common_dbs_info(policy, cdata);
ret = alloc_common_dbs_info(policy, gov);
if (ret)
return ret;
@ -356,14 +356,14 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy,
if (!dbs_data)
return -ENOMEM;
ret = alloc_common_dbs_info(policy, cdata);
ret = alloc_common_dbs_info(policy, gov);
if (ret)
goto free_dbs_data;
dbs_data->cdata = cdata;
dbs_data->gov = gov;
dbs_data->usage_count = 1;
ret = cdata->init(dbs_data, !policy->governor->initialized);
ret = gov->init(dbs_data, !policy->governor->initialized);
if (ret)
goto free_common_dbs_info;
@ -379,7 +379,7 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy,
latency * LATENCY_MULTIPLIER));
if (!have_governor_per_policy())
cdata->gdbs_data = dbs_data;
gov->gdbs_data = dbs_data;
policy->governor_data = dbs_data;
@ -394,10 +394,10 @@ reset_gdbs_data:
policy->governor_data = NULL;
if (!have_governor_per_policy())
cdata->gdbs_data = NULL;
cdata->exit(dbs_data, !policy->governor->initialized);
gov->gdbs_data = NULL;
gov->exit(dbs_data, !policy->governor->initialized);
free_common_dbs_info:
free_common_dbs_info(policy, cdata);
free_common_dbs_info(policy, gov);
free_dbs_data:
kfree(dbs_data);
return ret;
@ -406,8 +406,8 @@ free_dbs_data:
static int cpufreq_governor_exit(struct cpufreq_policy *policy)
{
struct dbs_data *dbs_data = policy->governor_data;
struct common_dbs_data *cdata = dbs_data->cdata;
struct cpu_dbs_info *cdbs = cdata->get_cpu_cdbs(policy->cpu);
struct dbs_governor *gov = dbs_data->gov;
struct cpu_dbs_info *cdbs = gov->get_cpu_cdbs(policy->cpu);
/* State should be equivalent to INIT */
if (!cdbs->shared || cdbs->shared->policy)
@ -420,24 +420,24 @@ static int cpufreq_governor_exit(struct cpufreq_policy *policy)
policy->governor_data = NULL;
if (!have_governor_per_policy())
cdata->gdbs_data = NULL;
gov->gdbs_data = NULL;
cdata->exit(dbs_data, policy->governor->initialized == 1);
gov->exit(dbs_data, policy->governor->initialized == 1);
kfree(dbs_data);
} else {
policy->governor_data = NULL;
}
free_common_dbs_info(policy, cdata);
free_common_dbs_info(policy, gov);
return 0;
}
static int cpufreq_governor_start(struct cpufreq_policy *policy)
{
struct dbs_data *dbs_data = policy->governor_data;
struct common_dbs_data *cdata = dbs_data->cdata;
struct dbs_governor *gov = dbs_data->gov;
unsigned int sampling_rate, ignore_nice, j, cpu = policy->cpu;
struct cpu_dbs_info *cdbs = cdata->get_cpu_cdbs(cpu);
struct cpu_dbs_info *cdbs = gov->get_cpu_cdbs(cpu);
struct cpu_common_dbs_info *shared = cdbs->shared;
int io_busy = 0;
@ -448,7 +448,7 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy)
if (!shared || shared->policy)
return -EBUSY;
if (cdata->governor == GOV_CONSERVATIVE) {
if (gov->governor == GOV_CONSERVATIVE) {
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
sampling_rate = cs_tuners->sampling_rate;
@ -462,7 +462,7 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy)
}
for_each_cpu(j, policy->cpus) {
struct cpu_dbs_info *j_cdbs = cdata->get_cpu_cdbs(j);
struct cpu_dbs_info *j_cdbs = gov->get_cpu_cdbs(j);
unsigned int prev_load;
j_cdbs->prev_cpu_idle =
@ -480,15 +480,15 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy)
}
shared->policy = policy;
if (cdata->governor == GOV_CONSERVATIVE) {
if (gov->governor == GOV_CONSERVATIVE) {
struct cs_cpu_dbs_info_s *cs_dbs_info =
cdata->get_cpu_dbs_info_s(cpu);
gov->get_cpu_dbs_info_s(cpu);
cs_dbs_info->down_skip = 0;
cs_dbs_info->requested_freq = policy->cur;
} else {
struct od_ops *od_ops = cdata->gov_ops;
struct od_cpu_dbs_info_s *od_dbs_info = cdata->get_cpu_dbs_info_s(cpu);
struct od_ops *od_ops = gov->gov_ops;
struct od_cpu_dbs_info_s *od_dbs_info = gov->get_cpu_dbs_info_s(cpu);
od_dbs_info->rate_mult = 1;
od_dbs_info->sample_type = OD_NORMAL_SAMPLE;
@ -502,7 +502,7 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy)
static int cpufreq_governor_stop(struct cpufreq_policy *policy)
{
struct dbs_data *dbs_data = policy->governor_data;
struct cpu_dbs_info *cdbs = dbs_data->cdata->get_cpu_cdbs(policy->cpu);
struct cpu_dbs_info *cdbs = dbs_data->gov->get_cpu_cdbs(policy->cpu);
struct cpu_common_dbs_info *shared = cdbs->shared;
/* State should be equivalent to START */
@ -518,9 +518,9 @@ static int cpufreq_governor_stop(struct cpufreq_policy *policy)
static int cpufreq_governor_limits(struct cpufreq_policy *policy)
{
struct dbs_data *dbs_data = policy->governor_data;
struct common_dbs_data *cdata = dbs_data->cdata;
struct dbs_governor *gov = dbs_data->gov;
unsigned int cpu = policy->cpu;
struct cpu_dbs_info *cdbs = cdata->get_cpu_cdbs(cpu);
struct cpu_dbs_info *cdbs = gov->get_cpu_cdbs(cpu);
/* State should be equivalent to START */
if (!cdbs->shared || !cdbs->shared->policy)
@ -540,7 +540,7 @@ static int cpufreq_governor_limits(struct cpufreq_policy *policy)
}
int cpufreq_governor_dbs(struct cpufreq_policy *policy,
struct common_dbs_data *cdata, unsigned int event)
struct dbs_governor *gov, unsigned int event)
{
int ret = -EINVAL;
@ -548,7 +548,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
mutex_lock(&dbs_data_mutex);
if (event == CPUFREQ_GOV_POLICY_INIT) {
ret = cpufreq_governor_init(policy, cdata);
ret = cpufreq_governor_init(policy, gov);
} else if (policy->governor_data) {
switch (event) {
case CPUFREQ_GOV_POLICY_EXIT:

View File

@ -78,7 +78,7 @@ __ATTR(_name, 0644, show_##_name##_gov_pol, store_##_name##_gov_pol)
static ssize_t show_##file_name##_gov_sys \
(struct kobject *kobj, struct attribute *attr, char *buf) \
{ \
struct _gov##_dbs_tuners *tuners = _gov##_dbs_cdata.gdbs_data->tuners; \
struct _gov##_dbs_tuners *tuners = _gov##_dbs_gov.gdbs_data->tuners; \
return sprintf(buf, "%u\n", tuners->file_name); \
} \
\
@ -94,7 +94,7 @@ static ssize_t show_##file_name##_gov_pol \
static ssize_t store_##file_name##_gov_sys \
(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) \
{ \
struct dbs_data *dbs_data = _gov##_dbs_cdata.gdbs_data; \
struct dbs_data *dbs_data = _gov##_dbs_gov.gdbs_data; \
return store_##file_name(dbs_data, buf, count); \
} \
\
@ -205,7 +205,7 @@ struct cs_dbs_tuners {
/* Common Governor data across policies */
struct dbs_data;
struct common_dbs_data {
struct dbs_governor {
struct cpufreq_governor gov;
#define GOV_ONDEMAND 0
@ -233,7 +233,7 @@ struct common_dbs_data {
/* Governor Per policy data */
struct dbs_data {
struct common_dbs_data *cdata;
struct dbs_governor *gov;
unsigned int min_sampling_rate;
int usage_count;
void *tuners;
@ -262,7 +262,7 @@ static inline int delay_for_sampling_rate(unsigned int sampling_rate)
static ssize_t show_sampling_rate_min_gov_sys \
(struct kobject *kobj, struct attribute *attr, char *buf) \
{ \
struct dbs_data *dbs_data = _gov##_dbs_cdata.gdbs_data; \
struct dbs_data *dbs_data = _gov##_dbs_gov.gdbs_data; \
return sprintf(buf, "%u\n", dbs_data->min_sampling_rate); \
} \
\
@ -277,7 +277,7 @@ extern struct mutex dbs_data_mutex;
extern struct mutex cpufreq_governor_lock;
void dbs_check_cpu(struct dbs_data *dbs_data, int cpu);
int cpufreq_governor_dbs(struct cpufreq_policy *policy,
struct common_dbs_data *cdata, unsigned int event);
struct dbs_governor *gov, unsigned int event);
void od_register_powersave_bias_handler(unsigned int (*f)
(struct cpufreq_policy *, unsigned int, unsigned int),
unsigned int powersave_bias);

View File

@ -219,7 +219,7 @@ static unsigned int od_dbs_timer(struct cpufreq_policy *policy)
}
/************************** sysfs interface ************************/
static struct common_dbs_data od_dbs_cdata;
static struct dbs_governor od_dbs_gov;
/**
* update_sampling_rate - update sampling rate effective immediately if needed.
@ -542,7 +542,7 @@ static struct od_ops od_ops = {
static int od_cpufreq_governor_dbs(struct cpufreq_policy *policy,
unsigned int event);
static struct common_dbs_data od_dbs_cdata = {
static struct dbs_governor od_dbs_gov = {
.gov = {
.name = "ondemand",
.governor = od_cpufreq_governor_dbs,
@ -561,12 +561,12 @@ static struct common_dbs_data od_dbs_cdata = {
.exit = od_exit,
};
#define CPU_FREQ_GOV_ONDEMAND (&od_dbs_cdata.gov)
#define CPU_FREQ_GOV_ONDEMAND (&od_dbs_gov.gov)
static int od_cpufreq_governor_dbs(struct cpufreq_policy *policy,
unsigned int event)
{
return cpufreq_governor_dbs(policy, &od_dbs_cdata, event);
return cpufreq_governor_dbs(policy, &od_dbs_gov, event);
}
static void od_set_powersave_bias(unsigned int powersave_bias)