Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r



Hi, Chris,

From: Hirokazu Takata <takata@xxxxxxxxxxxxxx>
Date: Wed, 22 Aug 2007 10:56:54 +0900
From: Chris Snook <csnook@xxxxxxxxxx>
Date: Mon, 13 Aug 2007 07:24:52 -0400
From: Chris Snook <csnook@xxxxxxxxxx>

Use volatile consistently in atomic.h on m32r.

Signed-off-by: Chris Snook <csnook@xxxxxxxxxx>

Thanks,

Acked-by: Hirokazu Takata <takata@xxxxxxxxxxxxxx>

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 <takata@xxxxxxxxxxxxxx>
Cc: Chris Snook <csnook@xxxxxxxxxx>
---
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 <takata@xxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • [HPADM] [Fwd: HP-UX PATCH NOTIFY: Patch PHKL_25475 Has Warnings]
    ... Hewlett-Packard has issued a new warning for the following patch: ... and WorkLoad Manager (WLM) applications. ... PRM and WLM can be temporarily ...
    (HP-UX-Admin)
  • Re: [PATCH]: Cleanup: Remove trivial gcc format string warnings when compiling with -Wformat-
    ... Here's the patch that I get when I blindly patch every single location ... that emits this warning. ... and no format arguments ...
    (Linux-Kernel)
  • Re: pcmcia ioctl removal
    ... The patch above is the removal of cardmgr support. ... that that couldn't be done since there had been no warning about its ... the features removal file contains the following: ...
    (Linux-Kernel)
  • WARNING: /proc could not be mounted
    ... I am in the process of configuring a v210 system with Solaris 9 9/04 ... and then applying the patch cluster which contains the kernel patch ... WARNING: forceload of misc/md_trans failed ... but I get a Bus Error when I attempt it. ...
    (SunManagers)
  • Problems with fakephp
    ... we didn't know that anyone was using fakephp for real work. ... It's marketed as being a way for developers to test their device drivers ... I made a patch and fixed it. ... interface, that's been around for years, with no warning is ok, or assumes ...
    (Linux-Kernel)