Commit 0c83f291 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] percpu: fix compile warning for UP builds

A typical construct is:

	int cpu = get_cpu();

	foo = per_cpu(bar, cpu);
	put_cpu();

but this generates a compiler warning on uniprocessor builds: unused
variable `cpu'.

Add a dummy ref to `cpu' to per_cpu() to prevent this.
parent f98bf5ff
...@@ -25,7 +25,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; ...@@ -25,7 +25,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
__typeof__(type) name##__per_cpu __typeof__(type) name##__per_cpu
#endif #endif
#define per_cpu(var, cpu) var##__per_cpu #define per_cpu(var, cpu) ((void)cpu, var##__per_cpu)
#define __get_cpu_var(var) var##__per_cpu #define __get_cpu_var(var) var##__per_cpu
#endif #endif
......
...@@ -29,7 +29,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; ...@@ -29,7 +29,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
# define per_cpu(var, cpu) (*RELOC_HIDE(&var##__per_cpu, __per_cpu_offset[cpu])) # define per_cpu(var, cpu) (*RELOC_HIDE(&var##__per_cpu, __per_cpu_offset[cpu]))
#else #else
# define per_cpu(var, cpu) __get_cpu_var(var) # define per_cpu(var, cpu) ((void)cpu, __get_cpu_var(var))
#endif #endif
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
......
...@@ -34,7 +34,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; ...@@ -34,7 +34,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
__typeof__(type) name##__per_cpu __typeof__(type) name##__per_cpu
#endif #endif
#define per_cpu(var, cpu) var##__per_cpu #define per_cpu(var, cpu) ((void)cpu, var##__per_cpu)
#define __get_cpu_var(var) var##__per_cpu #define __get_cpu_var(var) var##__per_cpu
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment