Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1570468

[PATCH v5 2/2] PM / devfreq: Modify the device name as devfreq(X) for sysfs

From Chanwoo Choi <cw00.choi@samsung.com>
Newsgroups linux.kernel
Subject [PATCH v5 2/2] PM / devfreq: Modify the device name as devfreq(X) for sysfs
Date 2017-01-31 09:00 +0100
Message-ID <t5Bw7-6rQ-29@gated-at.bofh.it> (permalink)
References <t5Bw6-6rQ-5@gated-at.bofh.it> <t5Bw7-6rQ-31@gated-at.bofh.it> <t5Bw6-6rQ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch modifies the device name as devfreq(X) for sysfs by using the 'devfreq'
prefix word instead of separate device name. On user-space aspect, user would
find the some devfreq drvier with 'devfreq(X)' pattern. So, this patch modify the
device name as following:
- /sys/class/devfreq/[non-standard device name] -> /sys/class/devfreq/devfreq(X)

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/devfreq/devfreq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 2e685164c549..4aa72b5ed660 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -519,6 +519,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
 {
 	struct devfreq *devfreq;
 	struct devfreq_governor *governor;
+	static atomic_t devfreq_no = ATOMIC_INIT(-1);
 	int err = 0;
 
 	if (!dev || !profile || !governor_name) {
@@ -560,7 +561,8 @@ struct devfreq *devfreq_add_device(struct device *dev,
 		mutex_lock(&devfreq->lock);
 	}
 
-	dev_set_name(&devfreq->dev, "%s", dev_name(dev));
+	dev_set_name(&devfreq->dev, "devfreq%d",
+				atomic_inc_return(&devfreq_no));
 	err = device_register(&devfreq->dev);
 	if (err) {
 		mutex_unlock(&devfreq->lock);
-- 
1.9.1

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry Chanwoo Choi <cw00.choi@samsung.com> - 2017-01-31 09:00 +0100
  [PATCH v5 1/2] PM / devfreq: Simplify the sysfs name of devfreq-event  device Chanwoo Choi <cw00.choi@samsung.com> - 2017-01-31 09:00 +0100
  [PATCH v5 2/2] PM / devfreq: Modify the device name as devfreq(X) for  sysfs Chanwoo Choi <cw00.choi@samsung.com> - 2017-01-31 09:00 +0100

csiph-web