linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write
       [not found] ` <1285063280-4057-10-git-send-email-manjugk@ti.com>
@ 2010-10-07 12:17   ` Menon, Nishanth
  2010-10-07 18:56     ` Russell King - ARM Linux
  2010-10-07 17:39   ` Vimal Singh
  1 sibling, 1 reply; 8+ messages in thread
From: Menon, Nishanth @ 2010-10-07 12:17 UTC (permalink / raw)
  To: G, Manjunath Kondaiah, linux-omap@vger.kernel.org
  Cc: linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org


> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of G, Manjunath Kondaiah
> Sent: Tuesday, September 21, 2010 5:01 AM
> To: linux-omap@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org; linux-mtd@lists.infradead.org
> Subject: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw
> read/write
> 
> Following sparse warnings exists due to use of writel/w and readl/w
> functions.
> 
> This patch fixes the sparse warnings by converting readl/w functions usage
> into
> __raw_readl/__raw_readw functions.

Apologies on bringing up an old topic here -> Is'nt it better to fix readl/w or writel/w than replacing it with __raw_readl/w etc?



Regards,
Nishanth Menon

[...]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write
       [not found] ` <1285063280-4057-10-git-send-email-manjugk@ti.com>
  2010-10-07 12:17   ` [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write Menon, Nishanth
@ 2010-10-07 17:39   ` Vimal Singh
  1 sibling, 0 replies; 8+ messages in thread
From: Vimal Singh @ 2010-10-07 17:39 UTC (permalink / raw)
  To: G, Manjunath Kondaiah; +Cc: linux-omap, linux-mtd, linux-arm-kernel

On Tue, Sep 21, 2010 at 3:31 PM, G, Manjunath Kondaiah <manjugk@ti.com> wrote:
> Following sparse warnings exists due to use of writel/w and readl/w functions.
>
> This patch fixes the sparse warnings by converting readl/w functions usage into
> __raw_readl/__raw_readw functions.
>
[...]
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c
> @@ -481,7 +481,7 @@ static int omap_verify_buf(struct mtd_info *mtd, const u_char * buf, int len)
>
>        len >>= 1;
>        while (len--) {
> -               if (*p++ != cpu_to_le16(readw(info->nand.IO_ADDR_R)))
> +               if (*p++ != cpu_to_le16(__raw_readw(info->nand.IO_ADDR_R)))

There was an old comment to remove use of 'cpu_to_le16' from driver, I
just missed it. Can you rather use 'ioread16_rep' for reading data.

-- 
Regards,
Vimal Singh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write
  2010-10-07 12:17   ` [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write Menon, Nishanth
@ 2010-10-07 18:56     ` Russell King - ARM Linux
  2010-10-07 19:50       ` Nishanth Menon
  0 siblings, 1 reply; 8+ messages in thread
From: Russell King - ARM Linux @ 2010-10-07 18:56 UTC (permalink / raw)
  To: Menon, Nishanth
  Cc: G, Manjunath Kondaiah, linux-omap@vger.kernel.org,
	linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org

On Thu, Oct 07, 2010 at 07:17:08AM -0500, Menon, Nishanth wrote:
> 
> > -----Original Message-----
> > From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> > owner@vger.kernel.org] On Behalf Of G, Manjunath Kondaiah
> > Sent: Tuesday, September 21, 2010 5:01 AM
> > To: linux-omap@vger.kernel.org
> > Cc: linux-arm-kernel@lists.infradead.org; linux-mtd@lists.infradead.org
> > Subject: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw
> > read/write
> > 
> > Following sparse warnings exists due to use of writel/w and readl/w
> > functions.
> > 
> > This patch fixes the sparse warnings by converting readl/w functions usage
> > into
> > __raw_readl/__raw_readw functions.
> 
> Apologies on bringing up an old topic here -> Is'nt it better to fix
> readl/w or writel/w than replacing it with __raw_readl/w etc?

No.  If you're getting sparse warnings its because _you_ are using
readl/writel wrongly.

They take a void __iomem pointer, not a u32, unsigned long, int, or
even a void pointer.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write
  2010-10-07 18:56     ` Russell King - ARM Linux
@ 2010-10-07 19:50       ` Nishanth Menon
  2010-10-25  0:01         ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Nishanth Menon @ 2010-10-07 19:50 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: G, Manjunath Kondaiah, linux-omap@vger.kernel.org,
	linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org

Russell King - ARM Linux had written, on 10/07/2010 01:56 PM, the following:
> On Thu, Oct 07, 2010 at 07:17:08AM -0500, Menon, Nishanth wrote:
>>> -----Original Message-----
>>> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
>>> owner@vger.kernel.org] On Behalf Of G, Manjunath Kondaiah
>>> Sent: Tuesday, September 21, 2010 5:01 AM
>>> To: linux-omap@vger.kernel.org
>>> Cc: linux-arm-kernel@lists.infradead.org; linux-mtd@lists.infradead.org
>>> Subject: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw
>>> read/write
>>>
>>> Following sparse warnings exists due to use of writel/w and readl/w
>>> functions.
>>>
>>> This patch fixes the sparse warnings by converting readl/w functions usage
>>> into
>>> __raw_readl/__raw_readw functions.
>> Apologies on bringing up an old topic here -> Is'nt it better to fix
>> readl/w or writel/w than replacing it with __raw_readl/w etc?
> 
> No.  If you're getting sparse warnings its because _you_ are using
> readl/writel wrongly.
> 
> They take a void __iomem pointer, not a u32, unsigned long, int, or
> even a void pointer.
void __iomem *p;
...

