All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2 PATCH] PM / devfreq: Add new name attribute for sysfs
       [not found] <CGME20191125004131epcas1p403cab8b34662b44a704d6f91aa4c4a0f@epcas1p4.samsung.com>
@ 2019-11-25  0:47 ` Chanwoo Choi
  2019-11-25  1:04   ` Chanwoo Choi
  0 siblings, 1 reply; 2+ messages in thread
From: Chanwoo Choi @ 2019-11-25  0:47 UTC (permalink / raw)
  To: linux-pm, linux-kernel
  Cc: rafael.j.wysocki, gregkh, myungjoo.ham, kyungmin.park, cw00.choi,
	chanwoo, stable

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>
---
Changes from v1:
- Update sysfs-class-devfreq documentation
- Show device name directly from 'devfreq->dev.parent'

 Documentation/ABI/testing/sysfs-class-devfreq | 7 +++++++
 drivers/devfreq/devfreq.c                     | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-class-devfreq b/Documentation/ABI/testing/sysfs-class-devfreq
index 01196e19afca..75897e2fde43 100644
--- a/Documentation/ABI/testing/sysfs-class-devfreq
+++ b/Documentation/ABI/testing/sysfs-class-devfreq
@@ -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>
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 61c3e2d08969..2e5f64ee1969 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -1476,7 +1476,16 @@ static ssize_t trans_stat_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(trans_stat);
 
+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 struct attribute *devfreq_attrs[] = {
+	&dev_attr_name.attr,
 	&dev_attr_governor.attr,
 	&dev_attr_available_governors.attr,
 	&dev_attr_cur_freq.attr,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [v2 PATCH] PM / devfreq: Add new name attribute for sysfs
  2019-11-25  0:47 ` [v2 PATCH] PM / devfreq: Add new name attribute for sysfs Chanwoo Choi
@ 2019-11-25  1:04   ` Chanwoo Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2019-11-25  1:04 UTC (permalink / raw)
  To: linux-pm, linux-kernel
  Cc: rafael.j.wysocki, gregkh, myungjoo.ham, kyungmin.park, chanwoo, stable

Dear all,

Please ignore this patch because it has the my mistake.
I'll send v3 patch.

Best Regards,
Chanwoo Choi

On 11/25/19 9:47 AM, Chanwoo Choi wrote:
> 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>
> ---
> Changes from v1:
> - Update sysfs-class-devfreq documentation
> - Show device name directly from 'devfreq->dev.parent'
> 
>  Documentation/ABI/testing/sysfs-class-devfreq | 7 +++++++
>  drivers/devfreq/devfreq.c                     | 9 +++++++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-class-devfreq b/Documentation/ABI/testing/sysfs-class-devfreq
> index 01196e19afca..75897e2fde43 100644
> --- a/Documentation/ABI/testing/sysfs-class-devfreq
> +++ b/Documentation/ABI/testing/sysfs-class-devfreq
> @@ -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>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 61c3e2d08969..2e5f64ee1969 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -1476,7 +1476,16 @@ static ssize_t trans_stat_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(trans_stat);
>  
> +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 struct attribute *devfreq_attrs[] = {
> +	&dev_attr_name.attr,
>  	&dev_attr_governor.attr,
>  	&dev_attr_available_governors.attr,
>  	&dev_attr_cur_freq.attr,
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-25  0:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20191125004131epcas1p403cab8b34662b44a704d6f91aa4c4a0f@epcas1p4.samsung.com>
2019-11-25  0:47 ` [v2 PATCH] PM / devfreq: Add new name attribute for sysfs Chanwoo Choi
2019-11-25  1:04   ` Chanwoo Choi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.