From: Chanwoo Choi Date: Tue, 31 Jan 2017 07:47:57 +0000 (+0900) Subject: PM / devfreq: Modify the device name as devfreq(X) for sysfs X-Git-Tag: accepted/tizen/4.0/unified/20170920.081531~59 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c1ebfa385bc45161f26c0e278a1a731e96dcd9d;p=platform%2Fkernel%2Flinux-exynos.git PM / devfreq: Modify the device name as devfreq(X) for sysfs 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 Signed-off-by: MyungJoo Ham --- diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 2e68516..4aa72b5 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);