Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175371
b: refs/heads/master
c: 49b015c
h: refs/heads/master
i:
  175369: 46985af
  175367: b3e7562
v: v3
  • Loading branch information
Thomas Renninger authored and Dave Jones committed Nov 24, 2009
1 parent db4f584 commit 2db42bb
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0cda8b91f2e096bbef1cb05f23c42e423eae7728
refs/heads/master: 49b015ce38edeb484fb2efa09048c23e903f49d6
129 changes: 110 additions & 19 deletions trunk/drivers/cpufreq/cpufreq_conservative.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,22 @@ static struct notifier_block dbs_cpufreq_notifier_block = {
};

/************************** sysfs interface ************************/
static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf)
static ssize_t show_sampling_rate_max(struct kobject *kobj,
struct attribute *attr, char *buf)
{
printk_once(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
"sysfs file is deprecated - used by: %s\n", current->comm);
return sprintf(buf, "%u\n", -1U);
}

static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf)
static ssize_t show_sampling_rate_min(struct kobject *kobj,
struct attribute *attr, char *buf)
{
return sprintf(buf, "%u\n", min_sampling_rate);
}

#define define_one_ro(_name) \
static struct freq_attr _name = \
static struct global_attr _name = \
__ATTR(_name, 0444, show_##_name, NULL)

define_one_ro(sampling_rate_max);
Expand All @@ -186,7 +188,7 @@ define_one_ro(sampling_rate_min);
/* cpufreq_conservative Governor Tunables */
#define show_one(file_name, object) \
static ssize_t show_##file_name \
(struct cpufreq_policy *unused, char *buf) \
(struct kobject *kobj, struct attribute *attr, char *buf) \
{ \
return sprintf(buf, "%u\n", dbs_tuners_ins.object); \
}
Expand All @@ -197,8 +199,40 @@ show_one(down_threshold, down_threshold);
show_one(ignore_nice_load, ignore_nice);
show_one(freq_step, freq_step);

static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused,
const char *buf, size_t count)
/*** delete after deprecation time ***/
#define DEPRECATION_MSG(file_name) \
printk_once(KERN_INFO "CPUFREQ: Per core conservative sysfs " \
"interface is deprecated - " #file_name "\n");

#define show_one_old(file_name) \
static ssize_t show_##file_name##_old \
(struct cpufreq_policy *unused, char *buf) \
{ \
printk_once(KERN_INFO "CPUFREQ: Per core conservative sysfs " \
"interface is deprecated - " #file_name "\n"); \
return show_##file_name(NULL, NULL, buf); \
}
show_one_old(sampling_rate);
show_one_old(sampling_down_factor);
show_one_old(up_threshold);
show_one_old(down_threshold);
show_one_old(ignore_nice_load);
show_one_old(freq_step);
show_one_old(sampling_rate_min);
show_one_old(sampling_rate_max);

#define define_one_ro_old(object, _name) \
static struct freq_attr object = \
__ATTR(_name, 0444, show_##_name##_old, NULL)

define_one_ro_old(sampling_rate_min_old, sampling_rate_min);
define_one_ro_old(sampling_rate_max_old, sampling_rate_max);

/*** delete after deprecation time ***/

static ssize_t store_sampling_down_factor(struct kobject *a,
struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
Expand All @@ -214,8 +248,8 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused,
return count;
}

static ssize_t store_sampling_rate(struct cpufreq_policy *unused,
const char *buf, size_t count)
static ssize_t store_sampling_rate(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
Expand All @@ -231,8 +265,8 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused,
return count;
}

static ssize_t store_up_threshold(struct cpufreq_policy *unused,
const char *buf, size_t count)
static ssize_t store_up_threshold(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
Expand All @@ -251,8 +285,8 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
return count;
}

static ssize_t store_down_threshold(struct cpufreq_policy *unused,
const char *buf, size_t count)
static ssize_t store_down_threshold(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
Expand All @@ -272,8 +306,8 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused,
return count;
}

static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy,
const char *buf, size_t count)
static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
Expand Down Expand Up @@ -308,8 +342,8 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy,
return count;
}

static ssize_t store_freq_step(struct cpufreq_policy *policy,
const char *buf, size_t count)
static ssize_t store_freq_step(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
Expand All @@ -331,7 +365,7 @@ static ssize_t store_freq_step(struct cpufreq_policy *policy,
}

#define define_one_rw(_name) \
static struct freq_attr _name = \
static struct global_attr _name = \
__ATTR(_name, 0644, show_##_name, store_##_name)

define_one_rw(sampling_rate);
Expand All @@ -358,6 +392,53 @@ static struct attribute_group dbs_attr_group = {
.name = "conservative",
};

/*** delete after deprecation time ***/

#define write_one_old(file_name) \
static ssize_t store_##file_name##_old \
(struct cpufreq_policy *unused, const char *buf, size_t count) \
{ \
printk_once(KERN_INFO "CPUFREQ: Per core conservative sysfs " \
"interface is deprecated - " #file_name "\n"); \
return store_##file_name(NULL, NULL, buf, count); \
}
write_one_old(sampling_rate);
write_one_old(sampling_down_factor);
write_one_old(up_threshold);
write_one_old(down_threshold);
write_one_old(ignore_nice_load);
write_one_old(freq_step);

#define define_one_rw_old(object, _name) \
static struct freq_attr object = \
__ATTR(_name, 0644, show_##_name##_old, store_##_name##_old)

define_one_rw_old(sampling_rate_old, sampling_rate);
define_one_rw_old(sampling_down_factor_old, sampling_down_factor);
define_one_rw_old(up_threshold_old, up_threshold);
define_one_rw_old(down_threshold_old, down_threshold);
define_one_rw_old(ignore_nice_load_old, ignore_nice_load);
define_one_rw_old(freq_step_old, freq_step);

static struct attribute *dbs_attributes_old[] = {
&sampling_rate_max_old.attr,
&sampling_rate_min_old.attr,
&sampling_rate_old.attr,
&sampling_down_factor_old.attr,
&up_threshold_old.attr,
&down_threshold_old.attr,
&ignore_nice_load_old.attr,
&freq_step_old.attr,
NULL
};

static struct attribute_group dbs_attr_group_old = {
.attrs = dbs_attributes_old,
.name = "conservative",
};

/*** delete after deprecation time ***/

/************************** sysfs end ************************/

static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
Expand Down Expand Up @@ -530,7 +611,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,

mutex_lock(&dbs_mutex);

rc = sysfs_create_group(&policy->kobj, &dbs_attr_group);
rc = sysfs_create_group(&policy->kobj, &dbs_attr_group_old);
if (rc) {
mutex_unlock(&dbs_mutex);
return rc;
Expand Down Expand Up @@ -564,6 +645,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
if (latency == 0)
latency = 1;

rc = sysfs_create_group(cpufreq_global_kobject,
&dbs_attr_group);
if (rc) {
mutex_unlock(&dbs_mutex);
return rc;
}

/*
* conservative does not implement micro like ondemand
* governor, thus we are bound to jiffes/HZ
Expand Down Expand Up @@ -591,7 +679,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
dbs_timer_exit(this_dbs_info);

mutex_lock(&dbs_mutex);
sysfs_remove_group(&policy->kobj, &dbs_attr_group);
sysfs_remove_group(&policy->kobj, &dbs_attr_group_old);
dbs_enable--;
mutex_destroy(&this_dbs_info->timer_mutex);

Expand All @@ -605,6 +693,9 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
CPUFREQ_TRANSITION_NOTIFIER);

mutex_unlock(&dbs_mutex);
if (!dbs_enable)
sysfs_remove_group(cpufreq_global_kobject,
&dbs_attr_group);

break;

Expand Down

0 comments on commit 2db42bb

Please sign in to comment.