Commit a93d6b0a authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

devfreq: convert devfreq_class to use dev_groups

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the devfreq_class code to use the
correct field.

Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 567b21e9
...@@ -703,7 +703,7 @@ int devfreq_remove_governor(struct devfreq_governor *governor) ...@@ -703,7 +703,7 @@ int devfreq_remove_governor(struct devfreq_governor *governor)
} }
EXPORT_SYMBOL(devfreq_remove_governor); EXPORT_SYMBOL(devfreq_remove_governor);
static ssize_t show_governor(struct device *dev, static ssize_t governor_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
if (!to_devfreq(dev)->governor) if (!to_devfreq(dev)->governor)
...@@ -712,7 +712,7 @@ static ssize_t show_governor(struct device *dev, ...@@ -712,7 +712,7 @@ static ssize_t show_governor(struct device *dev,
return sprintf(buf, "%s\n", to_devfreq(dev)->governor->name); return sprintf(buf, "%s\n", to_devfreq(dev)->governor->name);
} }
static ssize_t store_governor(struct device *dev, struct device_attribute *attr, static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct devfreq *df = to_devfreq(dev); struct devfreq *df = to_devfreq(dev);
...@@ -754,9 +754,11 @@ static ssize_t store_governor(struct device *dev, struct device_attribute *attr, ...@@ -754,9 +754,11 @@ static ssize_t store_governor(struct device *dev, struct device_attribute *attr,
ret = count; ret = count;
return ret; return ret;
} }
static ssize_t show_available_governors(struct device *d, static DEVICE_ATTR_RW(governor);
struct device_attribute *attr,
char *buf) static ssize_t available_governors_show(struct device *d,
struct device_attribute *attr,
char *buf)
{ {
struct devfreq_governor *tmp_governor; struct devfreq_governor *tmp_governor;
ssize_t count = 0; ssize_t count = 0;
...@@ -775,9 +777,10 @@ static ssize_t show_available_governors(struct device *d, ...@@ -775,9 +777,10 @@ static ssize_t show_available_governors(struct device *d,
return count; return count;
} }
static DEVICE_ATTR_RO(available_governors);
static ssize_t show_freq(struct device *dev, static ssize_t cur_freq_show(struct device *dev, struct device_attribute *attr,
struct device_attribute *attr, char *buf) char *buf)
{ {
unsigned long freq; unsigned long freq;
struct devfreq *devfreq = to_devfreq(dev); struct devfreq *devfreq = to_devfreq(dev);
...@@ -788,20 +791,22 @@ static ssize_t show_freq(struct device *dev, ...@@ -788,20 +791,22 @@ static ssize_t show_freq(struct device *dev,
return sprintf(buf, "%lu\n", devfreq->previous_freq); return sprintf(buf, "%lu\n", devfreq->previous_freq);
} }
static DEVICE_ATTR_RO(cur_freq);
static ssize_t show_target_freq(struct device *dev, static ssize_t target_freq_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq); return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq);
} }
static DEVICE_ATTR_RO(target_freq);
static ssize_t show_polling_interval(struct device *dev, static ssize_t polling_interval_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return sprintf(buf, "%d\n", to_devfreq(dev)->profile->polling_ms); return sprintf(buf, "%d\n", to_devfreq(dev)->profile->polling_ms);
} }
static ssize_t store_polling_interval(struct device *dev, static ssize_t polling_interval_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
...@@ -821,8 +826,9 @@ static ssize_t store_polling_interval(struct device *dev, ...@@ -821,8 +826,9 @@ static ssize_t store_polling_interval(struct device *dev,
return ret; return ret;
} }
static DEVICE_ATTR_RW(polling_interval);
static ssize_t store_min_freq(struct device *dev, struct device_attribute *attr, static ssize_t min_freq_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct devfreq *df = to_devfreq(dev); struct devfreq *df = to_devfreq(dev);
...@@ -849,13 +855,13 @@ static ssize_t store_min_freq(struct device *dev, struct device_attribute *attr, ...@@ -849,13 +855,13 @@ static ssize_t store_min_freq(struct device *dev, struct device_attribute *attr,
return ret; return ret;
} }
static ssize_t show_min_freq(struct device *dev, struct device_attribute *attr, static ssize_t min_freq_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "%lu\n", to_devfreq(dev)->min_freq); return sprintf(buf, "%lu\n", to_devfreq(dev)->min_freq);
} }
static ssize_t store_max_freq(struct device *dev, struct device_attribute *attr, static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct devfreq *df = to_devfreq(dev); struct devfreq *df = to_devfreq(dev);
...@@ -881,16 +887,18 @@ static ssize_t store_max_freq(struct device *dev, struct device_attribute *attr, ...@@ -881,16 +887,18 @@ static ssize_t store_max_freq(struct device *dev, struct device_attribute *attr,
mutex_unlock(&df->lock); mutex_unlock(&df->lock);
return ret; return ret;
} }
static DEVICE_ATTR_RW(min_freq);
static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr, static ssize_t max_freq_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq); return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq);
} }
static DEVICE_ATTR_RW(max_freq);
static ssize_t show_available_freqs(struct device *d, static ssize_t available_frequencies_show(struct device *d,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct devfreq *df = to_devfreq(d); struct devfreq *df = to_devfreq(d);
struct device *dev = df->dev.parent; struct device *dev = df->dev.parent;
...@@ -918,9 +926,10 @@ static ssize_t show_available_freqs(struct device *d, ...@@ -918,9 +926,10 @@ static ssize_t show_available_freqs(struct device *d,
return count; return count;
} }
static DEVICE_ATTR_RO(available_frequencies);
static ssize_t show_trans_table(struct device *dev, struct device_attribute *attr, static ssize_t trans_stat_show(struct device *dev,
char *buf) struct device_attribute *attr, char *buf)
{ {
struct devfreq *devfreq = to_devfreq(dev); struct devfreq *devfreq = to_devfreq(dev);
ssize_t len; ssize_t len;
...@@ -959,20 +968,21 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att ...@@ -959,20 +968,21 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att
devfreq->total_trans); devfreq->total_trans);
return len; return len;
} }
static DEVICE_ATTR_RO(trans_stat);
static struct device_attribute devfreq_attrs[] = {
__ATTR(governor, S_IRUGO | S_IWUSR, show_governor, store_governor), static struct attribute *devfreq_attrs[] = {
__ATTR(available_governors, S_IRUGO, show_available_governors, NULL), &dev_attr_governor.attr,
__ATTR(cur_freq, S_IRUGO, show_freq, NULL), &dev_attr_available_governors.attr,
__ATTR(available_frequencies, S_IRUGO, show_available_freqs, NULL), &dev_attr_cur_freq.attr,
__ATTR(target_freq, S_IRUGO, show_target_freq, NULL), &dev_attr_available_frequencies.attr,
__ATTR(polling_interval, S_IRUGO | S_IWUSR, show_polling_interval, &dev_attr_target_freq.attr,
store_polling_interval), &dev_attr_polling_interval.attr,
__ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq), &dev_attr_min_freq.attr,
__ATTR(max_freq, S_IRUGO | S_IWUSR, show_max_freq, store_max_freq), &dev_attr_max_freq.attr,
__ATTR(trans_stat, S_IRUGO, show_trans_table, NULL), &dev_attr_trans_stat.attr,
{ }, NULL,
}; };
ATTRIBUTE_GROUPS(devfreq);
static int __init devfreq_init(void) static int __init devfreq_init(void)
{ {
...@@ -988,7 +998,7 @@ static int __init devfreq_init(void) ...@@ -988,7 +998,7 @@ static int __init devfreq_init(void)
pr_err("%s: couldn't create workqueue\n", __FILE__); pr_err("%s: couldn't create workqueue\n", __FILE__);
return PTR_ERR(devfreq_wq); return PTR_ERR(devfreq_wq);
} }
devfreq_class->dev_attrs = devfreq_attrs; devfreq_class->dev_groups = devfreq_groups;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment