Commit 1635d4fc authored by Chanwoo Choi's avatar Chanwoo Choi Committed by Greg Kroah-Hartman

PM / devfreq: Add new name attribute for sysfs

commit 2fee1a7c upstream.

The commit 4585fbcb ("PM / devfreq: Modify the device name as devfreq(X) for
sysfs") changed the node name to devfreq(x). After this commit, it is not
possible to get the device name through /sys/class/devfreq/devfreq(X)/*.

Add new name attribute in order to get device name.

Cc: stable@vger.kernel.org
Fixes: 4585fbcb ("PM / devfreq: Modify the device name as devfreq(X) for sysfs")
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e292b266
...@@ -7,6 +7,13 @@ Description: ...@@ -7,6 +7,13 @@ Description:
The name of devfreq object denoted as ... is same as the The name of devfreq object denoted as ... is same as the
name of device using devfreq. name of device using devfreq.
What: /sys/class/devfreq/.../name
Date: November 2019
Contact: Chanwoo Choi <cw00.choi@samsung.com>
Description:
The /sys/class/devfreq/.../name shows the name of device
of the corresponding devfreq object.
What: /sys/class/devfreq/.../governor What: /sys/class/devfreq/.../governor
Date: September 2011 Date: September 2011
Contact: MyungJoo Ham <myungjoo.ham@samsung.com> Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
......
...@@ -1014,6 +1014,14 @@ int devfreq_remove_governor(struct devfreq_governor *governor) ...@@ -1014,6 +1014,14 @@ int devfreq_remove_governor(struct devfreq_governor *governor)
} }
EXPORT_SYMBOL(devfreq_remove_governor); EXPORT_SYMBOL(devfreq_remove_governor);
static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct devfreq *devfreq = to_devfreq(dev);
return sprintf(buf, "%s\n", dev_name(devfreq->dev.parent));
}
static DEVICE_ATTR_RO(name);
static ssize_t governor_show(struct device *dev, static ssize_t governor_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
...@@ -1330,6 +1338,7 @@ static ssize_t trans_stat_show(struct device *dev, ...@@ -1330,6 +1338,7 @@ static ssize_t trans_stat_show(struct device *dev,
static DEVICE_ATTR_RO(trans_stat); static DEVICE_ATTR_RO(trans_stat);
static struct attribute *devfreq_attrs[] = { static struct attribute *devfreq_attrs[] = {
&dev_attr_name.attr,
&dev_attr_governor.attr, &dev_attr_governor.attr,
&dev_attr_available_governors.attr, &dev_attr_available_governors.attr,
&dev_attr_cur_freq.attr, &dev_attr_cur_freq.attr,
......
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