Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'systemh-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux

Pull system.h fixups for less common arch's from Paul Gortmaker:
"Here is what is hopefully the last of the system.h related fixups.

The fixes for Alpha and ia64 are code relocations consistent with what
was done for the more mainstream architectures. Note that the
diffstat lines removed vs lines added are not the same since I've
fixed some of the whitespace issues in the relocated code blocks.
However they are functionally the same. Compile tested locally, plus
these two have been in linux-next for a while.

There is also a trivial one line system.h related fix for the Tilera
arch from Chris Metcalf to fix an implict include.."

* 'systemh-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux:
irq_work: fix compile failure on tile from missing include
ia64: populate the cmpxchg header with appropriate code
alpha: fix build failures from system.h dismemberment

+223 -183
+1 -67
arch/alpha/include/asm/atomic.h
··· 3 3 4 4 #include <linux/types.h> 5 5 #include <asm/barrier.h> 6 + #include <asm/cmpxchg.h> 6 7 7 8 /* 8 9 * Atomic operations that C can't guarantee us. Useful for ··· 168 167 smp_mb(); 169 168 return result; 170 169 } 171 - 172 - /* 173 - * Atomic exchange routines. 174 - */ 175 - 176 - #define __ASM__MB 177 - #define ____xchg(type, args...) __xchg ## type ## _local(args) 178 - #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args) 179 - #include <asm/xchg.h> 180 - 181 - #define xchg_local(ptr,x) \ 182 - ({ \ 183 - __typeof__(*(ptr)) _x_ = (x); \ 184 - (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \ 185 - sizeof(*(ptr))); \ 186 - }) 187 - 188 - #define cmpxchg_local(ptr, o, n) \ 189 - ({ \ 190 - __typeof__(*(ptr)) _o_ = (o); \ 191 - __typeof__(*(ptr)) _n_ = (n); \ 192 - (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ 193 - (unsigned long)_n_, \ 194 - sizeof(*(ptr))); \ 195 - }) 196 - 197 - #define cmpxchg64_local(ptr, o, n) \ 198 - ({ \ 199 - BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ 200 - cmpxchg_local((ptr), (o), (n)); \ 201 - }) 202 - 203 - #ifdef CONFIG_SMP 204 - #undef __ASM__MB 205 - #define __ASM__MB "\tmb\n" 206 - #endif 207 - #undef ____xchg 208 - #undef ____cmpxchg 209 - #define ____xchg(type, args...) __xchg ##type(args) 210 - #define ____cmpxchg(type, args...) __cmpxchg ##type(args) 211 - #include <asm/xchg.h> 212 - 213 - #define xchg(ptr,x) \ 214 - ({ \ 215 - __typeof__(*(ptr)) _x_ = (x); \ 216 - (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, \ 217 - sizeof(*(ptr))); \ 218 - }) 219 - 220 - #define cmpxchg(ptr, o, n) \ 221 - ({ \ 222 - __typeof__(*(ptr)) _o_ = (o); \ 223 - __typeof__(*(ptr)) _n_ = (n); \ 224 - (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ 225 - (unsigned long)_n_, sizeof(*(ptr)));\ 226 - }) 227 - 228 - #define cmpxchg64(ptr, o, n) \ 229 - ({ \ 230 - BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ 231 - cmpxchg((ptr), (o), (n)); \ 232 - }) 233 - 234 - #undef __ASM__MB 235 - #undef ____cmpxchg 236 - 237 - #define __HAVE_ARCH_CMPXCHG 1 238 170 239 171 #define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new)) 240 172 #define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
+71
arch/alpha/include/asm/cmpxchg.h
··· 1 + #ifndef _ALPHA_CMPXCHG_H 2 + #define _ALPHA_CMPXCHG_H 3 + 4 + /* 5 + * Atomic exchange routines. 6 + */ 7 + 8 + #define __ASM__MB 9 + #define ____xchg(type, args...) __xchg ## type ## _local(args) 10 + #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args) 11 + #include <asm/xchg.h> 12 + 13 + #define xchg_local(ptr, x) \ 14 + ({ \ 15 + __typeof__(*(ptr)) _x_ = (x); \ 16 + (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \ 17 + sizeof(*(ptr))); \ 18 + }) 19 + 20 + #define cmpxchg_local(ptr, o, n) \ 21 + ({ \ 22 + __typeof__(*(ptr)) _o_ = (o); \ 23 + __typeof__(*(ptr)) _n_ = (n); \ 24 + (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ 25 + (unsigned long)_n_, \ 26 + sizeof(*(ptr))); \ 27 + }) 28 + 29 + #define cmpxchg64_local(ptr, o, n) \ 30 + ({ \ 31 + BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ 32 + cmpxchg_local((ptr), (o), (n)); \ 33 + }) 34 + 35 + #ifdef CONFIG_SMP 36 + #undef __ASM__MB 37 + #define __ASM__MB "\tmb\n" 38 + #endif 39 + #undef ____xchg 40 + #undef ____cmpxchg 41 + #define ____xchg(type, args...) __xchg ##type(args) 42 + #define ____cmpxchg(type, args...) __cmpxchg ##type(args) 43 + #include <asm/xchg.h> 44 + 45 + #define xchg(ptr, x) \ 46 + ({ \ 47 + __typeof__(*(ptr)) _x_ = (x); \ 48 + (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, \ 49 + sizeof(*(ptr))); \ 50 + }) 51 + 52 + #define cmpxchg(ptr, o, n) \ 53 + ({ \ 54 + __typeof__(*(ptr)) _o_ = (o); \ 55 + __typeof__(*(ptr)) _n_ = (n); \ 56 + (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ 57 + (unsigned long)_n_, sizeof(*(ptr)));\ 58 + }) 59 + 60 + #define cmpxchg64(ptr, o, n) \ 61 + ({ \ 62 + BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ 63 + cmpxchg((ptr), (o), (n)); \ 64 + }) 65 + 66 + #undef __ASM__MB 67 + #undef ____cmpxchg 68 + 69 + #define __HAVE_ARCH_CMPXCHG 1 70 + 71 + #endif /* _ALPHA_CMPXCHG_H */
+2 -2
arch/alpha/include/asm/xchg.h
··· 1 - #ifndef _ALPHA_ATOMIC_H 1 + #ifndef _ALPHA_CMPXCHG_H 2 2 #error Do not include xchg.h directly! 3 3 #else 4 4 /* 5 5 * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code 6 6 * except that local version do not have the expensive memory barrier. 7 - * So this file is included twice from asm/system.h. 7 + * So this file is included twice from asm/cmpxchg.h. 8 8 */ 9 9 10 10 /*
+147 -1
arch/ia64/include/asm/cmpxchg.h
··· 1 - #include <asm/intrinsics.h> 1 + #ifndef _ASM_IA64_CMPXCHG_H 2 + #define _ASM_IA64_CMPXCHG_H 3 + 4 + /* 5 + * Compare/Exchange, forked from asm/intrinsics.h 6 + * which was: 7 + * 8 + * Copyright (C) 2002-2003 Hewlett-Packard Co 9 + * David Mosberger-Tang <davidm@hpl.hp.com> 10 + */ 11 + 12 + #ifndef __ASSEMBLY__ 13 + 14 + #include <linux/types.h> 15 + /* include compiler specific intrinsics */ 16 + #include <asm/ia64regs.h> 17 + #ifdef __INTEL_COMPILER 18 + # include <asm/intel_intrin.h> 19 + #else 20 + # include <asm/gcc_intrin.h> 21 + #endif 22 + 23 + /* 24 + * This function doesn't exist, so you'll get a linker error if 25 + * something tries to do an invalid xchg(). 26 + */ 27 + extern void ia64_xchg_called_with_bad_pointer(void); 28 + 29 + #define __xchg(x, ptr, size) \ 30 + ({ \ 31 + unsigned long __xchg_result; \ 32 + \ 33 + switch (size) { \ 34 + case 1: \ 35 + __xchg_result = ia64_xchg1((__u8 *)ptr, x); \ 36 + break; \ 37 + \ 38 + case 2: \ 39 + __xchg_result = ia64_xchg2((__u16 *)ptr, x); \ 40 + break; \ 41 + \ 42 + case 4: \ 43 + __xchg_result = ia64_xchg4((__u32 *)ptr, x); \ 44 + break; \ 45 + \ 46 + case 8: \ 47 + __xchg_result = ia64_xchg8((__u64 *)ptr, x); \ 48 + break; \ 49 + default: \ 50 + ia64_xchg_called_with_bad_pointer(); \ 51 + } \ 52 + __xchg_result; \ 53 + }) 54 + 55 + #define xchg(ptr, x) \ 56 + ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr)))) 57 + 58 + /* 59 + * Atomic compare and exchange. Compare OLD with MEM, if identical, 60 + * store NEW in MEM. Return the initial value in MEM. Success is 61 + * indicated by comparing RETURN with OLD. 62 + */ 63 + 64 + #define __HAVE_ARCH_CMPXCHG 1 65 + 66 + /* 67 + * This function doesn't exist, so you'll get a linker error 68 + * if something tries to do an invalid cmpxchg(). 69 + */ 70 + extern long ia64_cmpxchg_called_with_bad_pointer(void); 71 + 72 + #define ia64_cmpxchg(sem, ptr, old, new, size) \ 73 + ({ \ 74 + __u64 _o_, _r_; \ 75 + \ 76 + switch (size) { \ 77 + case 1: \ 78 + _o_ = (__u8) (long) (old); \ 79 + break; \ 80 + case 2: \ 81 + _o_ = (__u16) (long) (old); \ 82 + break; \ 83 + case 4: \ 84 + _o_ = (__u32) (long) (old); \ 85 + break; \ 86 + case 8: \ 87 + _o_ = (__u64) (long) (old); \ 88 + break; \ 89 + default: \ 90 + break; \ 91 + } \ 92 + switch (size) { \ 93 + case 1: \ 94 + _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \ 95 + break; \ 96 + \ 97 + case 2: \ 98 + _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \ 99 + break; \ 100 + \ 101 + case 4: \ 102 + _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \ 103 + break; \ 104 + \ 105 + case 8: \ 106 + _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \ 107 + break; \ 108 + \ 109 + default: \ 110 + _r_ = ia64_cmpxchg_called_with_bad_pointer(); \ 111 + break; \ 112 + } \ 113 + (__typeof__(old)) _r_; \ 114 + }) 115 + 116 + #define cmpxchg_acq(ptr, o, n) \ 117 + ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr))) 118 + #define cmpxchg_rel(ptr, o, n) \ 119 + ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr))) 120 + 121 + /* for compatibility with other platforms: */ 122 + #define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) 123 + #define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) 124 + 125 + #define cmpxchg_local cmpxchg 126 + #define cmpxchg64_local cmpxchg64 127 + 128 + #ifdef CONFIG_IA64_DEBUG_CMPXCHG 129 + # define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128; 130 + # define CMPXCHG_BUGCHECK(v) \ 131 + do { \ 132 + if (_cmpxchg_bugcheck_count-- <= 0) { \ 133 + void *ip; \ 134 + extern int printk(const char *fmt, ...); \ 135 + ip = (void *) ia64_getreg(_IA64_REG_IP); \ 136 + printk("CMPXCHG_BUGCHECK: stuck at %p on word %p\n", ip, (v));\ 137 + break; \ 138 + } \ 139 + } while (0) 140 + #else /* !CONFIG_IA64_DEBUG_CMPXCHG */ 141 + # define CMPXCHG_BUGCHECK_DECL 142 + # define CMPXCHG_BUGCHECK(v) 143 + #endif /* !CONFIG_IA64_DEBUG_CMPXCHG */ 144 + 145 + #endif /* !__ASSEMBLY__ */ 146 + 147 + #endif /* _ASM_IA64_CMPXCHG_H */
+1 -113
arch/ia64/include/asm/intrinsics.h
··· 18 18 #else 19 19 # include <asm/gcc_intrin.h> 20 20 #endif 21 + #include <asm/cmpxchg.h> 21 22 22 23 #define ia64_native_get_psr_i() (ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I) 23 24 ··· 81 80 }) 82 81 83 82 #define ia64_fetch_and_add(i,v) (ia64_fetchadd(i, v, rel) + (i)) /* return new value */ 84 - 85 - /* 86 - * This function doesn't exist, so you'll get a linker error if 87 - * something tries to do an invalid xchg(). 88 - */ 89 - extern void ia64_xchg_called_with_bad_pointer (void); 90 - 91 - #define __xchg(x,ptr,size) \ 92 - ({ \ 93 - unsigned long __xchg_result; \ 94 - \ 95 - switch (size) { \ 96 - case 1: \ 97 - __xchg_result = ia64_xchg1((__u8 *)ptr, x); \ 98 - break; \ 99 - \ 100 - case 2: \ 101 - __xchg_result = ia64_xchg2((__u16 *)ptr, x); \ 102 - break; \ 103 - \ 104 - case 4: \ 105 - __xchg_result = ia64_xchg4((__u32 *)ptr, x); \ 106 - break; \ 107 - \ 108 - case 8: \ 109 - __xchg_result = ia64_xchg8((__u64 *)ptr, x); \ 110 - break; \ 111 - default: \ 112 - ia64_xchg_called_with_bad_pointer(); \ 113 - } \ 114 - __xchg_result; \ 115 - }) 116 - 117 - #define xchg(ptr,x) \ 118 - ((__typeof__(*(ptr))) __xchg ((unsigned long) (x), (ptr), sizeof(*(ptr)))) 119 - 120 - /* 121 - * Atomic compare and exchange. Compare OLD with MEM, if identical, 122 - * store NEW in MEM. Return the initial value in MEM. Success is 123 - * indicated by comparing RETURN with OLD. 124 - */ 125 - 126 - #define __HAVE_ARCH_CMPXCHG 1 127 - 128 - /* 129 - * This function doesn't exist, so you'll get a linker error 130 - * if something tries to do an invalid cmpxchg(). 131 - */ 132 - extern long ia64_cmpxchg_called_with_bad_pointer (void); 133 - 134 - #define ia64_cmpxchg(sem,ptr,old,new,size) \ 135 - ({ \ 136 - __u64 _o_, _r_; \ 137 - \ 138 - switch (size) { \ 139 - case 1: _o_ = (__u8 ) (long) (old); break; \ 140 - case 2: _o_ = (__u16) (long) (old); break; \ 141 - case 4: _o_ = (__u32) (long) (old); break; \ 142 - case 8: _o_ = (__u64) (long) (old); break; \ 143 - default: break; \ 144 - } \ 145 - switch (size) { \ 146 - case 1: \ 147 - _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \ 148 - break; \ 149 - \ 150 - case 2: \ 151 - _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \ 152 - break; \ 153 - \ 154 - case 4: \ 155 - _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \ 156 - break; \ 157 - \ 158 - case 8: \ 159 - _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \ 160 - break; \ 161 - \ 162 - default: \ 163 - _r_ = ia64_cmpxchg_called_with_bad_pointer(); \ 164 - break; \ 165 - } \ 166 - (__typeof__(old)) _r_; \ 167 - }) 168 - 169 - #define cmpxchg_acq(ptr, o, n) \ 170 - ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr))) 171 - #define cmpxchg_rel(ptr, o, n) \ 172 - ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr))) 173 - 174 - /* for compatibility with other platforms: */ 175 - #define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) 176 - #define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n)) 177 - 178 - #define cmpxchg_local cmpxchg 179 - #define cmpxchg64_local cmpxchg64 180 - 181 - #ifdef CONFIG_IA64_DEBUG_CMPXCHG 182 - # define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128; 183 - # define CMPXCHG_BUGCHECK(v) \ 184 - do { \ 185 - if (_cmpxchg_bugcheck_count-- <= 0) { \ 186 - void *ip; \ 187 - extern int printk(const char *fmt, ...); \ 188 - ip = (void *) ia64_getreg(_IA64_REG_IP); \ 189 - printk("CMPXCHG_BUGCHECK: stuck at %p on word %p\n", ip, (v)); \ 190 - break; \ 191 - } \ 192 - } while (0) 193 - #else /* !CONFIG_IA64_DEBUG_CMPXCHG */ 194 - # define CMPXCHG_BUGCHECK_DECL 195 - # define CMPXCHG_BUGCHECK(v) 196 - #endif /* !CONFIG_IA64_DEBUG_CMPXCHG */ 197 83 198 84 #endif 199 85
+1
kernel/irq_work.c
··· 11 11 #include <linux/irq_work.h> 12 12 #include <linux/percpu.h> 13 13 #include <linux/hardirq.h> 14 + #include <linux/irqflags.h> 14 15 #include <asm/processor.h> 15 16 16 17 /*