diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-26 15:48:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-26 15:48:06 -0500 |
commit | b0138a6cb7923a997d278b47c176778534d1095b (patch) | |
tree | 4fcb8822a69631baba568e4e1942847747123887 /include/asm-parisc/bitops.h | |
parent | 6572d6d7d0f965dda19d02af804ed3ae4b3bf1fc (diff) | |
parent | 1055a8af093fea7490445bd15cd671020e542035 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6: (78 commits)
[PARISC] Use symbolic last syscall in __NR_Linux_syscalls
[PARISC] Add missing statfs64 and fstatfs64 syscalls
Revert "[PARISC] Optimize TLB flush on SMP systems"
[PARISC] Compat signal fixes for 64-bit parisc
[PARISC] Reorder syscalls to match unistd.h
Revert "[PATCH] make kernel/signal.c:kill_proc_info() static"
[PARISC] fix sys_rt_sigqueueinfo
[PARISC] fix section mismatch warnings in harmony sound driver
[PARISC] do not export get_register/set_register
[PARISC] add ENTRY()/ENDPROC() and simplify assembly of HP/UX emulation code
[PARISC] convert to use CONFIG_64BIT instead of __LP64__
[PARISC] use CONFIG_64BIT instead of __LP64__
[PARISC] add ASM_EXCEPTIONTABLE_ENTRY() macro
[PARISC] more ENTRY(), ENDPROC(), END() conversions
[PARISC] fix ENTRY() and ENDPROC() for 64bit-parisc
[PARISC] Fixes /proc/cpuinfo cache output on B160L
[PARISC] implement standard ENTRY(), END() and ENDPROC()
[PARISC] kill ENTRY_SYS_CPUS
[PARISC] clean up debugging printks in smp.c
[PARISC] factor syscall_restart code out of do_signal
...
Fix conflict in include/linux/sched.h due to kill_proc_info() being made
publicly available to PARISC again.
Diffstat (limited to 'include/asm-parisc/bitops.h')
-rw-r--r-- | include/asm-parisc/bitops.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h index 900561922c4c..015cb0d379bd 100644 --- a/include/asm-parisc/bitops.h +++ b/include/asm-parisc/bitops.h | |||
@@ -60,31 +60,37 @@ static __inline__ void change_bit(int nr, volatile unsigned long * addr) | |||
60 | static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr) | 60 | static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr) |
61 | { | 61 | { |
62 | unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); | 62 | unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); |
63 | unsigned long oldbit; | 63 | unsigned long old; |
64 | unsigned long flags; | 64 | unsigned long flags; |
65 | int set; | ||
65 | 66 | ||
66 | addr += (nr >> SHIFT_PER_LONG); | 67 | addr += (nr >> SHIFT_PER_LONG); |
67 | _atomic_spin_lock_irqsave(addr, flags); | 68 | _atomic_spin_lock_irqsave(addr, flags); |
68 | oldbit = *addr; | 69 | old = *addr; |
69 | *addr = oldbit | mask; | 70 | set = (old & mask) ? 1 : 0; |
71 | if (!set) | ||
72 | *addr = old | mask; | ||
70 | _atomic_spin_unlock_irqrestore(addr, flags); | 73 | _atomic_spin_unlock_irqrestore(addr, flags); |
71 | 74 | ||
72 | return (oldbit & mask) ? 1 : 0; | 75 | return set; |
73 | } | 76 | } |
74 | 77 | ||
75 | static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr) | 78 | static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr) |
76 | { | 79 | { |
77 | unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); | 80 | unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); |
78 | unsigned long oldbit; | 81 | unsigned long old; |
79 | unsigned long flags; | 82 | unsigned long flags; |
83 | int set; | ||
80 | 84 | ||
81 | addr += (nr >> SHIFT_PER_LONG); | 85 | addr += (nr >> SHIFT_PER_LONG); |
82 | _atomic_spin_lock_irqsave(addr, flags); | 86 | _atomic_spin_lock_irqsave(addr, flags); |
83 | oldbit = *addr; | 87 | old = *addr; |
84 | *addr = oldbit & ~mask; | 88 | set = (old & mask) ? 1 : 0; |
89 | if (set) | ||
90 | *addr = old & ~mask; | ||
85 | _atomic_spin_unlock_irqrestore(addr, flags); | 91 | _atomic_spin_unlock_irqrestore(addr, flags); |
86 | 92 | ||
87 | return (oldbit & mask) ? 1 : 0; | 93 | return set; |
88 | } | 94 | } |
89 | 95 | ||
90 | static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr) | 96 | static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr) |
@@ -130,7 +136,7 @@ static __inline__ unsigned long __ffs(unsigned long x) | |||
130 | unsigned long ret; | 136 | unsigned long ret; |
131 | 137 | ||
132 | __asm__( | 138 | __asm__( |
133 | #ifdef __LP64__ | 139 | #ifdef CONFIG_64BIT |
134 | " ldi 63,%1\n" | 140 | " ldi 63,%1\n" |
135 | " extrd,u,*<> %0,63,32,%%r0\n" | 141 | " extrd,u,*<> %0,63,32,%%r0\n" |
136 | " extrd,u,*TR %0,31,32,%0\n" /* move top 32-bits down */ | 142 | " extrd,u,*TR %0,31,32,%0\n" /* move top 32-bits down */ |