Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71209
b: refs/heads/master
c: 44086d5
h: refs/heads/master
i:
  71207: 8c574a2
v: v3
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Oct 18, 2007
1 parent 0c3864a commit 1bdc481
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 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: 7c29ca5b8d13287ed67d2863f4c5f7bfc1a15279
refs/heads/master: 44086d5286c57c86622dee37684decf32355aa7c
43 changes: 42 additions & 1 deletion trunk/include/asm-alpha/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _ALPHA_BITOPS_H

#include <asm/compiler.h>
#include <asm/barrier.h>

/*
* Copyright 1994, Linus Torvalds.
Expand Down Expand Up @@ -69,6 +70,13 @@ clear_bit(unsigned long nr, volatile void * addr)
:"Ir" (1UL << (nr & 31)), "m" (*m));
}

static inline void
clear_bit_unlock(unsigned long nr, volatile void * addr)
{
smp_mb();
clear_bit(nr, addr);
}

/*
* WARNING: non atomic version.
*/
Expand All @@ -80,6 +88,13 @@ __clear_bit(unsigned long nr, volatile void * addr)
*m &= ~(1 << (nr & 31));
}

static inline void
__clear_bit_unlock(unsigned long nr, volatile void * addr)
{
smp_mb();
__clear_bit(nr, addr);
}

static inline void
change_bit(unsigned long nr, volatile void * addr)
{
Expand Down Expand Up @@ -139,6 +154,33 @@ test_and_set_bit(unsigned long nr, volatile void *addr)
return oldbit != 0;
}

static inline int
test_and_set_bit_lock(unsigned long nr, volatile void *addr)
{
unsigned long oldbit;
unsigned long temp;
int *m = ((int *) addr) + (nr >> 5);

__asm__ __volatile__(
"1: ldl_l %0,%4\n"
" and %0,%3,%2\n"
" bne %2,2f\n"
" xor %0,%3,%0\n"
" stl_c %0,%1\n"
" beq %0,3f\n"
"2:\n"
#ifdef CONFIG_SMP
" mb\n"
#endif
".subsection 2\n"
"3: br 1b\n"
".previous"
:"=&r" (temp), "=m" (*m), "=&r" (oldbit)
:"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");

return oldbit != 0;
}

/*
* WARNING: non atomic version.
*/
Expand Down Expand Up @@ -376,7 +418,6 @@ static inline unsigned int hweight8(unsigned int w)
#else
#include <asm-generic/bitops/hweight.h>
#endif
#include <asm-generic/bitops/lock.h>

#endif /* __KERNEL__ */

Expand Down

0 comments on commit 1bdc481

Please sign in to comment.