Merge git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic

* git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
asm-generic/io.h: allow people to override individual funcs
bitops: remove duplicated extern declarations
bitops: make asm-generic/bitops/find.h more generic
asm-generic: kdebug.h: Checkpatch cleanup
asm-generic: fcntl: make exported headers use strict posix types
asm-generic: cmpxchg does not handle non-long arguments
asm-generic: make atomic_add_unless a function

+86 -85
+1
arch/tile/include/asm/bitops.h
··· 120 120 121 121 #include <asm-generic/bitops/const_hweight.h> 122 122 #include <asm-generic/bitops/lock.h> 123 + #include <asm-generic/bitops/find.h> 123 124 #include <asm-generic/bitops/sched.h> 124 125 #include <asm-generic/bitops/ext2-non-atomic.h> 125 126 #include <asm-generic/bitops/minix.h>
+2
arch/x86/include/asm/bitops.h
··· 440 440 441 441 #ifdef __KERNEL__ 442 442 443 + #include <asm-generic/bitops/find.h> 444 + 443 445 #include <asm-generic/bitops/sched.h> 444 446 445 447 #define ARCH_HAS_FAST_MULTIPLIER 1
+17 -17
include/asm-generic/atomic.h
··· 120 120 #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) 121 121 #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) 122 122 123 - #define atomic_add_unless(v, a, u) \ 124 - ({ \ 125 - int c, old; \ 126 - c = atomic_read(v); \ 127 - while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 128 - c = old; \ 129 - c != (u); \ 130 - }) 123 + #define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v))) 124 + #define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) 125 + 126 + #define cmpxchg_local(ptr, o, n) \ 127 + ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ 128 + (unsigned long)(n), sizeof(*(ptr)))) 129 + 130 + #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 131 + 132 + static inline int atomic_add_unless(atomic_t *v, int a, int u) 133 + { 134 + int c, old; 135 + c = atomic_read(v); 136 + while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c) 137 + c = old; 138 + return c != u; 139 + } 131 140 132 141 #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 133 142 ··· 149 140 *addr &= mask; 150 141 raw_local_irq_restore(flags); 151 142 } 152 - 153 - #define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v))) 154 - #define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) 155 - 156 - #define cmpxchg_local(ptr, o, n) \ 157 - ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ 158 - (unsigned long)(n), sizeof(*(ptr)))) 159 - 160 - #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 161 143 162 144 /* Assume that atomic operations are already serializing */ 163 145 #define smp_mb__before_atomic_dec() barrier()
+37 -2
include/asm-generic/bitops/find.h
··· 1 1 #ifndef _ASM_GENERIC_BITOPS_FIND_H_ 2 2 #define _ASM_GENERIC_BITOPS_FIND_H_ 3 3 4 - #ifndef CONFIG_GENERIC_FIND_NEXT_BIT 4 + /** 5 + * find_next_bit - find the next set bit in a memory region 6 + * @addr: The address to base the search on 7 + * @offset: The bitnumber to start searching at 8 + * @size: The bitmap size in bits 9 + */ 5 10 extern unsigned long find_next_bit(const unsigned long *addr, unsigned long 6 11 size, unsigned long offset); 7 12 13 + /** 14 + * find_next_zero_bit - find the next cleared bit in a memory region 15 + * @addr: The address to base the search on 16 + * @offset: The bitnumber to start searching at 17 + * @size: The bitmap size in bits 18 + */ 8 19 extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned 9 20 long size, unsigned long offset); 10 - #endif 21 + 22 + #ifdef CONFIG_GENERIC_FIND_FIRST_BIT 23 + 24 + /** 25 + * find_first_bit - find the first set bit in a memory region 26 + * @addr: The address to start the search at 27 + * @size: The maximum size to search 28 + * 29 + * Returns the bit number of the first set bit. 30 + */ 31 + extern unsigned long find_first_bit(const unsigned long *addr, 32 + unsigned long size); 33 + 34 + /** 35 + * find_first_zero_bit - find the first cleared bit in a memory region 36 + * @addr: The address to start the search at 37 + * @size: The maximum size to search 38 + * 39 + * Returns the bit number of the first cleared bit. 40 + */ 41 + extern unsigned long find_first_zero_bit(const unsigned long *addr, 42 + unsigned long size); 43 + #else /* CONFIG_GENERIC_FIND_FIRST_BIT */ 11 44 12 45 #define find_first_bit(addr, size) find_next_bit((addr), (size), 0) 13 46 #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) 47 + 48 + #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 14 49 15 50 #endif /*_ASM_GENERIC_BITOPS_FIND_H_ */
+1 -1
include/asm-generic/fcntl.h
··· 122 122 123 123 struct f_owner_ex { 124 124 int type; 125 - pid_t pid; 125 + __kernel_pid_t pid; 126 126 }; 127 127 128 128 /* for F_[GET|SET]FL */
+26
include/asm-generic/io.h
··· 19 19 #include <asm-generic/iomap.h> 20 20 #endif 21 21 22 + #ifndef mmiowb 22 23 #define mmiowb() do {} while (0) 24 + #endif 23 25 24 26 /*****************************************************************************/ 25 27 /* ··· 30 28 * differently. On the simple architectures, we just read/write the 31 29 * memory location directly. 32 30 */ 31 + #ifndef __raw_readb 33 32 static inline u8 __raw_readb(const volatile void __iomem *addr) 34 33 { 35 34 return *(const volatile u8 __force *) addr; 36 35 } 36 + #endif 37 37 38 + #ifndef __raw_readw 38 39 static inline u16 __raw_readw(const volatile void __iomem *addr) 39 40 { 40 41 return *(const volatile u16 __force *) addr; 41 42 } 43 + #endif 42 44 45 + #ifndef __raw_readl 43 46 static inline u32 __raw_readl(const volatile void __iomem *addr) 44 47 { 45 48 return *(const volatile u32 __force *) addr; 46 49 } 50 + #endif 47 51 48 52 #define readb __raw_readb 49 53 #define readw(addr) __le16_to_cpu(__raw_readw(addr)) 50 54 #define readl(addr) __le32_to_cpu(__raw_readl(addr)) 51 55 56 + #ifndef __raw_writeb 52 57 static inline void __raw_writeb(u8 b, volatile void __iomem *addr) 53 58 { 54 59 *(volatile u8 __force *) addr = b; 55 60 } 61 + #endif 56 62 63 + #ifndef __raw_writew 57 64 static inline void __raw_writew(u16 b, volatile void __iomem *addr) 58 65 { 59 66 *(volatile u16 __force *) addr = b; 60 67 } 68 + #endif 61 69 70 + #ifndef __raw_writel 62 71 static inline void __raw_writel(u32 b, volatile void __iomem *addr) 63 72 { 64 73 *(volatile u32 __force *) addr = b; 65 74 } 75 + #endif 66 76 67 77 #define writeb __raw_writeb 68 78 #define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr) ··· 136 122 #define outw_p(x, addr) outw((x), (addr)) 137 123 #define outl_p(x, addr) outl((x), (addr)) 138 124 125 + #ifndef insb 139 126 static inline void insb(unsigned long addr, void *buffer, int count) 140 127 { 141 128 if (count) { ··· 147 132 } while (--count); 148 133 } 149 134 } 135 + #endif 150 136 137 + #ifndef insw 151 138 static inline void insw(unsigned long addr, void *buffer, int count) 152 139 { 153 140 if (count) { ··· 160 143 } while (--count); 161 144 } 162 145 } 146 + #endif 163 147 148 + #ifndef insl 164 149 static inline void insl(unsigned long addr, void *buffer, int count) 165 150 { 166 151 if (count) { ··· 173 154 } while (--count); 174 155 } 175 156 } 157 + #endif 176 158 159 + #ifndef outsb 177 160 static inline void outsb(unsigned long addr, const void *buffer, int count) 178 161 { 179 162 if (count) { ··· 185 164 } while (--count); 186 165 } 187 166 } 167 + #endif 188 168 169 + #ifndef outsw 189 170 static inline void outsw(unsigned long addr, const void *buffer, int count) 190 171 { 191 172 if (count) { ··· 197 174 } while (--count); 198 175 } 199 176 } 177 + #endif 200 178 179 + #ifndef outsl 201 180 static inline void outsl(unsigned long addr, const void *buffer, int count) 202 181 { 203 182 if (count) { ··· 209 184 } while (--count); 210 185 } 211 186 } 187 + #endif 212 188 213 189 #ifndef CONFIG_GENERIC_IOMAP 214 190 #define ioread8(addr) readb(addr)
+1 -1
include/asm-generic/kdebug.h
··· 3 3 4 4 enum die_val { 5 5 DIE_UNUSED, 6 - DIE_OOPS=1 6 + DIE_OOPS = 1, 7 7 }; 8 8 9 9 #endif /* _ASM_GENERIC_KDEBUG_H */
+1 -19
include/asm-generic/system.h
··· 21 21 #include <linux/irqflags.h> 22 22 23 23 #include <asm/cmpxchg-local.h> 24 + #include <asm/cmpxchg.h> 24 25 25 26 struct task_struct; 26 27 ··· 136 135 137 136 #define xchg(ptr, x) \ 138 137 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) 139 - 140 - static inline unsigned long __cmpxchg(volatile unsigned long *m, 141 - unsigned long old, unsigned long new) 142 - { 143 - unsigned long retval; 144 - unsigned long flags; 145 - 146 - local_irq_save(flags); 147 - retval = *m; 148 - if (retval == old) 149 - *m = new; 150 - local_irq_restore(flags); 151 - return retval; 152 - } 153 - 154 - #define cmpxchg(ptr, o, n) \ 155 - ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \ 156 - (unsigned long)(o), \ 157 - (unsigned long)(n))) 158 138 159 139 #endif /* !__ASSEMBLY__ */ 160 140
-45
include/linux/bitops.h
··· 136 136 } 137 137 138 138 #ifdef __KERNEL__ 139 - #ifdef CONFIG_GENERIC_FIND_FIRST_BIT 140 - 141 - /** 142 - * find_first_bit - find the first set bit in a memory region 143 - * @addr: The address to start the search at 144 - * @size: The maximum size to search 145 - * 146 - * Returns the bit number of the first set bit. 147 - */ 148 - extern unsigned long find_first_bit(const unsigned long *addr, 149 - unsigned long size); 150 - 151 - /** 152 - * find_first_zero_bit - find the first cleared bit in a memory region 153 - * @addr: The address to start the search at 154 - * @size: The maximum size to search 155 - * 156 - * Returns the bit number of the first cleared bit. 157 - */ 158 - extern unsigned long find_first_zero_bit(const unsigned long *addr, 159 - unsigned long size); 160 - #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 161 139 162 140 #ifdef CONFIG_GENERIC_FIND_LAST_BIT 163 141 /** ··· 149 171 unsigned long size); 150 172 #endif /* CONFIG_GENERIC_FIND_LAST_BIT */ 151 173 152 - #ifdef CONFIG_GENERIC_FIND_NEXT_BIT 153 - 154 - /** 155 - * find_next_bit - find the next set bit in a memory region 156 - * @addr: The address to base the search on 157 - * @offset: The bitnumber to start searching at 158 - * @size: The bitmap size in bits 159 - */ 160 - extern unsigned long find_next_bit(const unsigned long *addr, 161 - unsigned long size, unsigned long offset); 162 - 163 - /** 164 - * find_next_zero_bit - find the next cleared bit in a memory region 165 - * @addr: The address to base the search on 166 - * @offset: The bitnumber to start searching at 167 - * @size: The bitmap size in bits 168 - */ 169 - 170 - extern unsigned long find_next_zero_bit(const unsigned long *addr, 171 - unsigned long size, 172 - unsigned long offset); 173 - 174 - #endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ 175 174 #endif /* __KERNEL__ */ 176 175 #endif