cpufreq: governor: New data type for management part of dbs_data
In addition to fields representing governor tunables, struct dbs_data contains some fields needed for the management of objects of that type. As it turns out, that part of struct dbs_data may be shared with (future) governors that won't use the common code used by "ondemand" and "conservative", so move it to a separate struct type and modify the code using struct dbs_data to follow. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
@@ -207,9 +207,10 @@ static unsigned int od_dbs_timer(struct cpufreq_policy *policy)
|
||||
/************************** sysfs interface ************************/
|
||||
static struct dbs_governor od_dbs_gov;
|
||||
|
||||
static ssize_t store_io_is_busy(struct dbs_data *dbs_data, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t store_io_is_busy(struct gov_attr_set *attr_set, const char *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct dbs_data *dbs_data = to_dbs_data(attr_set);
|
||||
unsigned int input;
|
||||
int ret;
|
||||
|
||||
@@ -224,9 +225,10 @@ static ssize_t store_io_is_busy(struct dbs_data *dbs_data, const char *buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t store_up_threshold(struct dbs_data *dbs_data, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t store_up_threshold(struct gov_attr_set *attr_set,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct dbs_data *dbs_data = to_dbs_data(attr_set);
|
||||
unsigned int input;
|
||||
int ret;
|
||||
ret = sscanf(buf, "%u", &input);
|
||||
@@ -240,9 +242,10 @@ static ssize_t store_up_threshold(struct dbs_data *dbs_data, const char *buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data,
|
||||
const char *buf, size_t count)
|
||||
static ssize_t store_sampling_down_factor(struct gov_attr_set *attr_set,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct dbs_data *dbs_data = to_dbs_data(attr_set);
|
||||
struct policy_dbs_info *policy_dbs;
|
||||
unsigned int input;
|
||||
int ret;
|
||||
@@ -254,7 +257,7 @@ static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data,
|
||||
dbs_data->sampling_down_factor = input;
|
||||
|
||||
/* Reset down sampling multiplier in case it was active */
|
||||
list_for_each_entry(policy_dbs, &dbs_data->policy_dbs_list, list) {
|
||||
list_for_each_entry(policy_dbs, &attr_set->policy_list, list) {
|
||||
/*
|
||||
* Doing this without locking might lead to using different
|
||||
* rate_mult values in od_update() and od_dbs_timer().
|
||||
@@ -267,9 +270,10 @@ static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data,
|
||||
const char *buf, size_t count)
|
||||
static ssize_t store_ignore_nice_load(struct gov_attr_set *attr_set,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct dbs_data *dbs_data = to_dbs_data(attr_set);
|
||||
unsigned int input;
|
||||
int ret;
|
||||
|
||||
@@ -291,9 +295,10 @@ static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t store_powersave_bias(struct dbs_data *dbs_data, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t store_powersave_bias(struct gov_attr_set *attr_set,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct dbs_data *dbs_data = to_dbs_data(attr_set);
|
||||
struct od_dbs_tuners *od_tuners = dbs_data->tuners;
|
||||
struct policy_dbs_info *policy_dbs;
|
||||
unsigned int input;
|
||||
@@ -308,7 +313,7 @@ static ssize_t store_powersave_bias(struct dbs_data *dbs_data, const char *buf,
|
||||
|
||||
od_tuners->powersave_bias = input;
|
||||
|
||||
list_for_each_entry(policy_dbs, &dbs_data->policy_dbs_list, list)
|
||||
list_for_each_entry(policy_dbs, &attr_set->policy_list, list)
|
||||
ondemand_powersave_bias_init(policy_dbs->policy);
|
||||
|
||||
return count;
|
||||
|
Reference in New Issue
Block a user