readl(p);

unrolls to:
({ u32 __v = ({ u32 __v = (( __u32)(__le32)(( __le32) ((void)0, 
*(volatile unsigned int *)((p))))); __v; }); __asm__ __volatile__ ("mcr 
p15,
, %0, c7, c10, 5" : : "r" (0) : "memory"); __v; });

({ u32 __v = ({ u32 __v

seems to be the obvious cause of sparse warnings such as that attempted 
to be fixed in [1]

  warning: symbol '__v' shadows an earlier one

my comment being that by moving {read,write}[wlb] to __raw versions dont 
solve the real issue of namespace here. fix should be in 
arch/arm/include/asm/io.h IMHO. so that there are no overlaps as this.

[1]http://marc.info/?l=linux-omap&m=128506333803725&w=2

-- 
Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write
  2010-10-07 19:50       ` Nishanth Menon
@ 2010-10-25  0:01         ` David Woodhouse
  2010-10-25  5:34           ` G, Manjunath Kondaiah
  2010-10-25  7:54           ` Artem Bityutskiy
  0 siblings, 2 replies; 8+ messages in thread
From: David Woodhouse @ 2010-10-25  0:01 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: G, Manjunath Kondaiah, linux-omap@vger.kernel.org,
	Russell King - ARM Linux, linux-arm-kernel@lists.infradead.org,
	linux-mtd@lists.infradead.org

On Thu, 2010-10-07 at 14:50 -0500, Nishanth Menon wrote:
> my comment being that by moving {read,write}[wlb] to __raw versions dont 
> solve the real issue of namespace here. fix should be in 
> arch/arm/include/asm/io.h IMHO. so that there are no overlaps as this. 

Indeed. This patch is complete nonsense.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write
  2010-10-25  0:01         ` David Woodhouse
@ 2010-10-25  5:34           ` G, Manjunath Kondaiah
  2010-10-25 10:11             ` David Woodhouse
  2010-10-25  7:54           ` Artem Bityutskiy
  1 sibling, 1 reply; 8+ messages in thread
From: G, Manjunath Kondaiah @ 2010-10-25  5:34 UTC (permalink / raw)
  To: David Woodhouse, Menon, Nishanth
  Cc: linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org,
	Russell King - ARM Linux, linux-arm-kernel@lists.infradead.org

David,

> -----Original Message-----
> From: David Woodhouse [mailto:dwmw2@infradead.org] 
> Sent: Monday, October 25, 2010 5:32 AM
> To: Menon, Nishanth
> Cc: Russell King - ARM Linux; G, Manjunath Kondaiah; 
> linux-omap@vger.kernel.org; linux-mtd@lists.infradead.org; 
> linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH v2 09/10] OMAP2/3: Convert write/read 
> functions to raw read/write
> 
> On Thu, 2010-10-07 at 14:50 -0500, Nishanth Menon wrote:
> > my comment being that by moving {read,write}[wlb] to __raw versions 
> > dont solve the real issue of namespace here. fix should be in 
> > arch/arm/include/asm/io.h IMHO. so that there are no 
> overlaps as this.
> 
> Indeed. This patch is complete nonsense.

nonsense? There are two types of fixes proposed to fix these sparse warnings.
1. with this patch
2. fixing in io.h
https://patchwork.kernel.org/patch/250171/

1st option is already merged with 2.6.37 merge window.

If 2 get accepted, all __raw_read/write will get replaced with readl/writel.

Apart from those two, do you have any other alternate idea to fix these sparse warnings?

-Manjunath

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write
  2010-10-25  0:01         ` David Woodhouse
  2010-10-25  5:34           ` G, Manjunath Kondaiah
@ 2010-10-25  7:54           ` Artem Bityutskiy
  1 sibling, 0 replies; 8+ messages in thread
From: Artem Bityutskiy @ 2010-10-25  7:54 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Nishanth Menon, Russell King - ARM Linux, G, Manjunath Kondaiah,
	linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org

On Mon, 2010-10-25 at 01:01 +0100, David Woodhouse wrote:
> On Thu, 2010-10-07 at 14:50 -0500, Nishanth Menon wrote:
> > my comment being that by moving {read,write}[wlb] to __raw versions dont 
> > solve the real issue of namespace here. fix should be in 
> > arch/arm/include/asm/io.h IMHO. so that there are no overlaps as this. 
> 
> Indeed. This patch is complete nonsense.

Removing from my l2 tree.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write
  2010-10-25  5:34           ` G, Manjunath Kondaiah
@ 2010-10-25 10:11             ` David Woodhouse
  0 siblings, 0 replies; 8+ messages in thread
From: David Woodhouse @ 2010-10-25 10:11 UTC (permalink / raw)
  To: G, Manjunath Kondaiah
  Cc: Menon, Nishanth, linux-mtd@lists.infradead.org,
	linux-omap@vger.kernel.org, Russell King - ARM Linux,
	linux-arm-kernel@lists.infradead.org

On Mon, 2010-10-25 at 11:04 +0530, G, Manjunath Kondaiah wrote:
> David,
> 
> > -----Original Message-----
> > From: David Woodhouse [mailto:dwmw2@infradead.org] 
> > Sent: Monday, October 25, 2010 5:32 AM
> > To: Menon, Nishanth
> > Cc: Russell King - ARM Linux; G, Manjunath Kondaiah; 
> > linux-omap@vger.kernel.org; linux-mtd@lists.infradead.org; 
> > linux-arm-kernel@lists.infradead.org
> > Subject: Re: [PATCH v2 09/10] OMAP2/3: Convert write/read 
> > functions to raw read/write
> > 
> > On Thu, 2010-10-07 at 14:50 -0500, Nishanth Menon wrote:
> > > my comment being that by moving {read,write}[wlb] to __raw versions 
> > > dont solve the real issue of namespace here. fix should be in 
> > > arch/arm/include/asm/io.h IMHO. so that there are no 
> > overlaps as this.
> > 
> > Indeed. This patch is complete nonsense.
> 
> nonsense? There are two types of fixes proposed to fix these sparse warnings.
> 1. with this patch
> 2. fixing in io.h
> https://patchwork.kernel.org/patch/250171/
> 
> 1st option is already merged with 2.6.37 merge window.
> 
> If 2 get accepted, all __raw_read/write will get replaced with readl/writel.
> 
> Apart from those two, do you have any other alternate idea to fix these sparse warnings?

The latter is obviously the better approach. The problem that sparse is
complaining about is the fact that you have two nested C blocks, both of
which contain a local variable called '__v'. By changing the variable
names so that they're actually unique, we fix the real problem.

The answer is not that *all* drivers which call cpu_to_le16(readw())
must be changed, which is what you seem to have assumed. And you
*certainly* can't change them to use __raw_readw(), which has
*different* semantics (and endianness in some cases), without a clear
comment in the changelog entry saying *why* that change was OK.

-- 
dwmw2

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-10-25 10:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1285063280-4057-1-git-send-email-manjugk@ti.com>
     [not found] ` <1285063280-4057-10-git-send-email-manjugk@ti.com>
2010-10-07 12:17   ` [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write Menon, Nishanth
2010-10-07 18:56     ` Russell King - ARM Linux
2010-10-07 19:50       ` Nishanth Menon
2010-10-25  0:01         ` David Woodhouse
2010-10-25  5:34           ` G, Manjunath Kondaiah
2010-10-25 10:11             ` David Woodhouse
2010-10-25  7:54           ` Artem Bityutskiy
2010-10-07 17:39   ` Vimal Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).