public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: mxc_nand fix compiler warning
@ 2012-06-12 11:18 Alex Gershgorin
  2012-06-12 12:01 ` Uwe Kleine-König
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Gershgorin @ 2012-06-12 11:18 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: s.hauer, linux-mtd, Alex Gershgorin, u.kleine-koenig

This patch removes the following warning:
drivers/mtd/nand/mxc_nand.c:1246: warning: initialization discards qualifiers from pointer target type
drivers/mtd/nand/mxc_nand.c:1249: warning: initialization discards qualifiers from pointer target type
drivers/mtd/nand/mxc_nand.c:1252: warning: initialization discards qualifiers from pointer target type
drivers/mtd/nand/mxc_nand.c:1255: warning: initialization discards qualifiers from pointer target type

Signed-off-by: Alex Gershgorin <alexg@meprolight.com>

Applies to v3.5-rc2+
---
 drivers/mtd/nand/mxc_nand.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index c58e6a9..74b6e75 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1243,16 +1243,16 @@ static const struct mxc_nand_devtype_data imx51_nand_devtype_data = {
 static const struct of_device_id mxcnd_dt_ids[] = {
 	{
 		.compatible = "fsl,imx21-nand",
-		.data = &imx21_nand_devtype_data,
+		.data = (void *)&imx21_nand_devtype_data,
 	}, {
 		.compatible = "fsl,imx27-nand",
-		.data = &imx27_nand_devtype_data,
+		.data = (void *)&imx27_nand_devtype_data,
 	}, {
 		.compatible = "fsl,imx25-nand",
-		.data = &imx25_nand_devtype_data,
+		.data = (void *)&imx25_nand_devtype_data,
 	}, {
 		.compatible = "fsl,imx51-nand",
-		.data = &imx51_nand_devtype_data,
+		.data = (void *)&imx51_nand_devtype_data,
 	},
 	{ /* sentinel */ }
 };
-- 
1.7.0.4

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

* Re: [PATCH] mtd: nand: mxc_nand fix compiler warning
  2012-06-12 11:18 [PATCH] mtd: nand: mxc_nand fix compiler warning Alex Gershgorin
@ 2012-06-12 12:01 ` Uwe Kleine-König
  2012-06-12 13:39   ` Alex Gershgorin
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2012-06-12 12:01 UTC (permalink / raw)
  To: Alex Gershgorin; +Cc: Artem Bityutskiy, s.hauer, linux-mtd

Hello,

On Tue, Jun 12, 2012 at 02:18:07PM +0300, Alex Gershgorin wrote:
> This patch removes the following warning:
> drivers/mtd/nand/mxc_nand.c:1246: warning: initialization discards qualifiers from pointer target type
> drivers/mtd/nand/mxc_nand.c:1249: warning: initialization discards qualifiers from pointer target type
> drivers/mtd/nand/mxc_nand.c:1252: warning: initialization discards qualifiers from pointer target type
> drivers/mtd/nand/mxc_nand.c:1255: warning: initialization discards qualifiers from pointer target type
> 
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> 
> Applies to v3.5-rc2+
> ---
Better write the "Applies to" line after the tripple dash. Then this
info doesn't make it into the commit log. Instead point out the
offending commit.

Having said that, I prefer to have

	http://mid.gmane.org/1335171381-24869-1-git-send-email-u.kleine-koenig@pengutronix.de

(and the follow-ups) applied. Casting away consts is nearly always
wrong.

Best regards
Uwe

>  drivers/mtd/nand/mxc_nand.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index c58e6a9..74b6e75 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -1243,16 +1243,16 @@ static const struct mxc_nand_devtype_data imx51_nand_devtype_data = {
>  static const struct of_device_id mxcnd_dt_ids[] = {
>  	{
>  		.compatible = "fsl,imx21-nand",
> -		.data = &imx21_nand_devtype_data,
> +		.data = (void *)&imx21_nand_devtype_data,
>  	}, {
>  		.compatible = "fsl,imx27-nand",
> -		.data = &imx27_nand_devtype_data,
> +		.data = (void *)&imx27_nand_devtype_data,
>  	}, {
>  		.compatible = "fsl,imx25-nand",
> -		.data = &imx25_nand_devtype_data,
> +		.data = (void *)&imx25_nand_devtype_data,
>  	}, {
>  		.compatible = "fsl,imx51-nand",
> -		.data = &imx51_nand_devtype_data,
> +		.data = (void *)&imx51_nand_devtype_data,
>  	},
>  	{ /* sentinel */ }
>  };
> -- 
> 1.7.0.4
> 
> 

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* RE: [PATCH] mtd: nand: mxc_nand fix compiler warning
  2012-06-12 12:01 ` Uwe Kleine-König
@ 2012-06-12 13:39   ` Alex Gershgorin
  2012-06-12 14:24     ` Uwe Kleine-König
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Gershgorin @ 2012-06-12 13:39 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Artem Bityutskiy, s.hauer@pengutronix.de,
	linux-mtd@lists.infradead.org


On Tue, Jun 12, 2012 at 02:18:07PM +0300, Alex Gershgorin wrote:
> This patch removes the following warning:
> drivers/mtd/nand/mxc_nand.c:1246: warning: initialization discards qualifiers from pointer target type
> drivers/mtd/nand/mxc_nand.c:1249: warning: initialization discards qualifiers from pointer target type
> drivers/mtd/nand/mxc_nand.c:1252: warning: initialization discards qualifiers from pointer target type
> drivers/mtd/nand/mxc_nand.c:1255: warning: initialization discards qualifiers from pointer target type
>
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
>
> Applies to v3.5-rc2+
> ---
> >Better write the "Applies to" line after the tripple dash. Then this
> >info doesn't make it into the commit log. Instead point out the
> >offending commit.

