Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 335577
b: refs/heads/master
c: 193d2aa
h: refs/heads/master
i:
  335575: a8f51c6
v: v3
  • Loading branch information
David S. Miller committed Nov 10, 2012
1 parent c554089 commit bf8bbed
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0bce04be442cf4d6e4ba9dac2f0a4c5ee88af5c5
refs/heads/master: 193d2aadc0ff5c687f6f0d5ef1d38c86ab511a14
1 change: 1 addition & 0 deletions trunk/arch/sparc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ config SPARC
select HAVE_ARCH_TRACEHOOK
select SYSCTL_EXCEPTION_TRACE
select ARCH_WANT_OPTIONAL_GPIOLIB
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select RTC_CLASS
select RTC_DRV_M48T59
select HAVE_IRQ_WORK
Expand Down
4 changes: 3 additions & 1 deletion trunk/arch/sparc/include/asm/atomic_64.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* atomic.h: Thankfully the V9 is at least reasonable for this
* stuff.
*
* Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com)
* Copyright (C) 1996, 1997, 2000, 2012 David S. Miller (davem@redhat.com)
*/

#ifndef __ARCH_SPARC64_ATOMIC__
Expand Down Expand Up @@ -106,6 +106,8 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u)

#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)

extern long atomic64_dec_if_positive(atomic64_t *v);

/* Atomic operations are already serializing */
#define smp_mb__before_atomic_dec() barrier()
#define smp_mb__after_atomic_dec() barrier()
Expand Down
16 changes: 15 additions & 1 deletion trunk/arch/sparc/lib/atomic_64.S
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* atomic.S: These things are too big to do inline.
*
* Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)
* Copyright (C) 1999, 2007 2012 David S. Miller (davem@davemloft.net)
*/

#include <linux/linkage.h>
Expand Down Expand Up @@ -117,3 +117,17 @@ ENTRY(atomic64_sub_ret) /* %o0 = decrement, %o1 = atomic_ptr */
sub %g1, %o0, %o0
2: BACKOFF_SPIN(%o2, %o3, 1b)
ENDPROC(atomic64_sub_ret)

ENTRY(atomic64_dec_if_positive) /* %o0 = atomic_ptr */
BACKOFF_SETUP(%o2)
1: ldx [%o0], %g1
brlez,pn %g1, 3f
sub %g1, 1, %g7
casx [%o0], %g1, %g7
cmp %g1, %g7
bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
nop
3: retl
sub %g1, 1, %o0
2: BACKOFF_SPIN(%o2, %o3, 1b)
ENDPROC(atomic64_dec_if_positive)
1 change: 1 addition & 0 deletions trunk/arch/sparc/lib/ksyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ EXPORT_SYMBOL(atomic64_add);
EXPORT_SYMBOL(atomic64_add_ret);
EXPORT_SYMBOL(atomic64_sub);
EXPORT_SYMBOL(atomic64_sub_ret);
EXPORT_SYMBOL(atomic64_dec_if_positive);

/* Atomic bit operations. */
EXPORT_SYMBOL(test_and_set_bit);
Expand Down

0 comments on commit bf8bbed

Please sign in to comment.