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
nexedi
linux
Commits
f21dda02
Commit
f21dda02
authored
May 06, 2013
by
Helge Deller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parisc: implement atomic64_dec_if_positive()
Signed-off-by:
Helge Deller
<
deller@gmx.de
>
parent
bbbfde78
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
arch/parisc/Kconfig
arch/parisc/Kconfig
+1
-0
arch/parisc/include/asm/atomic.h
arch/parisc/include/asm/atomic.h
+23
-0
No files found.
arch/parisc/Kconfig
View file @
f21dda02
...
...
@@ -13,6 +13,7 @@ config PARISC
select BUG
select HAVE_PERF_EVENTS
select GENERIC_ATOMIC64 if !64BIT
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select HAVE_GENERIC_HARDIRQS
select BROKEN_RODATA
select GENERIC_IRQ_PROBE
...
...
arch/parisc/include/asm/atomic.h
View file @
f21dda02
...
...
@@ -229,6 +229,29 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
/*
* atomic64_dec_if_positive - decrement by 1 if old value positive
* @v: pointer of type atomic_t
*
* The function returns the old value of *v minus 1, even if
* the atomic variable, v, was not decremented.
*/
static
inline
long
atomic64_dec_if_positive
(
atomic64_t
*
v
)
{
long
c
,
old
,
dec
;
c
=
atomic64_read
(
v
);
for
(;;)
{
dec
=
c
-
1
;
if
(
unlikely
(
dec
<
0
))
break
;
old
=
atomic64_cmpxchg
((
v
),
c
,
dec
);
if
(
likely
(
old
==
c
))
break
;
c
=
old
;
}
return
dec
;
}
#endif
/* !CONFIG_64BIT */
...
...
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