Skip to contentSkip to conversation

linux-next: percpu tree build warning

PATCH New Stephen Rothwell 3 participants 3 messages Nov 12, 2009 – Nov 18, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

Today's linux-next build (powerpc ppc64_defconfig) produced this warning:

drivers/net/loopback.c: In function 'loopback_get_stats':
drivers/net/loopback.c:109: warning: initialization discards qualifiers from pointer target type

The line in question is:

	lb_stats = per_cpu_ptr(pcpu_lstats, i);

Where "lb_stats" and "pcpu_lstats" are both "const struct pcpu_lstats *". I guess this is because of __verify_pcpu_ptr().

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#1 lore raw
Quoted 7 lines · Stephen Rothwell

Hi all,

Today's linux-next build (powerpc ppc64_defconfig) produced this warning:

drivers/net/loopback.c: In function 'loopback_get_stats':
drivers/net/loopback.c:109: warning: initialization discards qualifiers from pointer target type

Quoted 6 lines

The line in question is:

	lb_stats = per_cpu_ptr(pcpu_lstats, i);

Where "lb_stats" and "pcpu_lstats" are both "const struct pcpu_lstats *". I guess this is because of __verify_pcpu_ptr().

hmm... pcpu_lstats needs to be correctly qualified I guess.

maintainer
#2 lore raw

PATCH 1/1 percpu: remove compile warnings caused by __verify_pcpu_ptr()

In reply to Stephen Rothwell

If percpu pointer is const, __verify_pcpu_ptr() triggers warnings like the following.

drivers/net/loopback.c: In function 'loopback_get_stats':
drivers/net/loopback.c:109: warning: initialization discards qualifiers from pointer target type

Fix it by adding const to the verification target pointer used in __verify_pcpu_ptr().

---
Sorry about the delay. Patch committed to percpu#for-next.

Thanks.

 include/linux/percpu-defs.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/percpu-defs.h +1 -1
index 1fa36eb..68567c0 100644
@@ -24,7 +24,7 @@
  * input parameter is a percpu pointer.
  */
 #define __verify_pcpu_ptr(ptr)	do {					\
-	void __percpu *__vpp_verify = (typeof(ptr))NULL;		\
+	const void __percpu *__vpp_verify = (typeof(ptr))NULL;		\
 	(void)__vpp_verify;						\
 } while (0)
 
Signature · 1 line
1.6.4.2