Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chanwoo Choi and committed by
MyungJoo Ham
775fa8c3 29b6968b

+27 -2
+25
Documentation/ABI/testing/sysfs-class-devfreq-event
··· 1 + What: /sys/class/devfreq-event/event(x)/ 2 + Date: January 2017 3 + Contact: Chanwoo Choi <cw00.choi@samsung.com> 4 + Description: 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 + 10 + What: /sys/class/devfreq-event/event(x)/name 11 + Date: January 2017 12 + Contact: Chanwoo Choi <cw00.choi@samsung.com> 13 + Description: 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 + 18 + What: /sys/class/devfreq-event/event(x)/enable_count 19 + Date: January 2017 20 + Contact: Chanwoo Choi <cw00.choi@samsung.com> 21 + Description: 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.
+2 -2
drivers/devfreq/devfreq-event.c
··· 306 306 struct devfreq_event_desc *desc) 307 307 { 308 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 310 int ret; 311 311 312 312 if (!dev || !desc) ··· 329 329 edev->dev.class = devfreq_event_class; 330 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 333 ret = device_register(&edev->dev); 334 334 if (ret < 0) { 335 335 put_device(&edev->dev);