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


Groups > linux.kernel > #1547933 > unrolled thread

[PATCH v2 6/8] PM / devfreq: Modify the device name as devfreq[X] for sysfs

Started byChanwoo Choi <cw00.choi@samsung.com>
First post2016-12-28 13:00 +0100
Last post2016-12-28 13:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 6/8] PM / devfreq: Modify the device name as devfreq[X] for  sysfs Chanwoo Choi <cw00.choi@samsung.com> - 2016-12-28 13:00 +0100

#1547933 — [PATCH v2 6/8] PM / devfreq: Modify the device name as devfreq[X] for sysfs

FromChanwoo Choi <cw00.choi@samsung.com>
Date2016-12-28 13:00 +0100
Subject[PATCH v2 6/8] PM / devfreq: Modify the device name as devfreq[X] for sysfs
Message-ID<sTl3I-7Id-53@gated-at.bofh.it>
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 8e5938c9c7d6..4bd7a8f71b07 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -527,6 +527,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) {
@@ -568,7 +569,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%lu",
+			(unsigned long)atomic_inc_return(&devfreq_no));
 	err = device_register(&devfreq->dev);
 	if (err) {
 		mutex_unlock(&devfreq->lock);
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web