All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry
       [not found] <CGME20170131074759epcas1p3415cd6ed09ce4c7b60e1e4018b4ce720@epcas1p3.samsung.com>
@ 2017-01-31  7:47 ` Chanwoo Choi
       [not found]   ` <CGME20170131074759epcas1p346fd3ae1d6dd7133f995f77ff715525b@epcas1p3.samsung.com>
       [not found]   ` <CGME20170131074759epcas1p33b9d7f798aad025c3a3958147f133722@epcas1p3.samsung.com>
  2017-01-31  7:57 ` [PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry MyungJoo Ham
  1 sibling, 2 replies; 4+ messages in thread
From: Chanwoo Choi @ 2017-01-31  7:47 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, rjw; +Cc: cw00.choi, linux-pm, linux-kernel

These patches change the name of sysfs entry for devfreq/devfreq-event device
as following:
- old
For devfreq, /sys/class/devfreq/[non-standard device name]
For devfreq-event, /sys/class/devfreq-event/event.(X)

- new
For devfreq, /sys/class/devfreq/devfreq(X)
For devfreq-event, /sys/class/devfreq-event/event(X)

Changes from v4:
- Applied the patch1/2 on v4 series.
- Add new ABI document for devfreq-event class.

Changes from v3:
(https://lkml.org/lkml/2017/1/16/254)
- Patch3 initializes the init value of 'event_no' in order to remove
  the unneeded operation (-1) when calling the atomic_inc_return(&event_no).
- Patch4 uses the integer type for unique number of devfreq device.

Changes from v2:
(https://lkml.org/lkml/2016/12/28/102)
- On v2 patchset, patch1/2/3/5 were merged on devfreq git repo.
- Remain the warning message for exynos-ppmu.c
  when failed to get the clock of ppmu.
- Rebase these patches on devfreq git repo[1].

Changes from v1:
- Rebase these patches on v4.10-rc1.
- Include the separate patch[2] in these patches.

Depends on:
- These patches are based on patch[1].
[1] https://lkml.org/lkml/2017/1/31/120

Chanwoo Choi (2):
  PM / devfreq: Simplify the sysfs name of devfreq-event device
  PM / devfreq: Modify the device name as devfreq(X) for sysfs

 .../ABI/testing/sysfs-class-devfreq-event          | 25 ++++++++++++++++++++++
 drivers/devfreq/devfreq-event.c                    |  4 ++--
 drivers/devfreq/devfreq.c                          |  4 +++-
 3 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-class-devfreq-event

-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v5 1/2] PM / devfreq: Simplify the sysfs name of devfreq-event device
       [not found]   ` <CGME20170131074759epcas1p346fd3ae1d6dd7133f995f77ff715525b@epcas1p3.samsung.com>
@ 2017-01-31  7:47     ` Chanwoo Choi
  0 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2017-01-31  7:47 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, rjw; +Cc: cw00.choi, linux-pm, linux-kernel

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>
---
 .../ABI/testing/sysfs-class-devfreq-event          | 25 ++++++++++++++++++++++
 drivers/devfreq/devfreq-event.c                    |  4 ++--
 2 files changed, 27 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-class-devfreq-event

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 @@
+What:		/sys/class/devfreq-event/event(x)/
+Date:		January 2017
+Contact:	Chanwoo Choi <cw00.choi@samsung.com>
+Description:
+		Provide a place in sysfs for the devfreq-event objects.
+		This allows accessing various devfreq-event specific variables.
+		The name of devfreq-event object denoted as 'event(x)' which
+		includes the unique number of 'x' for each devfreq-event object.
+
+What:		/sys/class/devfreq-event/event(x)/name
+Date:		January 2017
+Contact:	Chanwoo Choi <cw00.choi@samsung.com>
+Description:
+		The /sys/class/devfreq-event/event(x)/name attribute contains
+		the name of the devfreq-event object. This attribute is
+		read-only.
+
+What:		/sys/class/devfreq-event/event(x)/enable_count
+Date:		January 2017
+Contact:	Chanwoo Choi <cw00.choi@samsung.com>
+Description:
+		The /sys/class/devfreq-event/event(x)/enable_count attribute
+		contains the reference count to enable the devfreq-event
+		object. If the device is enabled, the value of attribute is
+		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,
 						struct devfreq_event_desc *desc)
 {
 	struct devfreq_event_dev *edev;
-	static atomic_t event_no = ATOMIC_INIT(0);
+	static atomic_t event_no = ATOMIC_INIT(-1);
 	int ret;
 
 	if (!dev || !desc)
@@ -329,7 +329,7 @@ struct devfreq_event_dev *devfreq_event_add_edev(struct device *dev,
 	edev->dev.class = devfreq_event_class;
 	edev->dev.release = devfreq_event_release_edev;
 
-	dev_set_name(&edev->dev, "event.%d", atomic_inc_return(&event_no) - 1);
+	dev_set_name(&edev->dev, "event%d", atomic_inc_return(&event_no));
 	ret = device_register(&edev->dev);
 	if (ret < 0) {
 		put_device(&edev->dev);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v5 2/2] PM / devfreq: Modify the device name as devfreq(X) for sysfs
       [not found]   ` <CGME20170131074759epcas1p33b9d7f798aad025c3a3958147f133722@epcas1p3.samsung.com>
@ 2017-01-31  7:47     ` Chanwoo Choi
  0 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2017-01-31  7:47 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, rjw; +Cc: cw00.choi, linux-pm, linux-kernel

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 2e685164c549..4aa72b5ed660 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);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry
       [not found] <CGME20170131074759epcas1p3415cd6ed09ce4c7b60e1e4018b4ce720@epcas1p3.samsung.com>
  2017-01-31  7:47 ` [PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry Chanwoo Choi
@ 2017-01-31  7:57 ` MyungJoo Ham
  1 sibling, 0 replies; 4+ messages in thread
From: MyungJoo Ham @ 2017-01-31  7:57 UTC (permalink / raw)
  To: Chanwoo Choi, Kyungmin Park, rjw; +Cc: linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

>These patches change the name of sysfs entry for devfreq/devfreq-event device
>as following:
>- old
>For devfreq, /sys/class/devfreq/[non-standard device name]
>For devfreq-event, /sys/class/devfreq-event/event.(X)
>
>- new
>For devfreq, /sys/class/devfreq/devfreq(X)
>For devfreq-event, /sys/class/devfreq-event/event(X)

Verified all updated as discussed.


Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>


Cheers,
MyungJoo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-31  8:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170131074759epcas1p3415cd6ed09ce4c7b60e1e4018b4ce720@epcas1p3.samsung.com>
2017-01-31  7:47 ` [PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry Chanwoo Choi
     [not found]   ` <CGME20170131074759epcas1p346fd3ae1d6dd7133f995f77ff715525b@epcas1p3.samsung.com>
2017-01-31  7:47     ` [PATCH v5 1/2] PM / devfreq: Simplify the sysfs name of devfreq-event device Chanwoo Choi
     [not found]   ` <CGME20170131074759epcas1p33b9d7f798aad025c3a3958147f133722@epcas1p3.samsung.com>
2017-01-31  7:47     ` [PATCH v5 2/2] PM / devfreq: Modify the device name as devfreq(X) for sysfs Chanwoo Choi
2017-01-31  7:57 ` [PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry MyungJoo Ham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.