Patchwork [1/3] Fixing compilation warning for 'nand/omap2.c'

login
register
mail settings
Submitter vimal singh
Date Nov. 3, 2009, 9:01 a.m.
Message ID <ce9ab5790911030101t256e49e8iaf26c733e6472157@mail.gmail.com>
Download mbox | patch
Permalink /patch/37493/
State New, archived
Headers show

Comments

vimal singh - Nov. 3, 2009, 9:01 a.m.
>> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
>> index 090ab87..92573d5 100644
>> --- a/drivers/mtd/nand/omap2.c
>> +++ b/drivers/mtd/nand/omap2.c
>> @@ -501,11 +501,13 @@ static void omap_read_buf_dma_pref(struct
>> mtd_info *mtd, u_char
>
> :-) It is the same again.
>
> Try to send the e-mail to yourself, then save it and apply with git-am.
> If it works, send to the mailing list.

Below patch applies. Sorry for noise... :(

Thanks,
vimal


From eebbd81141b196af2dc3f7a2650ce16b6b0d76ae Mon Sep 17 00:00:00 2001
From: Vimal Singh <vimalsingh@ti.com>
Date: Fri, 30 Oct 2009 11:31:34 +0530
Subject: [PATCH] Fixing compilation warning for 'nand/omap2.c'

Fixing below warning in compilation:
drivers/mtd/nand/omap2.c: In function 'omap_write_buf_dma_pref':
drivers/mtd/nand/omap2.c:508: warning: passing argument 2 of
'omap_nand_dma_transfer' discards qualifiers from pointer target type

Signed-off-by: Vimal Singh <vimalsingh@ti.com>
---
 drivers/mtd/nand/omap2.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Artem Bityutskiy - Nov. 10, 2009, 2:20 p.m.
On Tue, 2009-11-03 at 14:31 +0530, Vimal Singh wrote:
> >> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> >> index 090ab87..92573d5 100644
> >> --- a/drivers/mtd/nand/omap2.c
> >> +++ b/drivers/mtd/nand/omap2.c
> >> @@ -501,11 +501,13 @@ static void omap_read_buf_dma_pref(struct
> >> mtd_info *mtd, u_char
> >
> > :-) It is the same again.
> >
> > Try to send the e-mail to yourself, then save it and apply with git-am.
> > If it works, send to the mailing list.
> 
> Below patch applies. Sorry for noise... :(
> 
> Thanks,
> vimal
> 
> 
> From eebbd81141b196af2dc3f7a2650ce16b6b0d76ae Mon Sep 17 00:00:00 2001
> From: Vimal Singh <vimalsingh@ti.com>
> Date: Fri, 30 Oct 2009 11:31:34 +0530
> Subject: [PATCH] Fixing compilation warning for 'nand/omap2.c'
> 
> Fixing below warning in compilation:
> drivers/mtd/nand/omap2.c: In function 'omap_write_buf_dma_pref':
> drivers/mtd/nand/omap2.c:508: warning: passing argument 2 of
> 'omap_nand_dma_transfer' discards qualifiers from pointer target type
> 
> Signed-off-by: Vimal Singh <vimalsingh@ti.com>
> ---
>  drivers/mtd/nand/omap2.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index 090ab87..92573d5 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c
> @@ -501,11 +501,13 @@ static void omap_read_buf_dma_pref(struct
>  static void omap_write_buf_dma_pref(struct mtd_info *mtd,
>  					const u_char *buf, int len)
>  {
> +	u_char *p = (u_char *)buf;
> +
>  	if (len <= mtd->oobsize)
> -		omap_write_buf_pref(mtd, buf, len);
> +		omap_write_buf_pref(mtd, p, len);
>  	else
>  		/* start transfer in DMA mode */
> -		omap_nand_dma_transfer(mtd, buf, len, 0x1);
> +		omap_nand_dma_transfer(mtd, p, len, 0x1);
>  }

I think that you should instead remove the 'const' modifier from the
'omap_write_buf_dma_pref()' function. Indeed, if it has the 'const'
modifier, it should never change the bugger.
Artem Bityutskiy - Nov. 10, 2009, 2:24 p.m.
On Tue, 2009-11-03 at 14:31 +0530, Vimal Singh wrote:
> >> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> >> index 090ab87..92573d5 100644
> >> --- a/drivers/mtd/nand/omap2.c
> >> +++ b/drivers/mtd/nand/omap2.c
> >> @@ -501,11 +501,13 @@ static void omap_read_buf_dma_pref(struct
> >> mtd_info *mtd, u_char
> >
> > :-) It is the same again.
> >
> > Try to send the e-mail to yourself, then save it and apply with git-am.
> > If it works, send to the mailing list.
> 
> Below patch applies. Sorry for noise... :(
> 
> Thanks,
> vimal
> 
> 
> From eebbd81141b196af2dc3f7a2650ce16b6b0d76ae Mon Sep 17 00:00:00 2001
> From: Vimal Singh <vimalsingh@ti.com>
> Date: Fri, 30 Oct 2009 11:31:34 +0530
> Subject: [PATCH] Fixing compilation warning for 'nand/omap2.c'
> 
> Fixing below warning in compilation:
> drivers/mtd/nand/omap2.c: In function 'omap_write_buf_dma_pref':
> drivers/mtd/nand/omap2.c:508: warning: passing argument 2 of
> 'omap_nand_dma_transfer' discards qualifiers from pointer target type
> 
> Signed-off-by: Vimal Singh <vimalsingh@ti.com>
> ---
>  drivers/mtd/nand/omap2.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index 090ab87..92573d5 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c
> @@ -501,11 +501,13 @@ static void omap_read_buf_dma_pref(struct
>  static void omap_write_buf_dma_pref(struct mtd_info *mtd,
>  					const u_char *buf, int len)
>  {
> +	u_char *p = (u_char *)buf;
> +
>  	if (len <= mtd->oobsize)
> -		omap_write_buf_pref(mtd, buf, len);
> +		omap_write_buf_pref(mtd, p, len);
>  	else
>  		/* start transfer in DMA mode */
> -		omap_nand_dma_transfer(mtd, buf, len, 0x1);
> +		omap_nand_dma_transfer(mtd, p, len, 0x1);
>  }
> 
>  /**

BTW, this patch is still corrupted for me. And it is strange that I do
not see it in the archives, so I cannot check is this my setup which is
guilty, or it is you sending the patches incorrectly:

http://lists.infradead.org/pipermail/linux-mtd/2009-November/027918.html
Artem Bityutskiy - Nov. 10, 2009, 2:26 p.m.
On Tue, 2009-11-10 at 16:20 +0200, Artem Bityutskiy wrote:
> On Tue, 2009-11-03 at 14:31 +0530, Vimal Singh wrote:
> > >> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> > >> index 090ab87..92573d5 100644
> > >> --- a/drivers/mtd/nand/omap2.c
> > >> +++ b/drivers/mtd/nand/omap2.c
> > >> @@ -501,11 +501,13 @@ static void omap_read_buf_dma_pref(struct
> > >> mtd_info *mtd, u_char
> > >
> > > :-) It is the same again.
> > >
> > > Try to send the e-mail to yourself, then save it and apply with git-am.
> > > If it works, send to the mailing list.
> > 
> > Below patch applies. Sorry for noise... :(
> > 
> > Thanks,
> > vimal
> > 
> > 
> > From eebbd81141b196af2dc3f7a2650ce16b6b0d76ae Mon Sep 17 00:00:00 2001
> > From: Vimal Singh <vimalsingh@ti.com>
> > Date: Fri, 30 Oct 2009 11:31:34 +0530
> > Subject: [PATCH] Fixing compilation warning for 'nand/omap2.c'
> > 
> > Fixing below warning in compilation:
> > drivers/mtd/nand/omap2.c: In function 'omap_write_buf_dma_pref':
> > drivers/mtd/nand/omap2.c:508: warning: passing argument 2 of
> > 'omap_nand_dma_transfer' discards qualifiers from pointer target type
> > 
> > Signed-off-by: Vimal Singh <vimalsingh@ti.com>
> > ---
> >  drivers/mtd/nand/omap2.c |    6 ++++--
> >  1 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> > index 090ab87..92573d5 100644
> > --- a/drivers/mtd/nand/omap2.c
> > +++ b/drivers/mtd/nand/omap2.c
> > @@ -501,11 +501,13 @@ static void omap_read_buf_dma_pref(struct
> >  static void omap_write_buf_dma_pref(struct mtd_info *mtd,
> >  					const u_char *buf, int len)
> >  {
> > +	u_char *p = (u_char *)buf;
> > +
> >  	if (len <= mtd->oobsize)
> > -		omap_write_buf_pref(mtd, buf, len);
> > +		omap_write_buf_pref(mtd, p, len);
> >  	else
> >  		/* start transfer in DMA mode */
> > -		omap_nand_dma_transfer(mtd, buf, len, 0x1);
> > +		omap_nand_dma_transfer(mtd, p, len, 0x1);
> >  }
> 
> I think that you should instead remove the 'const' modifier from the
> 'omap_write_buf_dma_pref()' function. Indeed, if it has the 'const'
> modifier, it should never change the bugger.

Sorry, s/bugger/buffer/
:-)
vimal singh - Nov. 11, 2009, 4:40 a.m.
On Tue, Nov 10, 2009 at 7:56 PM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> On Tue, 2009-11-10 at 16:20 +0200, Artem Bityutskiy wrote:
>> On Tue, 2009-11-03 at 14:31 +0530, Vimal Singh wrote:
>> > >> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
>> > >> index 090ab87..92573d5 100644
>> > >> --- a/drivers/mtd/nand/omap2.c
>> > >> +++ b/drivers/mtd/nand/omap2.c
>> > >> @@ -501,11 +501,13 @@ static void omap_read_buf_dma_pref(struct
>> > >> mtd_info *mtd, u_char
>> > >
>> > > :-) It is the same again.
>> > >
>> > > Try to send the e-mail to yourself, then save it and apply with git-am.
>> > > If it works, send to the mailing list.
>> >
>> > Below patch applies. Sorry for noise... :(
>> >
>> > Thanks,
>> > vimal
>> >
>> >
>> > From eebbd81141b196af2dc3f7a2650ce16b6b0d76ae Mon Sep 17 00:00:00 2001
>> > From: Vimal Singh <vimalsingh@ti.com>
>> > Date: Fri, 30 Oct 2009 11:31:34 +0530
>> > Subject: [PATCH] Fixing compilation warning for 'nand/omap2.c'
>> >
>> > Fixing below warning in compilation:
>> > drivers/mtd/nand/omap2.c: In function 'omap_write_buf_dma_pref':
>> > drivers/mtd/nand/omap2.c:508: warning: passing argument 2 of
>> > 'omap_nand_dma_transfer' discards qualifiers from pointer target type
>> >
>> > Signed-off-by: Vimal Singh <vimalsingh@ti.com>
>> > ---
>> >  drivers/mtd/nand/omap2.c |    6 ++++--
>> >  1 files changed, 4 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
>> > index 090ab87..92573d5 100644
>> > --- a/drivers/mtd/nand/omap2.c
>> > +++ b/drivers/mtd/nand/omap2.c
>> > @@ -501,11 +501,13 @@ static void omap_read_buf_dma_pref(struct
>> >  static void omap_write_buf_dma_pref(struct mtd_info *mtd,
>> >                                     const u_char *buf, int len)
>> >  {
>> > +   u_char *p = (u_char *)buf;
>> > +
>> >     if (len <= mtd->oobsize)
>> > -           omap_write_buf_pref(mtd, buf, len);
>> > +           omap_write_buf_pref(mtd, p, len);
>> >     else
>> >             /* start transfer in DMA mode */
>> > -           omap_nand_dma_transfer(mtd, buf, len, 0x1);
>> > +           omap_nand_dma_transfer(mtd, p, len, 0x1);
>> >  }
>>
>> I think that you should instead remove the 'const' modifier from the
>> 'omap_write_buf_dma_pref()' function. Indeed, if it has the 'const'
>> modifier, it should never change the bugger.
>
> Sorry, s/bugger/buffer/
> :-)

Write calls are intended to copy data bytes from supplied buffer to
NAND. So yes, these calls are not supposed to change this buffer.

Patch

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 090ab87..92573d5 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -501,11 +501,13 @@  static void omap_read_buf_dma_pref(struct
 static void omap_write_buf_dma_pref(struct mtd_info *mtd,
 					const u_char *buf, int len)
 {
+	u_char *p = (u_char *)buf;
+
 	if (len <= mtd->oobsize)
-		omap_write_buf_pref(mtd, buf, len);
+		omap_write_buf_pref(mtd, p, len);
 	else
 		/* start transfer in DMA mode */
-		omap_nand_dma_transfer(mtd, buf, len, 0x1);
+		omap_nand_dma_transfer(mtd, p, len, 0x1);
 }

 /**