Sorry my mistake

> >Having said that, I prefer to have

> >  http://mid.gmane.org/1335171381-24869-1-git-send-email-u.kleine-koenig@pengutronix.de
> > (and the follow-ups) applied. Casting away consts is nearly always
> > wrong.

I think this patch will solve the warnings problem only in mxc_nand driver, but this patch also creates
 new same problems to  other drivers that use struct of_device_id.

Thanks
Alex

>  drivers/mtd/nand/mxc_nand.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index c58e6a9..74b6e75 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -1243,16 +1243,16 @@ static const struct mxc_nand_devtype_data imx51_nand_devtype_data = {
>  static const struct of_device_id mxcnd_dt_ids[] = {
>       {
>               .compatible = "fsl,imx21-nand",
> -             .data = &imx21_nand_devtype_data,
> +             .data = (void *)&imx21_nand_devtype_data,
>       }, {
>               .compatible = "fsl,imx27-nand",
> -             .data = &imx27_nand_devtype_data,
> +             .data = (void *)&imx27_nand_devtype_data,
>       }, {
>               .compatible = "fsl,imx25-nand",
> -             .data = &imx25_nand_devtype_data,
> +             .data = (void *)&imx25_nand_devtype_data,
>       }, {
>               .compatible = "fsl,imx51-nand",
> -             .data = &imx51_nand_devtype_data,
> +             .data = (void *)&imx51_nand_devtype_data,
>       },
>       { /* sentinel */ }
>  };
> --
> 1.7.0.4
>
>

--
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH] mtd: nand: mxc_nand fix compiler warning
  2012-06-12 13:39   ` Alex Gershgorin
@ 2012-06-12 14:24     ` Uwe Kleine-König
  2012-06-13  7:06       ` Alex Gershgorin
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2012-06-12 14:24 UTC (permalink / raw)
  To: Alex Gershgorin
  Cc: Artem Bityutskiy, s.hauer@pengutronix.de,
	linux-mtd@lists.infradead.org

On Tue, Jun 12, 2012 at 04:39:33PM +0300, Alex Gershgorin wrote:
> 
> On Tue, Jun 12, 2012 at 02:18:07PM +0300, Alex Gershgorin wrote:
> > This patch removes the following warning:
> > drivers/mtd/nand/mxc_nand.c:1246: warning: initialization discards qualifiers from pointer target type
> > drivers/mtd/nand/mxc_nand.c:1249: warning: initialization discards qualifiers from pointer target type
> > drivers/mtd/nand/mxc_nand.c:1252: warning: initialization discards qualifiers from pointer target type
> > drivers/mtd/nand/mxc_nand.c:1255: warning: initialization discards qualifiers from pointer target type
> >
> > Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> >
> > Applies to v3.5-rc2+
> > ---
> > >Better write the "Applies to" line after the tripple dash. Then this
> > >info doesn't make it into the commit log. Instead point out the
> > >offending commit.
> 
> Sorry my mistake
> 
> > >Having said that, I prefer to have
> 
> > >  http://mid.gmane.org/1335171381-24869-1-git-send-email-u.kleine-koenig@pengutronix.de
> > > (and the follow-ups) applied. Casting away consts is nearly always
> > > wrong.
> 
> I think this patch will solve the warnings problem only in mxc_nand driver, but this patch also creates
>  new same problems to  other drivers that use struct of_device_id.
Yeah, but IMHO they are worth to be fixed. With your patch you assume
that the data member will never be modified (and in fact it shouldn't).
So the right thing is to make that assumption offical.
And for well-behaved drivers the fix is easy (i.e. spread a few consts),
and bad drivers are forced to be fixed (or introduce casts for const
that hopefully will be catched during review).

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* RE: [PATCH] mtd: nand: mxc_nand fix compiler warning
  2012-06-12 14:24     ` Uwe Kleine-König
@ 2012-06-13  7:06       ` Alex Gershgorin
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Gershgorin @ 2012-06-13  7:06 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Artem Bityutskiy, s.hauer@pengutronix.de,
	linux-mtd@lists.infradead.org

Hi Uwe,

> > >Having said that, I prefer to have
>
> > >  http://mid.gmane.org/1335171381-24869-1-git-send-email-u.kleine-koenig@pengutronix.de
> > > (and the follow-ups) applied. Casting away consts is nearly always
> > > wrong.
>
> I think this patch will solve the warnings problem only in mxc_nand driver, but this patch also creates
>  new same problems to  other drivers that use struct of_device_id.
> > > >Yeah, but IMHO they are worth to be fixed. With your patch you assume
> > > > that the data member will never be modified (and in fact it shouldn't).

No my patch only removes a compiler warning of the mxc_nand driver in current version of the kernel.
 
> > > > So the right thing is to make that assumption offical.
> > > > And for well-behaved drivers the fix is easy (i.e. spread a few consts),
> > > > and bad drivers are forced to be fixed (or introduce casts for const
> > > > that hopefully will be catched during review).

Can you imagine how many drivers will require additional patches and what should be the level of fixation?
I do not know
But in general your idea is good, only in my opinion this requires a more in-depth review.

Regards,
Alex






 

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

end of thread, other threads:[~2012-06-13  7:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-12 11:18 [PATCH] mtd: nand: mxc_nand fix compiler warning Alex Gershgorin
2012-06-12 12:01 ` Uwe Kleine-König
2012-06-12 13:39   ` Alex Gershgorin
2012-06-12 14:24     ` Uwe Kleine-König
2012-06-13  7:06       ` Alex Gershgorin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox