aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/percpu.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-10-29 09:34:12 -0400
committerTejun Heo <tj@kernel.org>2009-10-29 09:34:12 -0400
commit0f5e4816dbf38ce9488e611ca2296925c1e90d5e (patch)
tree9c13079d21cb0c316db7e254222bca357ad7b41b /include/linux/percpu.h
parent64ef291f46d795917f32a0f5975e2b76f6fe206a (diff)
percpu: remove some sparse warnings
Make the following changes to remove some sparse warnings. * Make DEFINE_PER_CPU_SECTION() declare __pcpu_unique_* before defining it. * Annotate pcpu_extend_area_map() that it is entered with pcpu_lock held, releases it and then reacquires it. * Make percpu related macros use unique nested variable names. * While at it, add pcpu prefix to __size_call[_return]() macros as to-be-implemented sparse annotations will add percpu specific stuff to these macros. Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Christoph Lameter <cl@linux-foundation.org> Cc: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r--include/linux/percpu.h48
1 files changed, 24 insertions, 24 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 519d6876590..522f421ec21 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -226,20 +226,20 @@ do { \
226 226
227extern void __bad_size_call_parameter(void); 227extern void __bad_size_call_parameter(void);
228 228
229#define __size_call_return(stem, variable) \ 229#define __pcpu_size_call_return(stem, variable) \
230({ typeof(variable) ret__; \ 230({ typeof(variable) pscr_ret__; \
231 switch(sizeof(variable)) { \ 231 switch(sizeof(variable)) { \
232 case 1: ret__ = stem##1(variable);break; \ 232 case 1: pscr_ret__ = stem##1(variable);break; \
233 case 2: ret__ = stem##2(variable);break; \ 233 case 2: pscr_ret__ = stem##2(variable);break; \
234 case 4: ret__ = stem##4(variable);break; \ 234 case 4: pscr_ret__ = stem##4(variable);break; \
235 case 8: ret__ = stem##8(variable);break; \ 235 case 8: pscr_ret__ = stem##8(variable);break; \
236 default: \ 236 default: \
237 __bad_size_call_parameter();break; \ 237 __bad_size_call_parameter();break; \
238 } \ 238 } \
239 ret__; \ 239 pscr_ret__; \
240}) 240})
241 241
242#define __size_call(stem, variable, ...) \ 242#define __pcpu_size_call(stem, variable, ...) \
243do { \ 243do { \
244 switch(sizeof(variable)) { \ 244 switch(sizeof(variable)) { \
245 case 1: stem##1(variable, __VA_ARGS__);break; \ 245 case 1: stem##1(variable, __VA_ARGS__);break; \
@@ -299,7 +299,7 @@ do { \
299# ifndef this_cpu_read_8 299# ifndef this_cpu_read_8
300# define this_cpu_read_8(pcp) _this_cpu_generic_read(pcp) 300# define this_cpu_read_8(pcp) _this_cpu_generic_read(pcp)
301# endif 301# endif
302# define this_cpu_read(pcp) __size_call_return(this_cpu_read_, (pcp)) 302# define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, (pcp))
303#endif 303#endif
304 304
305#define _this_cpu_generic_to_op(pcp, val, op) \ 305#define _this_cpu_generic_to_op(pcp, val, op) \
@@ -322,7 +322,7 @@ do { \
322# ifndef this_cpu_write_8 322# ifndef this_cpu_write_8
323# define this_cpu_write_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) 323# define this_cpu_write_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
324# endif 324# endif
325# define this_cpu_write(pcp, val) __size_call(this_cpu_write_, (pcp), (val)) 325# define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, (pcp), (val))
326#endif 326#endif
327 327
328#ifndef this_cpu_add 328#ifndef this_cpu_add
@@ -338,7 +338,7 @@ do { \
338# ifndef this_cpu_add_8 338# ifndef this_cpu_add_8
339# define this_cpu_add_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) 339# define this_cpu_add_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
340# endif 340# endif
341# define this_cpu_add(pcp, val) __size_call(this_cpu_add_, (pcp), (val)) 341# define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, (pcp), (val))
342#endif 342#endif
343 343
344#ifndef this_cpu_sub 344#ifndef this_cpu_sub
@@ -366,7 +366,7 @@ do { \
366# ifndef this_cpu_and_8 366# ifndef this_cpu_and_8
367# define this_cpu_and_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) 367# define this_cpu_and_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
368# endif 368# endif
369# define this_cpu_and(pcp, val) __size_call(this_cpu_and_, (pcp), (val)) 369# define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, (pcp), (val))
370#endif 370#endif
371 371
372#ifndef this_cpu_or 372#ifndef this_cpu_or
@@ -382,7 +382,7 @@ do { \
382# ifndef this_cpu_or_8 382# ifndef this_cpu_or_8
383# define this_cpu_or_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) 383# define this_cpu_or_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
384# endif 384# endif
385# define this_cpu_or(pcp, val) __size_call(this_cpu_or_, (pcp), (val)) 385# define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val))
386#endif 386#endif
387 387
388#ifndef this_cpu_xor 388#ifndef this_cpu_xor
@@ -398,7 +398,7 @@ do { \
398# ifndef this_cpu_xor_8 398# ifndef this_cpu_xor_8
399# define this_cpu_xor_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) 399# define this_cpu_xor_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=)
400# endif 400# endif
401# define this_cpu_xor(pcp, val) __size_call(this_cpu_or_, (pcp), (val)) 401# define this_cpu_xor(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val))
402#endif 402#endif
403 403
404/* 404/*
@@ -428,7 +428,7 @@ do { \
428# ifndef __this_cpu_read_8 428# ifndef __this_cpu_read_8
429# define __this_cpu_read_8(pcp) (*__this_cpu_ptr(&(pcp))) 429# define __this_cpu_read_8(pcp) (*__this_cpu_ptr(&(pcp)))
430# endif 430# endif
431# define __this_cpu_read(pcp) __size_call_return(__this_cpu_read_, (pcp)) 431# define __this_cpu_read(pcp) __pcpu_size_call_return(__this_cpu_read_, (pcp))
432#endif 432#endif
433 433
434#define __this_cpu_generic_to_op(pcp, val, op) \ 434#define __this_cpu_generic_to_op(pcp, val, op) \
@@ -449,7 +449,7 @@ do { \
449# ifndef __this_cpu_write_8 449# ifndef __this_cpu_write_8
450# define __this_cpu_write_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 450# define __this_cpu_write_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), =)
451# endif 451# endif
452# define __this_cpu_write(pcp, val) __size_call(__this_cpu_write_, (pcp), (val)) 452# define __this_cpu_write(pcp, val) __pcpu_size_call(__this_cpu_write_, (pcp), (val))
453#endif 453#endif
454 454
455#ifndef __this_cpu_add 455#ifndef __this_cpu_add
@@ -465,7 +465,7 @@ do { \
465# ifndef __this_cpu_add_8 465# ifndef __this_cpu_add_8
466# define __this_cpu_add_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 466# define __this_cpu_add_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=)
467# endif 467# endif
468# define __this_cpu_add(pcp, val) __size_call(__this_cpu_add_, (pcp), (val)) 468# define __this_cpu_add(pcp, val) __pcpu_size_call(__this_cpu_add_, (pcp), (val))
469#endif 469#endif
470 470
471#ifndef __this_cpu_sub 471#ifndef __this_cpu_sub
@@ -493,7 +493,7 @@ do { \
493# ifndef __this_cpu_and_8 493# ifndef __this_cpu_and_8
494# define __this_cpu_and_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 494# define __this_cpu_and_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=)
495# endif 495# endif
496# define __this_cpu_and(pcp, val) __size_call(__this_cpu_and_, (pcp), (val)) 496# define __this_cpu_and(pcp, val) __pcpu_size_call(__this_cpu_and_, (pcp), (val))
497#endif 497#endif
498 498
499#ifndef __this_cpu_or 499#ifndef __this_cpu_or
@@ -509,7 +509,7 @@ do { \
509# ifndef __this_cpu_or_8 509# ifndef __this_cpu_or_8
510# define __this_cpu_or_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 510# define __this_cpu_or_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=)
511# endif 511# endif
512# define __this_cpu_or(pcp, val) __size_call(__this_cpu_or_, (pcp), (val)) 512# define __this_cpu_or(pcp, val) __pcpu_size_call(__this_cpu_or_, (pcp), (val))
513#endif 513#endif
514 514
515#ifndef __this_cpu_xor 515#ifndef __this_cpu_xor
@@ -525,7 +525,7 @@ do { \
525# ifndef __this_cpu_xor_8 525# ifndef __this_cpu_xor_8
526# define __this_cpu_xor_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) 526# define __this_cpu_xor_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=)
527# endif 527# endif
528# define __this_cpu_xor(pcp, val) __size_call(__this_cpu_xor_, (pcp), (val)) 528# define __this_cpu_xor(pcp, val) __pcpu_size_call(__this_cpu_xor_, (pcp), (val))
529#endif 529#endif
530 530
531/* 531/*
@@ -556,7 +556,7 @@ do { \
556# ifndef irqsafe_cpu_add_8 556# ifndef irqsafe_cpu_add_8
557# define irqsafe_cpu_add_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) 557# define irqsafe_cpu_add_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
558# endif 558# endif
559# define irqsafe_cpu_add(pcp, val) __size_call(irqsafe_cpu_add_, (pcp), (val)) 559# define irqsafe_cpu_add(pcp, val) __pcpu_size_call(irqsafe_cpu_add_, (pcp), (val))
560#endif 560#endif
561 561
562#ifndef irqsafe_cpu_sub 562#ifndef irqsafe_cpu_sub
@@ -584,7 +584,7 @@ do { \
584# ifndef irqsafe_cpu_and_8 584# ifndef irqsafe_cpu_and_8
585# define irqsafe_cpu_and_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) 585# define irqsafe_cpu_and_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
586# endif 586# endif
587# define irqsafe_cpu_and(pcp, val) __size_call(irqsafe_cpu_and_, (val)) 587# define irqsafe_cpu_and(pcp, val) __pcpu_size_call(irqsafe_cpu_and_, (val))
588#endif 588#endif
589 589
590#ifndef irqsafe_cpu_or 590#ifndef irqsafe_cpu_or
@@ -600,7 +600,7 @@ do { \
600# ifndef irqsafe_cpu_or_8 600# ifndef irqsafe_cpu_or_8
601# define irqsafe_cpu_or_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) 601# define irqsafe_cpu_or_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
602# endif 602# endif
603# define irqsafe_cpu_or(pcp, val) __size_call(irqsafe_cpu_or_, (val)) 603# define irqsafe_cpu_or(pcp, val) __pcpu_size_call(irqsafe_cpu_or_, (val))
604#endif 604#endif
605 605
606#ifndef irqsafe_cpu_xor 606#ifndef irqsafe_cpu_xor
@@ -616,7 +616,7 @@ do { \
616# ifndef irqsafe_cpu_xor_8 616# ifndef irqsafe_cpu_xor_8
617# define irqsafe_cpu_xor_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) 617# define irqsafe_cpu_xor_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
618# endif 618# endif
619# define irqsafe_cpu_xor(pcp, val) __size_call(irqsafe_cpu_xor_, (val)) 619# define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val))
620#endif 620#endif
621 621
622#endif /* __LINUX_PERCPU_H */ 622#endif /* __LINUX_PERCPU_H */