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