linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabian Frederick <fabf@skynet.be>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Fabian Frederick <fabf@skynet.be>
Subject: [PATCH 01/14] locking/atomic: import atomic_dec_not_zero()
Date: Mon, 30 Jan 2017 19:39:38 +0100	[thread overview]
Message-ID: <20170130183938.12702-1-fabf@skynet.be> (raw)

complementary definition to atomic_inc_not_zero() featured in
lib/fault-inject.c

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 include/linux/atomic.h | 2 ++
 lib/fault-inject.c     | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index e71835b..d8e6551 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -517,6 +517,8 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
 #define atomic_inc_not_zero(v)		atomic_add_unless((v), 1, 0)
 #endif
 
+#define atomic_dec_not_zero(v)          atomic_add_unless((v), -1, 0)
+
 #ifndef atomic_andnot
 static inline void atomic_andnot(int i, atomic_t *v)
 {
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index 6a823a5..4ad5dcc 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -52,8 +52,6 @@ static void fail_dump(struct fault_attr *attr)
 	}
 }
 
-#define atomic_dec_not_zero(v)		atomic_add_unless((v), -1, 0)
-
 static bool fail_task(struct fault_attr *attr, struct task_struct *task)
 {
 	return !in_interrupt() && task->make_it_fail;
-- 
2.9.3

             reply	other threads:[~2017-01-30 18:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 18:39 Fabian Frederick [this message]
2017-01-31  7:33 ` [PATCH 01/14] locking/atomic: import atomic_dec_not_zero() Ingo Molnar
2017-01-31 10:41 ` Peter Zijlstra
2017-01-31 17:41   ` Fabian Frederick
2017-01-31 19:17     ` Peter Zijlstra
2017-01-31 20:55       ` Fabian Frederick
2017-02-01  9:25         ` Peter Zijlstra
2017-02-01 19:24           ` Fabian Frederick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170130183938.12702-1-fabf@skynet.be \
    --to=fabf@skynet.be \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).