Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
52d38af5
Commit
52d38af5
authored
May 14, 2004
by
Andrew Morton
Committed by
Linus Torvalds
May 14, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] Implement atomic_inc_and_test() on various architectures
It's easy to do when the arch provides atomic_inc_return().
parent
ebc7bc42
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
91 additions
and
0 deletions
+91
-0
include/asm-h8300/atomic.h
include/asm-h8300/atomic.h
+10
-0
include/asm-m68knommu/atomic.h
include/asm-m68knommu/atomic.h
+10
-0
include/asm-parisc/atomic.h
include/asm-parisc/atomic.h
+10
-0
include/asm-ppc/atomic.h
include/asm-ppc/atomic.h
+10
-0
include/asm-ppc64/atomic.h
include/asm-ppc64/atomic.h
+10
-0
include/asm-s390/atomic.h
include/asm-s390/atomic.h
+1
-0
include/asm-sh/atomic.h
include/asm-sh/atomic.h
+10
-0
include/asm-sparc/atomic.h
include/asm-sparc/atomic.h
+10
-0
include/asm-sparc64/atomic.h
include/asm-sparc64/atomic.h
+10
-0
include/asm-v850/atomic.h
include/asm-v850/atomic.h
+10
-0
No files found.
include/asm-h8300/atomic.h
View file @
52d38af5
...
...
@@ -50,6 +50,16 @@ static __inline__ int atomic_inc_return(atomic_t *v)
#define atomic_inc(v) atomic_inc_return(v)
/*
* atomic_inc_and_test - increment and test
* @v: pointer of type atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases.
*/
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
static
__inline__
int
atomic_dec_return
(
atomic_t
*
v
)
{
int
ret
,
flags
;
...
...
include/asm-m68knommu/atomic.h
View file @
52d38af5
...
...
@@ -114,6 +114,16 @@ extern __inline__ int atomic_sub_return(int i, atomic_t * v)
#define atomic_dec_return(v) atomic_sub_return(1,(v))
#define atomic_inc_return(v) atomic_add_return(1,(v))
/*
* atomic_inc_and_test - increment and test
* @v: pointer of type atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases.
*/
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
...
...
include/asm-parisc/atomic.h
View file @
52d38af5
...
...
@@ -187,6 +187,16 @@ static __inline__ int atomic_read(const atomic_t *v)
#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
/*
* atomic_inc_and_test - increment and test
* @v: pointer of type atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases.
*/
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)
#define ATOMIC_INIT(i) { (i) }
...
...
include/asm-ppc/atomic.h
View file @
52d38af5
...
...
@@ -134,6 +134,16 @@ static __inline__ int atomic_inc_return(atomic_t *v)
return
t
;
}
/*
* atomic_inc_and_test - increment and test
* @v: pointer of type atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases.
*/
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
static
__inline__
void
atomic_dec
(
atomic_t
*
v
)
{
int
t
;
...
...
include/asm-ppc64/atomic.h
View file @
52d38af5
...
...
@@ -120,6 +120,16 @@ static __inline__ int atomic_inc_return(atomic_t *v)
return
t
;
}
/*
* atomic_inc_and_test - increment and test
* @v: pointer of type atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases.
*/
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
static
__inline__
void
atomic_dec
(
atomic_t
*
v
)
{
int
t
;
...
...
include/asm-s390/atomic.h
View file @
52d38af5
...
...
@@ -69,6 +69,7 @@ static __inline__ int atomic_inc_return(volatile atomic_t * v)
{
return
__CS_LOOP
(
v
,
1
,
"ar"
);
}
static
__inline__
int
atomic_inc_and_test
(
volatile
atomic_t
*
v
)
{
return
__CS_LOOP
(
v
,
1
,
"ar"
)
!=
0
;
...
...
include/asm-sh/atomic.h
View file @
52d38af5
...
...
@@ -71,6 +71,16 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
#define atomic_dec_return(v) atomic_sub_return(1,(v))
#define atomic_inc_return(v) atomic_add_return(1,(v))
/*
* atomic_inc_and_test - increment and test
* @v: pointer of type atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases.
*/
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
...
...
include/asm-sparc/atomic.h
View file @
52d38af5
...
...
@@ -35,6 +35,16 @@ extern void atomic_set(atomic_t *, int);
#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
/*
* atomic_inc_and_test - increment and test
* @v: pointer of type atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases.
*/
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)
/* This is the old 24-bit implementation. It's still used internally
...
...
include/asm-sparc64/atomic.h
View file @
52d38af5
...
...
@@ -40,6 +40,16 @@ extern int __atomic64_sub(__s64, atomic64_t *);
#define atomic_inc_return(v) __atomic_add(1, v)
#define atomic64_inc_return(v) __atomic64_add(1, v)
/*
* atomic_inc_and_test - increment and test
* @v: pointer of type atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases.
*/
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
#define atomic_sub_and_test(i, v) (__atomic_sub(i, v) == 0)
#define atomic64_sub_and_test(i, v) (__atomic64_sub(i, v) == 0)
...
...
include/asm-v850/atomic.h
View file @
52d38af5
...
...
@@ -76,6 +76,16 @@ static __inline__ void atomic_clear_mask (unsigned long mask, unsigned long *add
#define atomic_inc(v) atomic_inc_return (v)
#define atomic_dec(v) atomic_dec_return (v)
/*
* atomic_inc_and_test - increment and test
* @v: pointer of type atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases.
*/
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
#define atomic_sub_and_test(i,v) (atomic_sub_return ((i), (v)) == 0)
#define atomic_dec_and_test(v) (atomic_sub_return (1, (v)) == 0)
#define atomic_add_negative(i,v) (atomic_add_return ((i), (v)) < 0)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment