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


Groups > linux.kernel > #1570026 > unrolled thread

[PATCH 11/14] PM: use atomic_dec_not_zero()

Started byFabian Frederick <fabf@skynet.be>
First post2017-01-30 20:00 +0100
Last post2017-01-30 20:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 11/14] PM: use atomic_dec_not_zero() Fabian Frederick <fabf@skynet.be> - 2017-01-30 20:00 +0100

#1570026 — [PATCH 11/14] PM: use atomic_dec_not_zero()

FromFabian Frederick <fabf@skynet.be>
Date2017-01-30 20:00 +0100
Subject[PATCH 11/14] PM: use atomic_dec_not_zero()
Message-ID<t5plh-7sP-39@gated-at.bofh.it>
instead of atomic_add_unless(value, -1, 0)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 kernel/power/user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/user.c b/kernel/power/user.c
index 22df9f7..c478572 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -54,7 +54,7 @@ static int snapshot_open(struct inode *inode, struct file *filp)
 
 	lock_system_sleep();
 
-	if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
+	if (!atomic_dec_not_zero(&snapshot_device_available)) {
 		error = -EBUSY;
 		goto Unlock;
 	}
-- 
2.9.3

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web