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


Groups > linux.kernel > #1426988 > unrolled thread

[PATCH 03/12] PM,devfreq: Employ atomic_fetch_inc()

Started byDavidlohr Bueso <dave@stgolabs.net>
First post2016-06-20 22:10 +0200
Last post2016-06-20 22:10 +0200
Articles 1 — 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 03/12] PM,devfreq: Employ atomic_fetch_inc() Davidlohr Bueso <dave@stgolabs.net> - 2016-06-20 22:10 +0200

#1426988 — [PATCH 03/12] PM,devfreq: Employ atomic_fetch_inc()

FromDavidlohr Bueso <dave@stgolabs.net>
Date2016-06-20 22:10 +0200
Subject[PATCH 03/12] PM,devfreq: Employ atomic_fetch_inc()
Message-ID<rMdGa-4no-15@gated-at.bofh.it>
Now that we have fetch_inc() we can stop using inc_return() - 1.

These are very similar to the existing OP-RETURN primitives we already
have, except they return the value of the atomic variable _before_
modification.

Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 drivers/devfreq/devfreq-event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
index 39b048eda2ce..45b02d3d7e7d 100644
--- a/drivers/devfreq/devfreq-event.c
+++ b/drivers/devfreq/devfreq-event.c
@@ -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_fetch_inc(&event_no));
 	ret = device_register(&edev->dev);
 	if (ret < 0) {
 		put_device(&edev->dev);
-- 
2.6.6

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web