From 306e3cad3cd66ff439bd7fd1d8452972f0484d4a Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Mon, 29 Oct 2012 15:01:48 -0500 Subject: [PATCH] --- yaml --- r: 336783 b: refs/heads/master c: 50a5b33e0159f8783ef617cdb9d5fbb6a3955b6f h: refs/heads/master i: 336781: 710e6d5006630f2c0887b421c2c9813005d5968f 336779: b26e2f5828e56e5d0f38fbca21cfd5d80e246bc1 336775: 0f59d9af056f0344e9acd941c1ab5a1a54a3a3d9 336767: 2bedc832e08c4d723644e56a424ddf68d410d97f v: v3 --- [refs] | 2 +- .../ABI/testing/sysfs-class-devfreq | 7 ++++++ trunk/drivers/devfreq/devfreq.c | 22 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 8a3726c293bb..f827a537c28b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0359d1afe4013d1a216908b6be4c6695a1db6fd6 +refs/heads/master: 50a5b33e0159f8783ef617cdb9d5fbb6a3955b6f diff --git a/trunk/Documentation/ABI/testing/sysfs-class-devfreq b/trunk/Documentation/ABI/testing/sysfs-class-devfreq index 66876debca18..0ba6ea2f89d9 100644 --- a/trunk/Documentation/ABI/testing/sysfs-class-devfreq +++ b/trunk/Documentation/ABI/testing/sysfs-class-devfreq @@ -71,3 +71,10 @@ Description: the available frequencies of the corresponding devfreq object. This is a snapshot of available frequencies and not limited by the min/max frequency restrictions. + +What: /sys/class/devfreq/.../available_governors +Date: October 2012 +Contact: Nishanth Menon +Description: + The /sys/class/devfreq/.../available_governors shows + currently available governors in the system. diff --git a/trunk/drivers/devfreq/devfreq.c b/trunk/drivers/devfreq/devfreq.c index ff960f084c11..45e053e5b139 100644 --- a/trunk/drivers/devfreq/devfreq.c +++ b/trunk/drivers/devfreq/devfreq.c @@ -730,6 +730,27 @@ static ssize_t store_governor(struct device *dev, struct device_attribute *attr, ret = count; return ret; } +static ssize_t show_available_governors(struct device *d, + struct device_attribute *attr, + char *buf) +{ + struct devfreq_governor *tmp_governor; + ssize_t count = 0; + + mutex_lock(&devfreq_list_lock); + list_for_each_entry(tmp_governor, &devfreq_governor_list, node) + count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), + "%s ", tmp_governor->name); + mutex_unlock(&devfreq_list_lock); + + /* Truncate the trailing space */ + if (count) + count--; + + count += sprintf(&buf[count], "\n"); + + return count; +} static ssize_t show_freq(struct device *dev, struct device_attribute *attr, char *buf) @@ -917,6 +938,7 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att static struct device_attribute devfreq_attrs[] = { __ATTR(governor, S_IRUGO | S_IWUSR, show_governor, store_governor), + __ATTR(available_governors, S_IRUGO, show_available_governors, NULL), __ATTR(cur_freq, S_IRUGO, show_freq, NULL), __ATTR(available_frequencies, S_IRUGO, show_available_freqs, NULL), __ATTR(target_freq, S_IRUGO, show_target_freq, NULL),