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


Groups > linux.kernel > #1528987

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

From Chanwoo Choi <cw00.choi@samsung.com>
Newsgroups linux.kernel
Subject [PATCH 2/6] PM / devfreq: Modify the device name as devfreq[X] for sysfs
Date 2016-11-24 06:10 +0100
Message-ID <sGUsh-6pb-13@gated-at.bofh.it> (permalink)
References <sGUsh-6pb-3@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 dfef5ea57e4c..4d2b7e5b8d3c 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

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


Thread

[PATCH 0/6] PM / devfreq: Modify devfreq/devfreq-event for improvement Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-24 06:10 +0100
  [PATCH 6/6] PM / devfreq: event: exynos-ppmu: Add the completion log  of device registration Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-24 06:10 +0100
  [PATCH 2/6] PM / devfreq: Modify the device name as devfreq[X] for  sysfs Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-24 06:10 +0100
  [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-24 06:10 +0100
    Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Joe Perches <joe@perches.com> - 2016-11-24 11:30 +0100
      Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-24 11:50 +0100
        Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Joe Perches <joe@perches.com> - 2016-11-24 12:00 +0100
          Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-25 00:40 +0100

csiph-web