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


Groups > linux.kernel > #1570463 > unrolled thread

[PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry

Started byChanwoo Choi <cw00.choi@samsung.com>
First post2017-01-31 09:00 +0100
Last post2017-01-31 09:00 +0100
Articles 3 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry Chanwoo Choi <cw00.choi@samsung.com> - 2017-01-31 09:00 +0100
    [PATCH v5 1/2] PM / devfreq: Simplify the sysfs name of devfreq-event  device Chanwoo Choi <cw00.choi@samsung.com> - 2017-01-31 09:00 +0100
    [PATCH v5 2/2] PM / devfreq: Modify the device name as devfreq(X) for  sysfs Chanwoo Choi <cw00.choi@samsung.com> - 2017-01-31 09:00 +0100

#1570463 — [PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry

FromChanwoo Choi <cw00.choi@samsung.com>
Date2017-01-31 09:00 +0100
Subject[PATCH v5 0/2] PM / devfreq: Change the device name on sysfs entry
Message-ID<t5Bw6-6rQ-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1570466 — [PATCH v5 1/2] PM / devfreq: Simplify the sysfs name of devfreq-event device

FromChanwoo Choi <cw00.choi@samsung.com>
Date2017-01-31 09:00 +0100
Subject[PATCH v5 1/2] PM / devfreq: Simplify the sysfs name of devfreq-event device
Message-ID<t5Bw7-6rQ-23@gated-at.bofh.it>
In reply to#1570463
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

[toc] | [prev] | [next] | [standalone]


#1570468 — [PATCH v5 2/2] PM / devfreq: Modify the device name as devfreq(X) for sysfs

FromChanwoo Choi <cw00.choi@samsung.com>
Date2017-01-31 09:00 +0100
Subject[PATCH v5 2/2] PM / devfreq: Modify the device name as devfreq(X) for sysfs
Message-ID<t5Bw7-6rQ-29@gated-at.bofh.it>
In reply to#1570463
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web