]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
PM / devfreq: Add new name attribute for sysfs
authorChanwoo Choi <cw00.choi@samsung.com>
Tue, 5 Nov 2019 09:18:03 +0000 (18:18 +0900)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 6 Mar 2020 07:13:20 +0000 (02:13 -0500)
BugLink: https://bugs.launchpad.net/bugs/1864904
commit 2fee1a7cc6b1ce6634bb0f025be2c94a58dfa34d upstream.

The commit 4585fbcb5331 ("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: 4585fbcb5331 ("PM / devfreq: Modify the device name as devfreq(X) for sysfs")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Documentation/ABI/testing/sysfs-class-devfreq
drivers/devfreq/devfreq.c

index ee39acacf6f8512cb81eedaf0d06685bbf004144..335595a79866c6b7ce6b8d50679098e3c23681e2 100644 (file)
@@ -7,6 +7,13 @@ Description:
                The name of devfreq object denoted as ... is same as the
                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
 Date:          September 2011
 Contact:       MyungJoo Ham <myungjoo.ham@samsung.com>
index 2f95df426222af1fe93e2521297d7ae5b5af5599..e7d75882c9f5f642dd8c60b0492ef212b864fdf7 100644 (file)
@@ -1013,6 +1013,14 @@ err_out:
 }
 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,
                             struct device_attribute *attr, char *buf)
 {
@@ -1329,6 +1337,7 @@ static ssize_t trans_stat_show(struct device *dev,
 static DEVICE_ATTR_RO(trans_stat);
 
 static struct attribute *devfreq_attrs[] = {
+       &dev_attr_name.attr,
        &dev_attr_governor.attr,
        &dev_attr_available_governors.attr,
        &dev_attr_cur_freq.attr,