Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755888AbXHVFAy (ORCPT ); Wed, 22 Aug 2007 01:00:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752011AbXHVFAp (ORCPT ); Wed, 22 Aug 2007 01:00:45 -0400 Received: from mail.renesas.com ([202.234.163.13]:51583 "EHLO mail02.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751910AbXHVFAo (ORCPT ); Wed, 22 Aug 2007 01:00:44 -0400 Date: Wed, 22 Aug 2007 14:00:35 +0900 From: Hirokazu Takata Subject: Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r In-reply-to: To: Chris Snook Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , akpm@linux-foundation.org, paulmck@linux.vnet.ibm.com, Segher Boessenkool , "Luck, Tony" , Chris Friesen , "Robert P. J. Day" Message-id: MIME-version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-type: text/plain; charset=US-ASCII User-Agent: Wanderlust/2.14.0 (Africa) Emacs/21.4 Mule/5.0 (SAKAKI) Renesas-ECN: H07-0010RT References: <46C03885.7000109@redhat.com> <20070813112452.GK24018@shell.boston.redhat.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3233 Lines: 91 Hi, Chris, From: Hirokazu Takata Date: Wed, 22 Aug 2007 10:56:54 +0900 > From: Chris Snook > Date: Mon, 13 Aug 2007 07:24:52 -0400 > > From: Chris Snook > > > > Use volatile consistently in atomic.h on m32r. > > > > Signed-off-by: Chris Snook > > Thanks, > > Acked-by: Hirokazu Takata Hmmm.. It seems my reply was overhasty. Applying the above patch, I have many warning messages like this: <-- snip --> ... CC kernel/sched.o In file included from /project/m32r-linux/kernel/work/linux-2.6_dev.git/include/linux/netlink.h:139, from /project/m32r-linux/kernel/work/linux-2.6_dev.git/include/linux/genetlink.h:4, from /project/m32r-linux/kernel/work/linux-2.6_dev.git/include/net/genetlink.h:4, from /project/m32r-linux/kernel/work/linux-2.6_dev.git/include/linux/taskstats_kern.h:12, from /project/m32r-linux/kernel/work/linux-2.6_dev.git/include/linux/delayacct.h:21, from /project/m32r-linux/kernel/work/linux-2.6_dev.git/kernel/sched.c:61: /project/m32r-linux/kernel/work/linux-2.6_dev.git/include/linux/skbuff.h: In function 'skb_shared': /project/m32r-linux/kernel/work/linux-2.6_dev.git/include/linux/skbuff.h:521: warning: passing argument 1 of 'atomic_read' discards qualifiers from pointer target type ... <-- snip --> In this case, it is because stb_shared() is defined with a parameter with "const" qualifier, in include/linux/skbuff.h. static inline int skb_shared(const struct sk_buff *skb) { return atomic_read(&skb->users) != 1; } I think the parameter of atomic_read() should have "const" qualifier to avoid these warnings, and IMHO this modification might be worth applying on other archs. Here is an additional patch to revise the previous one for m32r. I also tried to rewrite it with inline asm code, but the kernel text size bacame roughly 2kB larger. So, I prefer C version. Thanks, -- Takata [PATCH] m32r: Add "const" qualifier to the parameter of atomic_read() Update atomic_read() to avoid the following warning of gcc-4.1.x: warning: passing argument 1 of 'atomic_read' discards qualifiers from pointer target type Signed-off-by: Hirokazu Takata Cc: Chris Snook --- include/asm-m32r/atomic.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/asm-m32r/atomic.h b/include/asm-m32r/atomic.h index ba19689..9d46f86 100644 --- a/include/asm-m32r/atomic.h +++ b/include/asm-m32r/atomic.h @@ -32,7 +32,7 @@ typedef struct { int counter; } atomic_t; * * Atomically reads the value of @v. */ -static __inline__ int atomic_read(atomic_t *v) +static __inline__ int atomic_read(const atomic_t *v) { return *(volatile int *)&v->counter; } -- 1.5.2.4 -- Hirokazu Takata Linux/M32R Project: http://www.linux-m32r.org/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/