diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/bitops_32.h | 7 | ||||
-rw-r--r-- | include/asm-x86/bitops_64.h | 57 | ||||
-rw-r--r-- | include/linux/sched.h | 28 |
3 files changed, 49 insertions, 43 deletions
diff --git a/include/asm-x86/bitops_32.h b/include/asm-x86/bitops_32.h index 36ebb5b02b4f..0b40f6d20bea 100644 --- a/include/asm-x86/bitops_32.h +++ b/include/asm-x86/bitops_32.h | |||
@@ -183,9 +183,12 @@ static inline int test_and_set_bit(int nr, volatile unsigned long * addr) | |||
183 | * @nr: Bit to set | 183 | * @nr: Bit to set |
184 | * @addr: Address to count from | 184 | * @addr: Address to count from |
185 | * | 185 | * |
186 | * This is the same as test_and_set_bit on x86 | 186 | * This is the same as test_and_set_bit on x86. |
187 | */ | 187 | */ |
188 | #define test_and_set_bit_lock test_and_set_bit | 188 | static inline int test_and_set_bit_lock(int nr, volatile unsigned long *addr) |
189 | { | ||
190 | return test_and_set_bit(nr, addr); | ||
191 | } | ||
189 | 192 | ||
190 | /** | 193 | /** |
191 | * __test_and_set_bit - Set a bit and return its old value | 194 | * __test_and_set_bit - Set a bit and return its old value |
diff --git a/include/asm-x86/bitops_64.h b/include/asm-x86/bitops_64.h index b4d47940b959..766bcc0470a6 100644 --- a/include/asm-x86/bitops_64.h +++ b/include/asm-x86/bitops_64.h | |||
@@ -29,7 +29,7 @@ | |||
29 | * Note that @nr may be almost arbitrarily large; this function is not | 29 | * Note that @nr may be almost arbitrarily large; this function is not |
30 | * restricted to acting on a single-word quantity. | 30 | * restricted to acting on a single-word quantity. |
31 | */ | 31 | */ |
32 | static __inline__ void set_bit(int nr, volatile void * addr) | 32 | static inline void set_bit(int nr, volatile void *addr) |
33 | { | 33 | { |
34 | __asm__ __volatile__( LOCK_PREFIX | 34 | __asm__ __volatile__( LOCK_PREFIX |
35 | "btsl %1,%0" | 35 | "btsl %1,%0" |
@@ -46,7 +46,7 @@ static __inline__ void set_bit(int nr, volatile void * addr) | |||
46 | * If it's called on the same region of memory simultaneously, the effect | 46 | * If it's called on the same region of memory simultaneously, the effect |
47 | * may be that only one operation succeeds. | 47 | * may be that only one operation succeeds. |
48 | */ | 48 | */ |
49 | static __inline__ void __set_bit(int nr, volatile void * addr) | 49 | static inline void __set_bit(int nr, volatile void *addr) |
50 | { | 50 | { |
51 | __asm__ volatile( | 51 | __asm__ volatile( |
52 | "btsl %1,%0" | 52 | "btsl %1,%0" |
@@ -64,7 +64,7 @@ static __inline__ void __set_bit(int nr, volatile void * addr) | |||
64 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | 64 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() |
65 | * in order to ensure changes are visible on other processors. | 65 | * in order to ensure changes are visible on other processors. |
66 | */ | 66 | */ |
67 | static __inline__ void clear_bit(int nr, volatile void * addr) | 67 | static inline void clear_bit(int nr, volatile void *addr) |
68 | { | 68 | { |
69 | __asm__ __volatile__( LOCK_PREFIX | 69 | __asm__ __volatile__( LOCK_PREFIX |
70 | "btrl %1,%0" | 70 | "btrl %1,%0" |
@@ -86,7 +86,7 @@ static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *ad | |||
86 | clear_bit(nr, addr); | 86 | clear_bit(nr, addr); |
87 | } | 87 | } |
88 | 88 | ||
89 | static __inline__ void __clear_bit(int nr, volatile void * addr) | 89 | static inline void __clear_bit(int nr, volatile void *addr) |
90 | { | 90 | { |
91 | __asm__ __volatile__( | 91 | __asm__ __volatile__( |
92 | "btrl %1,%0" | 92 | "btrl %1,%0" |
@@ -124,7 +124,7 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long * | |||
124 | * If it's called on the same region of memory simultaneously, the effect | 124 | * If it's called on the same region of memory simultaneously, the effect |
125 | * may be that only one operation succeeds. | 125 | * may be that only one operation succeeds. |
126 | */ | 126 | */ |
127 | static __inline__ void __change_bit(int nr, volatile void * addr) | 127 | static inline void __change_bit(int nr, volatile void *addr) |
128 | { | 128 | { |
129 | __asm__ __volatile__( | 129 | __asm__ __volatile__( |
130 | "btcl %1,%0" | 130 | "btcl %1,%0" |
@@ -141,7 +141,7 @@ static __inline__ void __change_bit(int nr, volatile void * addr) | |||
141 | * Note that @nr may be almost arbitrarily large; this function is not | 141 | * Note that @nr may be almost arbitrarily large; this function is not |
142 | * restricted to acting on a single-word quantity. | 142 | * restricted to acting on a single-word quantity. |
143 | */ | 143 | */ |
144 | static __inline__ void change_bit(int nr, volatile void * addr) | 144 | static inline void change_bit(int nr, volatile void *addr) |
145 | { | 145 | { |
146 | __asm__ __volatile__( LOCK_PREFIX | 146 | __asm__ __volatile__( LOCK_PREFIX |
147 | "btcl %1,%0" | 147 | "btcl %1,%0" |
@@ -157,7 +157,7 @@ static __inline__ void change_bit(int nr, volatile void * addr) | |||
157 | * This operation is atomic and cannot be reordered. | 157 | * This operation is atomic and cannot be reordered. |
158 | * It also implies a memory barrier. | 158 | * It also implies a memory barrier. |
159 | */ | 159 | */ |
160 | static __inline__ int test_and_set_bit(int nr, volatile void * addr) | 160 | static inline int test_and_set_bit(int nr, volatile void *addr) |
161 | { | 161 | { |
162 | int oldbit; | 162 | int oldbit; |
163 | 163 | ||
@@ -173,9 +173,12 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr) | |||
173 | * @nr: Bit to set | 173 | * @nr: Bit to set |
174 | * @addr: Address to count from | 174 | * @addr: Address to count from |
175 | * | 175 | * |
176 | * This is the same as test_and_set_bit on x86 | 176 | * This is the same as test_and_set_bit on x86. |
177 | */ | 177 | */ |
178 | #define test_and_set_bit_lock test_and_set_bit | 178 | static inline int test_and_set_bit_lock(int nr, volatile void *addr) |
179 | { | ||
180 | return test_and_set_bit(nr, addr); | ||
181 | } | ||
179 | 182 | ||
180 | /** | 183 | /** |
181 | * __test_and_set_bit - Set a bit and return its old value | 184 | * __test_and_set_bit - Set a bit and return its old value |
@@ -186,7 +189,7 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr) | |||
186 | * If two examples of this operation race, one can appear to succeed | 189 | * If two examples of this operation race, one can appear to succeed |
187 | * but actually fail. You must protect multiple accesses with a lock. | 190 | * but actually fail. You must protect multiple accesses with a lock. |
188 | */ | 191 | */ |
189 | static __inline__ int __test_and_set_bit(int nr, volatile void * addr) | 192 | static inline int __test_and_set_bit(int nr, volatile void *addr) |
190 | { | 193 | { |
191 | int oldbit; | 194 | int oldbit; |
192 | 195 | ||
@@ -205,7 +208,7 @@ static __inline__ int __test_and_set_bit(int nr, volatile void * addr) | |||
205 | * This operation is atomic and cannot be reordered. | 208 | * This operation is atomic and cannot be reordered. |
206 | * It also implies a memory barrier. | 209 | * It also implies a memory barrier. |
207 | */ | 210 | */ |
208 | static __inline__ int test_and_clear_bit(int nr, volatile void * addr) | 211 | static inline int test_and_clear_bit(int nr, volatile void *addr) |
209 | { | 212 | { |
210 | int oldbit; | 213 | int oldbit; |
211 | 214 | ||
@@ -225,7 +228,7 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr) | |||
225 | * If two examples of this operation race, one can appear to succeed | 228 | * If two examples of this operation race, one can appear to succeed |
226 | * but actually fail. You must protect multiple accesses with a lock. | 229 | * but actually fail. You must protect multiple accesses with a lock. |
227 | */ | 230 | */ |
228 | static __inline__ int __test_and_clear_bit(int nr, volatile void * addr) | 231 | static inline int __test_and_clear_bit(int nr, volatile void *addr) |
229 | { | 232 | { |
230 | int oldbit; | 233 | int oldbit; |
231 | 234 | ||
@@ -237,7 +240,7 @@ static __inline__ int __test_and_clear_bit(int nr, volatile void * addr) | |||
237 | } | 240 | } |
238 | 241 | ||
239 | /* WARNING: non atomic and it can be reordered! */ | 242 | /* WARNING: non atomic and it can be reordered! */ |
240 | static __inline__ int __test_and_change_bit(int nr, volatile void * addr) | 243 | static inline int __test_and_change_bit(int nr, volatile void *addr) |
241 | { | 244 | { |
242 | int oldbit; | 245 | int oldbit; |
243 | 246 | ||
@@ -256,7 +259,7 @@ static __inline__ int __test_and_change_bit(int nr, volatile void * addr) | |||
256 | * This operation is atomic and cannot be reordered. | 259 | * This operation is atomic and cannot be reordered. |
257 | * It also implies a memory barrier. | 260 | * It also implies a memory barrier. |
258 | */ | 261 | */ |
259 | static __inline__ int test_and_change_bit(int nr, volatile void * addr) | 262 | static inline int test_and_change_bit(int nr, volatile void *addr) |
260 | { | 263 | { |
261 | int oldbit; | 264 | int oldbit; |
262 | 265 | ||
@@ -273,15 +276,15 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr) | |||
273 | * @nr: bit number to test | 276 | * @nr: bit number to test |
274 | * @addr: Address to start counting from | 277 | * @addr: Address to start counting from |
275 | */ | 278 | */ |
276 | static int test_bit(int nr, const volatile void * addr); | 279 | static int test_bit(int nr, const volatile void *addr); |
277 | #endif | 280 | #endif |
278 | 281 | ||
279 | static __inline__ int constant_test_bit(int nr, const volatile void * addr) | 282 | static inline int constant_test_bit(int nr, const volatile void *addr) |
280 | { | 283 | { |
281 | return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0; | 284 | return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0; |
282 | } | 285 | } |
283 | 286 | ||
284 | static __inline__ int variable_test_bit(int nr, volatile const void * addr) | 287 | static inline int variable_test_bit(int nr, volatile const void *addr) |
285 | { | 288 | { |
286 | int oldbit; | 289 | int oldbit; |
287 | 290 | ||
@@ -299,10 +302,10 @@ static __inline__ int variable_test_bit(int nr, volatile const void * addr) | |||
299 | 302 | ||
300 | #undef ADDR | 303 | #undef ADDR |
301 | 304 | ||
302 | extern long find_first_zero_bit(const unsigned long * addr, unsigned long size); | 305 | extern long find_first_zero_bit(const unsigned long *addr, unsigned long size); |
303 | extern long find_next_zero_bit (const unsigned long * addr, long size, long offset); | 306 | extern long find_next_zero_bit(const unsigned long *addr, long size, long offset); |
304 | extern long find_first_bit(const unsigned long * addr, unsigned long size); | 307 | extern long find_first_bit(const unsigned long *addr, unsigned long size); |
305 | extern long find_next_bit(const unsigned long * addr, long size, long offset); | 308 | extern long find_next_bit(const unsigned long *addr, long size, long offset); |
306 | 309 | ||
307 | /* return index of first bet set in val or max when no bit is set */ | 310 | /* return index of first bet set in val or max when no bit is set */ |
308 | static inline long __scanbit(unsigned long val, unsigned long max) | 311 | static inline long __scanbit(unsigned long val, unsigned long max) |
@@ -363,7 +366,7 @@ static inline void __clear_bit_string(unsigned long *bitmap, unsigned long i, | |||
363 | * | 366 | * |
364 | * Undefined if no zero exists, so code should check against ~0UL first. | 367 | * Undefined if no zero exists, so code should check against ~0UL first. |
365 | */ | 368 | */ |
366 | static __inline__ unsigned long ffz(unsigned long word) | 369 | static inline unsigned long ffz(unsigned long word) |
367 | { | 370 | { |
368 | __asm__("bsfq %1,%0" | 371 | __asm__("bsfq %1,%0" |
369 | :"=r" (word) | 372 | :"=r" (word) |
@@ -377,7 +380,7 @@ static __inline__ unsigned long ffz(unsigned long word) | |||
377 | * | 380 | * |
378 | * Undefined if no bit exists, so code should check against 0 first. | 381 | * Undefined if no bit exists, so code should check against 0 first. |
379 | */ | 382 | */ |
380 | static __inline__ unsigned long __ffs(unsigned long word) | 383 | static inline unsigned long __ffs(unsigned long word) |
381 | { | 384 | { |
382 | __asm__("bsfq %1,%0" | 385 | __asm__("bsfq %1,%0" |
383 | :"=r" (word) | 386 | :"=r" (word) |
@@ -391,7 +394,7 @@ static __inline__ unsigned long __ffs(unsigned long word) | |||
391 | * | 394 | * |
392 | * Undefined if no zero exists, so code should check against ~0UL first. | 395 | * Undefined if no zero exists, so code should check against ~0UL first. |
393 | */ | 396 | */ |
394 | static __inline__ unsigned long __fls(unsigned long word) | 397 | static inline unsigned long __fls(unsigned long word) |
395 | { | 398 | { |
396 | __asm__("bsrq %1,%0" | 399 | __asm__("bsrq %1,%0" |
397 | :"=r" (word) | 400 | :"=r" (word) |
@@ -411,7 +414,7 @@ static __inline__ unsigned long __fls(unsigned long word) | |||
411 | * the libc and compiler builtin ffs routines, therefore | 414 | * the libc and compiler builtin ffs routines, therefore |
412 | * differs in spirit from the above ffz (man ffs). | 415 | * differs in spirit from the above ffz (man ffs). |
413 | */ | 416 | */ |
414 | static __inline__ int ffs(int x) | 417 | static inline int ffs(int x) |
415 | { | 418 | { |
416 | int r; | 419 | int r; |
417 | 420 | ||
@@ -427,7 +430,7 @@ static __inline__ int ffs(int x) | |||
427 | * | 430 | * |
428 | * This is defined the same way as fls. | 431 | * This is defined the same way as fls. |
429 | */ | 432 | */ |
430 | static __inline__ int fls64(__u64 x) | 433 | static inline int fls64(__u64 x) |
431 | { | 434 | { |
432 | if (x == 0) | 435 | if (x == 0) |
433 | return 0; | 436 | return 0; |
@@ -440,7 +443,7 @@ static __inline__ int fls64(__u64 x) | |||
440 | * | 443 | * |
441 | * This is defined the same way as ffs. | 444 | * This is defined the same way as ffs. |
442 | */ | 445 | */ |
443 | static __inline__ int fls(int x) | 446 | static inline int fls(int x) |
444 | { | 447 | { |
445 | int r; | 448 | int r; |
446 | 449 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 24e08d1d900d..3c07d595979f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1201,7 +1201,7 @@ static inline int rt_prio(int prio) | |||
1201 | return 0; | 1201 | return 0; |
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | static inline int rt_task(const struct task_struct *p) | 1204 | static inline int rt_task(struct task_struct *p) |
1205 | { | 1205 | { |
1206 | return rt_prio(p->prio); | 1206 | return rt_prio(p->prio); |
1207 | } | 1207 | } |
@@ -1216,22 +1216,22 @@ static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp) | |||
1216 | tsk->signal->__pgrp = pgrp; | 1216 | tsk->signal->__pgrp = pgrp; |
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | static inline struct pid *task_pid(const struct task_struct *task) | 1219 | static inline struct pid *task_pid(struct task_struct *task) |
1220 | { | 1220 | { |
1221 | return task->pids[PIDTYPE_PID].pid; | 1221 | return task->pids[PIDTYPE_PID].pid; |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | static inline struct pid *task_tgid(const struct task_struct *task) | 1224 | static inline struct pid *task_tgid(struct task_struct *task) |
1225 | { | 1225 | { |
1226 | return task->group_leader->pids[PIDTYPE_PID].pid; | 1226 | return task->group_leader->pids[PIDTYPE_PID].pid; |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | static inline struct pid *task_pgrp(const struct task_struct *task) | 1229 | static inline struct pid *task_pgrp(struct task_struct *task) |
1230 | { | 1230 | { |
1231 | return task->group_leader->pids[PIDTYPE_PGID].pid; | 1231 | return task->group_leader->pids[PIDTYPE_PGID].pid; |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | static inline struct pid *task_session(const struct task_struct *task) | 1234 | static inline struct pid *task_session(struct task_struct *task) |
1235 | { | 1235 | { |
1236 | return task->group_leader->pids[PIDTYPE_SID].pid; | 1236 | return task->group_leader->pids[PIDTYPE_SID].pid; |
1237 | } | 1237 | } |
@@ -1260,7 +1260,7 @@ struct pid_namespace; | |||
1260 | * see also pid_nr() etc in include/linux/pid.h | 1260 | * see also pid_nr() etc in include/linux/pid.h |
1261 | */ | 1261 | */ |
1262 | 1262 | ||
1263 | static inline pid_t task_pid_nr(const struct task_struct *tsk) | 1263 | static inline pid_t task_pid_nr(struct task_struct *tsk) |
1264 | { | 1264 | { |
1265 | return tsk->pid; | 1265 | return tsk->pid; |
1266 | } | 1266 | } |
@@ -1273,7 +1273,7 @@ static inline pid_t task_pid_vnr(struct task_struct *tsk) | |||
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | 1275 | ||
1276 | static inline pid_t task_tgid_nr(const struct task_struct *tsk) | 1276 | static inline pid_t task_tgid_nr(struct task_struct *tsk) |
1277 | { | 1277 | { |
1278 | return tsk->tgid; | 1278 | return tsk->tgid; |
1279 | } | 1279 | } |
@@ -1286,7 +1286,7 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk) | |||
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | 1288 | ||
1289 | static inline pid_t task_pgrp_nr(const struct task_struct *tsk) | 1289 | static inline pid_t task_pgrp_nr(struct task_struct *tsk) |
1290 | { | 1290 | { |
1291 | return tsk->signal->__pgrp; | 1291 | return tsk->signal->__pgrp; |
1292 | } | 1292 | } |
@@ -1299,7 +1299,7 @@ static inline pid_t task_pgrp_vnr(struct task_struct *tsk) | |||
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | 1301 | ||
1302 | static inline pid_t task_session_nr(const struct task_struct *tsk) | 1302 | static inline pid_t task_session_nr(struct task_struct *tsk) |
1303 | { | 1303 | { |
1304 | return tsk->signal->__session; | 1304 | return tsk->signal->__session; |
1305 | } | 1305 | } |
@@ -1326,7 +1326,7 @@ static inline pid_t task_ppid_nr_ns(struct task_struct *tsk, | |||
1326 | * If pid_alive fails, then pointers within the task structure | 1326 | * If pid_alive fails, then pointers within the task structure |
1327 | * can be stale and must not be dereferenced. | 1327 | * can be stale and must not be dereferenced. |
1328 | */ | 1328 | */ |
1329 | static inline int pid_alive(const struct task_struct *p) | 1329 | static inline int pid_alive(struct task_struct *p) |
1330 | { | 1330 | { |
1331 | return p->pids[PIDTYPE_PID].pid != NULL; | 1331 | return p->pids[PIDTYPE_PID].pid != NULL; |
1332 | } | 1332 | } |
@@ -1337,7 +1337,7 @@ static inline int pid_alive(const struct task_struct *p) | |||
1337 | * | 1337 | * |
1338 | * Check if a task structure is the first user space task the kernel created. | 1338 | * Check if a task structure is the first user space task the kernel created. |
1339 | */ | 1339 | */ |
1340 | static inline int is_global_init(const struct task_struct *tsk) | 1340 | static inline int is_global_init(struct task_struct *tsk) |
1341 | { | 1341 | { |
1342 | return tsk->pid == 1; | 1342 | return tsk->pid == 1; |
1343 | } | 1343 | } |
@@ -1474,7 +1474,7 @@ extern int rt_mutex_getprio(struct task_struct *p); | |||
1474 | extern void rt_mutex_setprio(struct task_struct *p, int prio); | 1474 | extern void rt_mutex_setprio(struct task_struct *p, int prio); |
1475 | extern void rt_mutex_adjust_pi(struct task_struct *p); | 1475 | extern void rt_mutex_adjust_pi(struct task_struct *p); |
1476 | #else | 1476 | #else |
1477 | static inline int rt_mutex_getprio(const struct task_struct *p) | 1477 | static inline int rt_mutex_getprio(struct task_struct *p) |
1478 | { | 1478 | { |
1479 | return p->normal_prio; | 1479 | return p->normal_prio; |
1480 | } | 1480 | } |
@@ -1726,7 +1726,7 @@ extern void wait_task_inactive(struct task_struct * p); | |||
1726 | * all we care about is that we have a task with the appropriate | 1726 | * all we care about is that we have a task with the appropriate |
1727 | * pid, we don't actually care if we have the right task. | 1727 | * pid, we don't actually care if we have the right task. |
1728 | */ | 1728 | */ |
1729 | static inline int has_group_leader_pid(const struct task_struct *p) | 1729 | static inline int has_group_leader_pid(struct task_struct *p) |
1730 | { | 1730 | { |
1731 | return p->pid == p->tgid; | 1731 | return p->pid == p->tgid; |
1732 | } | 1732 | } |
@@ -1743,7 +1743,7 @@ static inline struct task_struct *next_thread(const struct task_struct *p) | |||
1743 | struct task_struct, thread_group); | 1743 | struct task_struct, thread_group); |
1744 | } | 1744 | } |
1745 | 1745 | ||
1746 | static inline int thread_group_empty(const struct task_struct *p) | 1746 | static inline int thread_group_empty(struct task_struct *p) |
1747 | { | 1747 | { |
1748 | return list_empty(&p->thread_group); | 1748 | return list_empty(&p->thread_group); |
1749 | } | 1749 | } |