aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2017-01-31 02:47:56 -0500
committerMyungJoo Ham <myungjoo.ham@samsung.com>2017-01-31 02:57:05 -0500
commit775fa8c3aa22df720f433e871f94cfb182f5913d (patch)
treee685ff0bf8cc6a2004e559620a0e3312b3bb3813
parent29b6968b05b6a4a858ba3ce767be1025ab59f2ca (diff)
PM / devfreq: Simplify the sysfs name of devfreq-event device
This patch just removes '.' character from the sysfs name of devfreq-event device as following. Usually, the subsystem uses the similiar naming style such as {framework name}{Number}. - old : /sys/class/devfreq-event/event.(X) - new : /sys/class/devfreq-event/event(X) And this patch initializes the value of 'event_no' with -1 in order to remove the unneeded operation (-1) when calling the atomic_inc_return(&event_no). Lastly, this patch adds the ABI document for devfreq-event class. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
-rw-r--r--Documentation/ABI/testing/sysfs-class-devfreq-event25
-rw-r--r--drivers/devfreq/devfreq-event.c4
2 files changed, 27 insertions, 2 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-devfreq-event b/Documentation/ABI/testing/sysfs-class-devfreq-event
new file mode 100644
index 000000000000..ceaf0f686d4a
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-devfreq-event
@@ -0,0 +1,25 @@
1What: /sys/class/devfreq-event/event(x)/
2Date: January 2017
3Contact: Chanwoo Choi <cw00.choi@samsung.com>
4Description:
5 Provide a place in sysfs for the devfreq-event objects.
6 This allows accessing various devfreq-event specific variables.
7 The name of devfreq-event object denoted as 'event(x)' which
8 includes the unique number of 'x' for each devfreq-event object.
9
10What: /sys/class/devfreq-event/event(x)/name
11Date: January 2017
12Contact: Chanwoo Choi <cw00.choi@samsung.com>
13Description:
14 The /sys/class/devfreq-event/event(x)/name attribute contains
15 the name of the devfreq-event object. This attribute is
16 read-only.
17
18What: /sys/class/devfreq-event/event(x)/enable_count
19Date: January 2017
20Contact: Chanwoo Choi <cw00.choi@samsung.com>
21Description:
22 The /sys/class/devfreq-event/event(x)/enable_count attribute
23 contains the reference count to enable the devfreq-event
24 object. If the device is enabled, the value of attribute is
25 greater than zero.
diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
index 9aea2c7ecbe6..8648b32ebc89 100644
--- a/drivers/devfreq/devfreq-event.c
+++ b/drivers/devfreq/devfreq-event.c
@@ -306,7 +306,7 @@ struct devfreq_event_dev *devfreq_event_add_edev(struct device *dev,
306 struct devfreq_event_desc *desc) 306 struct devfreq_event_desc *desc)
307{ 307{
308 struct devfreq_event_dev *edev; 308 struct devfreq_event_dev *edev;
309 static atomic_t event_no = ATOMIC_INIT(0); 309 static atomic_t event_no = ATOMIC_INIT(-1);
310 int ret; 310 int ret;
311 311
312 if (!dev || !desc) 312 if (!dev || !desc)
@@ -329,7 +329,7 @@ struct devfreq_event_dev *devfreq_event_add_edev(struct device *dev,
329 edev->dev.class = devfreq_event_class; 329 edev->dev.class = devfreq_event_class;
330 edev->dev.release = devfreq_event_release_edev; 330 edev->dev.release = devfreq_event_release_edev;
331 331
332 dev_set_name(&edev->dev, "event.%d", atomic_inc_return(&event_no) - 1); 332 dev_set_name(&edev->dev, "event%d", atomic_inc_return(&event_no));
333 ret = device_register(&edev->dev); 333 ret = device_register(&edev->dev);
334 if (ret < 0) { 334 if (ret < 0) {
335 put_device(&edev->dev); 335 put_device(&edev->dev);