2009-11-12 06:46:01

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: percpu tree build warning

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().

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (535.00 B)
(No filename) (198.00 B)
Download all attachments

2009-11-12 15:19:19

by Christoph Lameter

[permalink] [raw]
Subject: Re: linux-next: percpu tree build warning

On Thu, 12 Nov 2009, Stephen Rothwell wrote:

> 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().

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

2009-11-18 09:06:21

by Tejun Heo

[permalink] [raw]
Subject: [PATCH percpu#for-next] percpu: remove compile warnings caused by __verify_pcpu_ptr()

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().

Signed-off-by: Tejun Heo <[email protected]>
Reported-by: Stephen Rothwell <[email protected]>
---
Sorry about the delay. Patch committed to percpu#for-next.

Thanks.

include/linux/percpu-defs.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 1fa36eb..68567c0 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -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)

--
1.6.4.2