All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] unused-const-variable warnings in FSL DDR driver
@ 2017-02-09 10:32 Thomas Schaefer
  2017-02-09 16:51 ` york sun
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Schaefer @ 2017-02-09 10:32 UTC (permalink / raw)
  To: u-boot

Hi York,

When compiling latest u-boot with gcc 6.3 compiler, I get several 'unused-const-variable' warnings in options.c file of FSL DDR driver. Affected variables are for (DIMM_SLOTS_PER_CTLR==2) configuration (e.g. dual_0S[4]) and warnings could be fixed with the patch applied.

What do you think?

Best regards,
Thomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: drivers_ddr_fsl_options.patch
Type: application/octet-stream
Size: 1295 bytes
Desc: drivers_ddr_fsl_options.patch
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170209/0c156309/attachment.obj>

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

* [U-Boot] unused-const-variable warnings in FSL DDR driver
  2017-02-09 10:32 [U-Boot] unused-const-variable warnings in FSL DDR driver Thomas Schaefer
@ 2017-02-09 16:51 ` york sun
  2017-02-09 17:17   ` Thomas Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: york sun @ 2017-02-09 16:51 UTC (permalink / raw)
  To: u-boot

On 02/09/2017 02:32 AM, Thomas Schaefer wrote:
> Hi York,
>
>
>
> When compiling latest u-boot with gcc 6.3 compiler, I get several
> ?unused-const-variable? warnings in options.c file of FSL DDR driver.
> Affected variables are for (DIMM_SLOTS_PER_CTLR==2) configuration (e.g.
> dual_0S[4]) and warnings could be fixed with the patch applied.
>
>
>
> What do you think?

Thomas,

Thanks for bringing it to my attention. I understand GCC 6 may have more 
warnings. The proposed patch is OK in logic but it increases the size of 
code unnecessarily. Can you come up with a different fix?

I can come back to check after I finish my work on hand.

York

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

* [U-Boot] unused-const-variable warnings in FSL DDR driver
  2017-02-09 16:51 ` york sun
@ 2017-02-09 17:17   ` Thomas Schaefer
  2017-02-09 17:30     ` york sun
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Schaefer @ 2017-02-09 17:17 UTC (permalink / raw)
  To: u-boot


> On 02/09/2017 02:32 AM, Thomas Schaefer wrote:
>> Hi York,
>>
>>
>>
>> When compiling latest u-boot with gcc 6.3 compiler, I get several 
>> 'unused-const-variable' warnings in options.c file of FSL DDR driver.
>> Affected variables are for (DIMM_SLOTS_PER_CTLR==2) configuration (e.g.
> dual_0S[4]) and warnings could be fixed with the patch applied.
>>
>>
>>
>> What do you think?
>
> Thomas,
>
> Thanks for bringing it to my attention. I understand GCC 6 may have more 
> warnings. The proposed patch is OK in logic but it increases the size of code 
> unnecessarily. Can you come up with a different fix?
>
> I can come back to check after I finish my work on hand.
>
> York

Hi York,

not sure if I understand this correctly, but why is code size increased when these
variables are not defined? I think code size is decreased instead as these variables
are no longer defined if not needed.

I also don't see a way to achieve this in a different way as the variables are defined
differently for DDR2, DDR3 and DDR4.

Best regards,
Thomas

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

* [U-Boot] unused-const-variable warnings in FSL DDR driver
  2017-02-09 17:17   ` Thomas Schaefer
@ 2017-02-09 17:30     ` york sun
  2017-02-09 17:45       ` Thomas Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: york sun @ 2017-02-09 17:30 UTC (permalink / raw)
  To: u-boot

On 02/09/2017 09:17 AM, Thomas Schaefer wrote:
>
>> On 02/09/2017 02:32 AM, Thomas Schaefer wrote:
>>> Hi York,
>>>
>>>
>>>
>>> When compiling latest u-boot with gcc 6.3 compiler, I get several
>>> 'unused-const-variable' warnings in options.c file of FSL DDR driver.
>>> Affected variables are for (DIMM_SLOTS_PER_CTLR==2) configuration (e.g.
>> dual_0S[4]) and warnings could be fixed with the patch applied.
>>>
>>>
>>>
>>> What do you think?
>>
>> Thomas,
>>
>> Thanks for bringing it to my attention. I understand GCC 6 may have more
>> warnings. The proposed patch is OK in logic but it increases the size of code
>> unnecessarily. Can you come up with a different fix?
>>
>> I can come back to check after I finish my work on hand.
>>
>> York
>
> Hi York,
>
> not sure if I understand this correctly, but why is code size increased when these
> variables are not defined? I think code size is decreased instead as these variables
> are no longer defined if not needed.
>
> I also don't see a way to achieve this in a different way as the variables are defined
> differently for DDR2, DDR3 and DDR4.
>
>

Wait a minute, did you generate the patch backward? Your patch shows 
removing "#if CONFIG_DIMM_SLOTS_PER_CTLR==2" which doesn't exist in 
current code. If the logic is reversed, then yes, you are reducing the 
size. Can GCC 6 optimize out the unused data? If yes, maybe we can use 
__maybe_unused to get rid of the warning?

York

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

* [U-Boot] unused-const-variable warnings in FSL DDR driver
  2017-02-09 17:30     ` york sun
@ 2017-02-09 17:45       ` Thomas Schaefer
  2017-02-09 17:51         ` york sun
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Schaefer @ 2017-02-09 17:45 UTC (permalink / raw)
  To: u-boot

>>
>>> On 02/09/2017 02:32 AM, Thomas Schaefer wrote:
>>>> Hi York,
>>>>
>>>>
>>>>
>>>> When compiling latest u-boot with gcc 6.3 compiler, I get several 
>>>> 'unused-const-variable' warnings in options.c file of FSL DDR driver.
>>>> Affected variables are for (DIMM_SLOTS_PER_CTLR==2) configuration (e.g.
>>>> dual_0S[4]) and warnings could be fixed with the patch applied.
>>>>
>>>>
>>>>
>>>> What do you think?
>>>
>>> Thomas,
>>>
>>> Thanks for bringing it to my attention. I understand GCC 6 may have 
>>> more warnings. The proposed patch is OK in logic but it increases the 
>>> size of code unnecessarily. Can you come up with a different fix?
>>>
>>> I can come back to check after I finish my work on hand.
>>>
>>> York
>>
>> Hi York,
>>
>> not sure if I understand this correctly, but why is code size 
>> increased when these variables are not defined? I think code size is 
>> decreased instead as these variables are no longer defined if not needed.
>>
>> I also don't see a way to achieve this in a different way as the 
>> variables are defined differently for DDR2, DDR3 and DDR4.
>>
>>

>Wait a minute, did you generate the patch backward? Your patch shows
>removing "#if CONFIG_DIMM_SLOTS_PER_CTLR==2" which doesn't exist in
>current code. If the logic is reversed, then yes, you are reducing the size. Can 
>GCC 6 optimize out the unused data? If yes, maybe we can use __maybe_unused
>to get rid of the warning?
>
>York

Oops, you are right, sorry for the confusion. Here's the corrected version:

diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
index d6a8fcb216..d90ed0b6cc 100644
--- a/drivers/ddr/fsl/options.c
+++ b/drivers/ddr/fsl/options.c
@@ -89,6 +89,7 @@ static const struct dynamic_odt single_S[4] = {
        {0, 0, 0, 0},
 };

+#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
 static const struct dynamic_odt dual_DD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
@@ -235,6 +236,7 @@ static const struct dynamic_odt dual_0S[4] = {
        {0, 0, 0, 0}

 };
+#endif

 static const struct dynamic_odt odt_unknown[4] = {
        {       /* cs0 */
@@ -319,6 +321,7 @@ static const struct dynamic_odt single_S[4] = {
        {0, 0, 0, 0},
 };

+#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
 static const struct dynamic_odt dual_DD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
@@ -465,6 +468,7 @@ static const struct dynamic_odt dual_0S[4] = {
        {0, 0, 0, 0}

 };
+#endif

 static const struct dynamic_odt odt_unknown[4] = {
        {       /* cs0 */
@@ -529,6 +533,7 @@ static const struct dynamic_odt single_S[4] = {
        {0, 0, 0, 0},
 };

+#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
 static const struct dynamic_odt dual_DD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
@@ -676,6 +681,7 @@ static const struct dynamic_odt dual_0S[4] = {
        {0, 0, 0, 0}

 };
+#endif

 static const struct dynamic_odt odt_unknown[4] = {
        {       /* cs0 */


Best regards,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drivers_ddr_fsl_options.patch
Type: application/octet-stream
Size: 1295 bytes
Desc: drivers_ddr_fsl_options.patch
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170209/47517514/attachment.obj>

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

* [U-Boot] unused-const-variable warnings in FSL DDR driver
  2017-02-09 17:45       ` Thomas Schaefer
@ 2017-02-09 17:51         ` york sun
  2017-02-09 21:26           ` Tom Rini
  0 siblings, 1 reply; 11+ messages in thread
From: york sun @ 2017-02-09 17:51 UTC (permalink / raw)
  To: u-boot

On 02/09/2017 09:46 AM, Thomas Schaefer wrote:
>>>
>>>> On 02/09/2017 02:32 AM, Thomas Schaefer wrote:
>>>>> Hi York,
>>>>>
>>>>>
>>>>>
>>>>> When compiling latest u-boot with gcc 6.3 compiler, I get several
>>>>> 'unused-const-variable' warnings in options.c file of FSL DDR driver.
>>>>> Affected variables are for (DIMM_SLOTS_PER_CTLR==2) configuration (e.g.
>>>>> dual_0S[4]) and warnings could be fixed with the patch applied.
>>>>>
>>>>>
>>>>>
>>>>> What do you think?
>>>>
>>>> Thomas,
>>>>
>>>> Thanks for bringing it to my attention. I understand GCC 6 may have
>>>> more warnings. The proposed patch is OK in logic but it increases the
>>>> size of code unnecessarily. Can you come up with a different fix?
>>>>
>>>> I can come back to check after I finish my work on hand.
>>>>
>>>> York
>>>
>>> Hi York,
>>>
>>> not sure if I understand this correctly, but why is code size
>>> increased when these variables are not defined? I think code size is
>>> decreased instead as these variables are no longer defined if not needed.
>>>
>>> I also don't see a way to achieve this in a different way as the
>>> variables are defined differently for DDR2, DDR3 and DDR4.
>>>
>>>
>
>> Wait a minute, did you generate the patch backward? Your patch shows
>> removing "#if CONFIG_DIMM_SLOTS_PER_CTLR==2" which doesn't exist in
>> current code. If the logic is reversed, then yes, you are reducing the size. Can
>> GCC 6 optimize out the unused data? If yes, maybe we can use __maybe_unused
>> to get rid of the warning?
>>
>> York
>
> Oops, you are right, sorry for the confusion. Here's the corrected version:
>
> diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
> index d6a8fcb216..d90ed0b6cc 100644
> --- a/drivers/ddr/fsl/options.c
> +++ b/drivers/ddr/fsl/options.c
> @@ -89,6 +89,7 @@ static const struct dynamic_odt single_S[4] = {
>         {0, 0, 0, 0},
>  };
>
> +#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
>  static const struct dynamic_odt dual_DD[4] = {
>         {       /* cs0 */
>                 FSL_DDR_ODT_NEVER,
> @@ -235,6 +236,7 @@ static const struct dynamic_odt dual_0S[4] = {
>         {0, 0, 0, 0}
>
>  };
> +#endif
>
>  static const struct dynamic_odt odt_unknown[4] = {
>         {       /* cs0 */
> @@ -319,6 +321,7 @@ static const struct dynamic_odt single_S[4] = {
>         {0, 0, 0, 0},
>  };
>
> +#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
>  static const struct dynamic_odt dual_DD[4] = {
>         {       /* cs0 */
>                 FSL_DDR_ODT_NEVER,
> @@ -465,6 +468,7 @@ static const struct dynamic_odt dual_0S[4] = {
>         {0, 0, 0, 0}
>
>  };
> +#endif
>
>  static const struct dynamic_odt odt_unknown[4] = {
>         {       /* cs0 */
> @@ -529,6 +533,7 @@ static const struct dynamic_odt single_S[4] = {
>         {0, 0, 0, 0},
>  };
>
> +#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
>  static const struct dynamic_odt dual_DD[4] = {
>         {       /* cs0 */
>                 FSL_DDR_ODT_OTHER_DIMM,
> @@ -676,6 +681,7 @@ static const struct dynamic_odt dual_0S[4] = {
>         {0, 0, 0, 0}
>
>  };
> +#endif
>
>  static const struct dynamic_odt odt_unknown[4] = {
>         {       /* cs0 */
>
>

This looks better. Can you check the size before and after this change? 
I wonder if GCC 6 can optimize out unused const. If it can, we may be 
able to get away by using __maybe_used and save a lot of #if.

By the way, please put space around "==" if you want to go this way.

York

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

* [U-Boot] unused-const-variable warnings in FSL DDR driver
  2017-02-09 17:51         ` york sun
@ 2017-02-09 21:26           ` Tom Rini
  2017-02-10 10:00             ` Thomas Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Rini @ 2017-02-09 21:26 UTC (permalink / raw)
  To: u-boot

On Thu, Feb 09, 2017 at 05:51:36PM +0000, york sun wrote:
> On 02/09/2017 09:46 AM, Thomas Schaefer wrote:
> >>>
> >>>> On 02/09/2017 02:32 AM, Thomas Schaefer wrote:
> >>>>> Hi York,
> >>>>>
> >>>>>
> >>>>>
> >>>>> When compiling latest u-boot with gcc 6.3 compiler, I get several
> >>>>> 'unused-const-variable' warnings in options.c file of FSL DDR driver.
> >>>>> Affected variables are for (DIMM_SLOTS_PER_CTLR==2) configuration (e.g.
> >>>>> dual_0S[4]) and warnings could be fixed with the patch applied.
> >>>>>
> >>>>>
> >>>>>
> >>>>> What do you think?
> >>>>
> >>>> Thomas,
> >>>>
> >>>> Thanks for bringing it to my attention. I understand GCC 6 may have
> >>>> more warnings. The proposed patch is OK in logic but it increases the
> >>>> size of code unnecessarily. Can you come up with a different fix?
> >>>>
> >>>> I can come back to check after I finish my work on hand.
> >>>>
> >>>> York
> >>>
> >>> Hi York,
> >>>
> >>> not sure if I understand this correctly, but why is code size
> >>> increased when these variables are not defined? I think code size is
> >>> decreased instead as these variables are no longer defined if not needed.
> >>>
> >>> I also don't see a way to achieve this in a different way as the
> >>> variables are defined differently for DDR2, DDR3 and DDR4.
> >>>
> >>>
> >
> >> Wait a minute, did you generate the patch backward? Your patch shows
> >> removing "#if CONFIG_DIMM_SLOTS_PER_CTLR==2" which doesn't exist in
> >> current code. If the logic is reversed, then yes, you are reducing the size. Can
> >> GCC 6 optimize out the unused data? If yes, maybe we can use __maybe_unused
> >> to get rid of the warning?
> >>
> >> York
> >
> > Oops, you are right, sorry for the confusion. Here's the corrected version:
> >
> > diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
> > index d6a8fcb216..d90ed0b6cc 100644
> > --- a/drivers/ddr/fsl/options.c
> > +++ b/drivers/ddr/fsl/options.c
> > @@ -89,6 +89,7 @@ static const struct dynamic_odt single_S[4] = {
> >         {0, 0, 0, 0},
> >  };
> >
> > +#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
> >  static const struct dynamic_odt dual_DD[4] = {
> >         {       /* cs0 */
> >                 FSL_DDR_ODT_NEVER,
> > @@ -235,6 +236,7 @@ static const struct dynamic_odt dual_0S[4] = {
> >         {0, 0, 0, 0}
> >
> >  };
> > +#endif
> >
> >  static const struct dynamic_odt odt_unknown[4] = {
> >         {       /* cs0 */
> > @@ -319,6 +321,7 @@ static const struct dynamic_odt single_S[4] = {
> >         {0, 0, 0, 0},
> >  };
> >
> > +#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
> >  static const struct dynamic_odt dual_DD[4] = {
> >         {       /* cs0 */
> >                 FSL_DDR_ODT_NEVER,
> > @@ -465,6 +468,7 @@ static const struct dynamic_odt dual_0S[4] = {
> >         {0, 0, 0, 0}
> >
> >  };
> > +#endif
> >
> >  static const struct dynamic_odt odt_unknown[4] = {
> >         {       /* cs0 */
> > @@ -529,6 +533,7 @@ static const struct dynamic_odt single_S[4] = {
> >         {0, 0, 0, 0},
> >  };
> >
> > +#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
> >  static const struct dynamic_odt dual_DD[4] = {
> >         {       /* cs0 */
> >                 FSL_DDR_ODT_OTHER_DIMM,
> > @@ -676,6 +681,7 @@ static const struct dynamic_odt dual_0S[4] = {
> >         {0, 0, 0, 0}
> >
> >  };
> > +#endif
> >
> >  static const struct dynamic_odt odt_unknown[4] = {
> >         {       /* cs0 */
> >
> >
> 
> This looks better. Can you check the size before and after this change? 
> I wonder if GCC 6 can optimize out unused const. If it can, we may be 
> able to get away by using __maybe_used and save a lot of #if.
> 
> By the way, please put space around "==" if you want to go this way.

The above isn't quite enough for all cases.  I'm testing a different and
larger patch currently.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170209/0fc67e95/attachment.sig>

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

* [U-Boot] unused-const-variable warnings in FSL DDR driver
  2017-02-09 21:26           ` Tom Rini
@ 2017-02-10 10:00             ` Thomas Schaefer
  2017-03-25 15:34               ` york sun
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Schaefer @ 2017-02-10 10:00 UTC (permalink / raw)
  To: u-boot

> On Thu, Feb 09, 2017 at 05:51:36PM +0000, york sun wrote:
>> On 02/09/2017 09:46 AM, Thomas Schaefer wrote:
>> >>>
>> >>>> On 02/09/2017 02:32 AM, Thomas Schaefer wrote:
>> >>>>> Hi York,
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> When compiling latest u-boot with gcc 6.3 compiler, I get 
>> >>>>> several 'unused-const-variable' warnings in options.c file of FSL DDR driver.
>> >>>>> Affected variables are for (DIMM_SLOTS_PER_CTLR==2) configuration (e.g.
>> >>>>> dual_0S[4]) and warnings could be fixed with the patch applied.
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> What do you think?
>> >>>>
>> >>>> Thomas,
>> >>>>
>> >>>> Thanks for bringing it to my attention. I understand GCC 6 may 
>> >>>> have more warnings. The proposed patch is OK in logic but it 
>> >>>> increases the size of code unnecessarily. Can you come up with a different fix?
>> >>>>
>> >>>> I can come back to check after I finish my work on hand.
>> >>>>
>> >>>> York
>> >>>
>> >>> Hi York,
>> >>>
>> >>> not sure if I understand this correctly, but why is code size 
>> >>> increased when these variables are not defined? I think code size 
>> >>> is decreased instead as these variables are no longer defined if not needed.
>> >>>
>> >>> I also don't see a way to achieve this in a different way as the 
>> >>> variables are defined differently for DDR2, DDR3 and DDR4.
>> >>>
>> >>>
>>> >
>> >> Wait a minute, did you generate the patch backward? Your patch 
>> >> shows removing "#if CONFIG_DIMM_SLOTS_PER_CTLR==2" which doesn't 
>> >> exist in current code. If the logic is reversed, then yes, you are 
>> >> reducing the size. Can GCC 6 optimize out the unused data? If yes, 
>> >> maybe we can use __maybe_unused to get rid of the warning?
>> >>
>> >> York
>> >
>> > Oops, you are right, sorry for the confusion. Here's the corrected version:
>> >
>> > diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c 
>> > index d6a8fcb216..d90ed0b6cc 100644
>> > --- a/drivers/ddr/fsl/options.c
>> > +++ b/drivers/ddr/fsl/options.c
>> > @@ -89,6 +89,7 @@ static const struct dynamic_odt single_S[4] = {
>> >         {0, 0, 0, 0},
>> >  };
>> >
>> > +#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
>> >  static const struct dynamic_odt dual_DD[4] = {
>> >         {       /* cs0 */
>> >                 FSL_DDR_ODT_NEVER,
>> > @@ -235,6 +236,7 @@ static const struct dynamic_odt dual_0S[4] = {
>> >         {0, 0, 0, 0}
>> >
>> >  };
>> > +#endif
>> >
>> >  static const struct dynamic_odt odt_unknown[4] = {
>> >         {       /* cs0 */
>> > @@ -319,6 +321,7 @@ static const struct dynamic_odt single_S[4] = {
>> >         {0, 0, 0, 0},
>> >  };
>> >
>> > +#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
>> >  static const struct dynamic_odt dual_DD[4] = {
>> >         {       /* cs0 */
>> >                 FSL_DDR_ODT_NEVER,
>> > @@ -465,6 +468,7 @@ static const struct dynamic_odt dual_0S[4] = {
>> >         {0, 0, 0, 0}
>> >
>> >  };
>> > +#endif
>> >
>> >  static const struct dynamic_odt odt_unknown[4] = {
>> >         {       /* cs0 */
>> > @@ -529,6 +533,7 @@ static const struct dynamic_odt single_S[4] = {
>> >         {0, 0, 0, 0},
>> >  };
>> >
>> > +#if (CONFIG_DIMM_SLOTS_PER_CTLR==2)
>> >  static const struct dynamic_odt dual_DD[4] = {
>> >         {       /* cs0 */
>> >                 FSL_DDR_ODT_OTHER_DIMM, @@ -676,6 +681,7 @@ static 
>> > const struct dynamic_odt dual_0S[4] = {
>> >         {0, 0, 0, 0}
>> >
>> >  };
>> > +#endif
>> >
>> >  static const struct dynamic_odt odt_unknown[4] = {
>> >         {       /* cs0 */
>> >
>> >
>> 
>> This looks better. Can you check the size before and after this change? 
>> I wonder if GCC 6 can optimize out unused const. If it can, we may be 
>> able to get away by using __maybe_used and save a lot of #if.
>> 
>> By the way, please put space around "==" if you want to go this way.
>
>The above isn't quite enough for all cases.  I'm testing a different and larger patch currently.
>
>--
>Tom

I've built u-boot for T1042RDB with and without the above patch applied. Actually, binary images
created are the same (with the exception of build timestamp of course), so GCC actually removes
the unused variables.

When adding __maybe_unsued attribute to the variable definitions, warnings don't show up anymore:

diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
index d6a8fcb216..64aaa77047 100644
--- a/drivers/ddr/fsl/options.c
+++ b/drivers/ddr/fsl/options.c
@@ -33,7 +33,7 @@ struct dynamic_odt {
 /* Quad rank is not verified yet due availability.
  * Replacing 20 OHM with 34 OHM since DDR4 doesn't have 20 OHM option
  */
-static const struct dynamic_odt single_Q[4] = {
+__maybe_unused static const struct dynamic_odt single_Q[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS_AND_OTHER_DIMM,
@@ -60,7 +60,7 @@ static const struct dynamic_odt single_Q[4] = {
        }
 };

-static const struct dynamic_odt single_D[4] = {
+__maybe_unused static const struct dynamic_odt single_D[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -77,7 +77,7 @@ static const struct dynamic_odt single_D[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt single_S[4] = {
+__maybe_unused static const struct dynamic_odt single_S[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -89,7 +89,7 @@ static const struct dynamic_odt single_S[4] = {
        {0, 0, 0, 0},
 };

-static const struct dynamic_odt dual_DD[4] = {
+__maybe_unused static const struct dynamic_odt dual_DD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -116,7 +116,7 @@ static const struct dynamic_odt dual_DD[4] = {
        }
 };

-static const struct dynamic_odt dual_DS[4] = {
+__maybe_unused static const struct dynamic_odt dual_DS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -137,7 +137,7 @@ static const struct dynamic_odt dual_DS[4] = {
        },
        {0, 0, 0, 0}
 };
-static const struct dynamic_odt dual_SD[4] = {
+__maybe_unused static const struct dynamic_odt dual_SD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_ALL,
@@ -159,7 +159,7 @@ static const struct dynamic_odt dual_SD[4] = {
        }
 };

-static const struct dynamic_odt dual_SS[4] = {
+__maybe_unused static const struct dynamic_odt dual_SS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_ALL,
@@ -176,7 +176,7 @@ static const struct dynamic_odt dual_SS[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_D0[4] = {
+__maybe_unused static const struct dynamic_odt dual_D0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -193,7 +193,7 @@ static const struct dynamic_odt dual_D0[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_0D[4] = {
+__maybe_unused static const struct dynamic_odt dual_0D[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -210,7 +210,7 @@ static const struct dynamic_odt dual_0D[4] = {
        }
 };

-static const struct dynamic_odt dual_S0[4] = {
+__maybe_unused static const struct dynamic_odt dual_S0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,
@@ -223,7 +223,7 @@ static const struct dynamic_odt dual_S0[4] = {

 };

-static const struct dynamic_odt dual_0S[4] = {
+__maybe_unused static const struct dynamic_odt dual_0S[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -236,7 +236,7 @@ static const struct dynamic_odt dual_0S[4] = {

 };

-static const struct dynamic_odt odt_unknown[4] = {
+__maybe_unused static const struct dynamic_odt odt_unknown[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,
@@ -263,7 +263,7 @@ static const struct dynamic_odt odt_unknown[4] = {
        }
 };
 #elif defined(CONFIG_SYS_FSL_DDR3)
-static const struct dynamic_odt single_Q[4] = {
+__maybe_unused static const struct dynamic_odt single_Q[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS_AND_OTHER_DIMM,
@@ -290,7 +290,7 @@ static const struct dynamic_odt single_Q[4] = {
        }
 };

-static const struct dynamic_odt single_D[4] = {
+__maybe_unused static const struct dynamic_odt single_D[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -307,7 +307,7 @@ static const struct dynamic_odt single_D[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt single_S[4] = {
+__maybe_unused static const struct dynamic_odt single_S[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -319,7 +319,7 @@ static const struct dynamic_odt single_S[4] = {
        {0, 0, 0, 0},
 };

-static const struct dynamic_odt dual_DD[4] = {
+__maybe_unused static const struct dynamic_odt dual_DD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -346,7 +346,7 @@ static const struct dynamic_odt dual_DD[4] = {
        }
 };

-static const struct dynamic_odt dual_DS[4] = {
+__maybe_unused static const struct dynamic_odt dual_DS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -367,7 +367,7 @@ static const struct dynamic_odt dual_DS[4] = {
        },
        {0, 0, 0, 0}
 };
-static const struct dynamic_odt dual_SD[4] = {
+__maybe_unused static const struct dynamic_odt dual_SD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_ALL,
@@ -389,7 +389,7 @@ static const struct dynamic_odt dual_SD[4] = {
        }
 };

-static const struct dynamic_odt dual_SS[4] = {
+__maybe_unused static const struct dynamic_odt dual_SS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_ALL,
@@ -406,7 +406,7 @@ static const struct dynamic_odt dual_SS[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_D0[4] = {
+__maybe_unused static const struct dynamic_odt dual_D0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -423,7 +423,7 @@ static const struct dynamic_odt dual_D0[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_0D[4] = {
+__maybe_unused static const struct dynamic_odt dual_0D[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -440,7 +440,7 @@ static const struct dynamic_odt dual_0D[4] = {
        }
 };

-static const struct dynamic_odt dual_S0[4] = {
+__maybe_unused static const struct dynamic_odt dual_S0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,
@@ -453,7 +453,7 @@ static const struct dynamic_odt dual_S0[4] = {

 };

-static const struct dynamic_odt dual_0S[4] = {
+__maybe_unused static const struct dynamic_odt dual_0S[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -466,7 +466,7 @@ static const struct dynamic_odt dual_0S[4] = {

 };

-static const struct dynamic_odt odt_unknown[4] = {
+__maybe_unused static const struct dynamic_odt odt_unknown[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,
@@ -493,14 +493,14 @@ static const struct dynamic_odt odt_unknown[4] = {
        }
 };
 #else  /* CONFIG_SYS_FSL_DDR3 */
-static const struct dynamic_odt single_Q[4] = {
+__maybe_unused static const struct dynamic_odt single_Q[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt single_D[4] = {
+__maybe_unused static const struct dynamic_odt single_D[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -517,7 +517,7 @@ static const struct dynamic_odt single_D[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt single_S[4] = {
+__maybe_unused static const struct dynamic_odt single_S[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -529,7 +529,7 @@ static const struct dynamic_odt single_S[4] = {
        {0, 0, 0, 0},
 };

-static const struct dynamic_odt dual_DD[4] = {
+__maybe_unused static const struct dynamic_odt dual_DD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_OTHER_DIMM,
@@ -556,7 +556,7 @@ static const struct dynamic_odt dual_DD[4] = {
        }
 };

-static const struct dynamic_odt dual_DS[4] = {
+__maybe_unused static const struct dynamic_odt dual_DS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_OTHER_DIMM,
@@ -578,7 +578,7 @@ static const struct dynamic_odt dual_DS[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_SD[4] = {
+__maybe_unused static const struct dynamic_odt dual_SD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_OTHER_DIMM,
@@ -600,7 +600,7 @@ static const struct dynamic_odt dual_SD[4] = {
        }
 };

-static const struct dynamic_odt dual_SS[4] = {
+__maybe_unused static const struct dynamic_odt dual_SS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_OTHER_DIMM,
@@ -617,7 +617,7 @@ static const struct dynamic_odt dual_SS[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_D0[4] = {
+__maybe_unused static const struct dynamic_odt dual_D0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -634,7 +634,7 @@ static const struct dynamic_odt dual_D0[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_0D[4] = {
+__maybe_unused static const struct dynamic_odt dual_0D[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -651,7 +651,7 @@ static const struct dynamic_odt dual_0D[4] = {
        }
 };

-static const struct dynamic_odt dual_S0[4] = {
+__maybe_unused static const struct dynamic_odt dual_S0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,
@@ -664,7 +664,7 @@ static const struct dynamic_odt dual_S0[4] = {

 };

-static const struct dynamic_odt dual_0S[4] = {
+__maybe_unused static const struct dynamic_odt dual_0S[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -677,7 +677,7 @@ static const struct dynamic_odt dual_0S[4] = {

 };

-static const struct dynamic_odt odt_unknown[4] = {
+__maybe_unused static const struct dynamic_odt odt_unknown[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,


Best regards,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drivers_ddr_fsl_options.patch
Type: application/octet-stream
Size: 9324 bytes
Desc: drivers_ddr_fsl_options.patch
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170210/d3c02a7c/attachment.obj>

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

* [U-Boot] unused-const-variable warnings in FSL DDR driver
  2017-02-10 10:00             ` Thomas Schaefer
@ 2017-03-25 15:34               ` york sun
  2017-03-27  9:32                 ` Thomas Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: york sun @ 2017-03-25 15:34 UTC (permalink / raw)
  To: u-boot

On 02/10/2017 02:00 AM, Thomas Schaefer wrote:
>> On Thu, Feb 09, 2017 at 05:51:36PM +0000, york sun wrote:
>>> On 02/09/2017 09:46 AM, Thomas Schaefer wrote:
>>>>>>
>>>>>>> On 02/09/2017 02:32 AM, Thomas Schaefer wrote:
>>>>>>>> Hi York,

<snip>

>
> I've built u-boot for T1042RDB with and without the above patch applied. Actually, binary images
> created are the same (with the exception of build timestamp of course), so GCC actually removes
> the unused variables.
>
> When adding __maybe_unsued attribute to the variable definitions, warnings don't show up anymore:
>
> diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
> index d6a8fcb216..64aaa77047 100644
> --- a/drivers/ddr/fsl/options.c
> +++ b/drivers/ddr/fsl/options.c

Thomas,

Can you put your patch together with proper commit message and 
signature? I prefer your solution than this one 
http://patchwork.ozlabs.org/patch/726353/

York

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

* [U-Boot] unused-const-variable warnings in FSL DDR driver
  2017-03-25 15:34               ` york sun
@ 2017-03-27  9:32                 ` Thomas Schaefer
  2017-04-04 14:52                   ` Tom Rini
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Schaefer @ 2017-03-27  9:32 UTC (permalink / raw)
  To: u-boot

> From: york sun [mailto:york.sun at nxp.com] 
> Sent: Samstag, 25. März 2017 16:35
> To: Thomas Schaefer; Tom Rini
> Cc: u-boot at lists.denx.de
> Re: Re: AW: [U-Boot] unused-const-variable warnings in FSL DDR driver
>
> Thomas,
>
> Can you put your patch together with proper commit message and signature? I prefer your solution than this one http://patchwork.ozlabs.org/patch/726353/
>
> York
>

Hi York,

please find the patch in the attachment.

Best regards,
Thomas


commit 66dcf316bf2649e576f1b79aad3a5bb950d178d6
Author: Thomas Schaefer <thomas.schaefer@kontron.com>
Date:   Mon Mar 27 10:17:09 2017 +0200

    drivers: ddr: fix unused-const-variable warnings

    Depending on DDR configuration, gcc-6.x will show up unused-const-
    variable messages. Use __maybe_unused specifier for all dynamic_odt
    variable definitions to remove these warnings.

    Memory footprint will not increase as gcc will optimize out unused
    constants.

    Signed-off-by: Thomas Schaefer <thomas.schaefer@kontron.com>

diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
index d6a8fcb216..64aaa77047 100644
--- a/drivers/ddr/fsl/options.c
+++ b/drivers/ddr/fsl/options.c
@@ -33,7 +33,7 @@ struct dynamic_odt {
 /* Quad rank is not verified yet due availability.
  * Replacing 20 OHM with 34 OHM since DDR4 doesn't have 20 OHM option
  */
-static const struct dynamic_odt single_Q[4] = {
+__maybe_unused static const struct dynamic_odt single_Q[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS_AND_OTHER_DIMM,
@@ -60,7 +60,7 @@ static const struct dynamic_odt single_Q[4] = {
        }
 };

-static const struct dynamic_odt single_D[4] = {
+__maybe_unused static const struct dynamic_odt single_D[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -77,7 +77,7 @@ static const struct dynamic_odt single_D[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt single_S[4] = {
+__maybe_unused static const struct dynamic_odt single_S[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -89,7 +89,7 @@ static const struct dynamic_odt single_S[4] = {
        {0, 0, 0, 0},
 };

-static const struct dynamic_odt dual_DD[4] = {
+__maybe_unused static const struct dynamic_odt dual_DD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -116,7 +116,7 @@ static const struct dynamic_odt dual_DD[4] = {
        }
 };

-static const struct dynamic_odt dual_DS[4] = {
+__maybe_unused static const struct dynamic_odt dual_DS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -137,7 +137,7 @@ static const struct dynamic_odt dual_DS[4] = {
        },
        {0, 0, 0, 0}
 };
-static const struct dynamic_odt dual_SD[4] = {
+__maybe_unused static const struct dynamic_odt dual_SD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_ALL,
@@ -159,7 +159,7 @@ static const struct dynamic_odt dual_SD[4] = {
        }
 };

-static const struct dynamic_odt dual_SS[4] = {
+__maybe_unused static const struct dynamic_odt dual_SS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_ALL,
@@ -176,7 +176,7 @@ static const struct dynamic_odt dual_SS[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_D0[4] = {
+__maybe_unused static const struct dynamic_odt dual_D0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -193,7 +193,7 @@ static const struct dynamic_odt dual_D0[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_0D[4] = {
+__maybe_unused static const struct dynamic_odt dual_0D[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -210,7 +210,7 @@ static const struct dynamic_odt dual_0D[4] = {
        }
 };

-static const struct dynamic_odt dual_S0[4] = {
+__maybe_unused static const struct dynamic_odt dual_S0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,
@@ -223,7 +223,7 @@ static const struct dynamic_odt dual_S0[4] = {

 };

-static const struct dynamic_odt dual_0S[4] = {
+__maybe_unused static const struct dynamic_odt dual_0S[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -236,7 +236,7 @@ static const struct dynamic_odt dual_0S[4] = {

 };

-static const struct dynamic_odt odt_unknown[4] = {
+__maybe_unused static const struct dynamic_odt odt_unknown[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,
@@ -263,7 +263,7 @@ static const struct dynamic_odt odt_unknown[4] = {
        }
 };
 #elif defined(CONFIG_SYS_FSL_DDR3)
-static const struct dynamic_odt single_Q[4] = {
+__maybe_unused static const struct dynamic_odt single_Q[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS_AND_OTHER_DIMM,
@@ -290,7 +290,7 @@ static const struct dynamic_odt single_Q[4] = {
        }
 };

-static const struct dynamic_odt single_D[4] = {
+__maybe_unused static const struct dynamic_odt single_D[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -307,7 +307,7 @@ static const struct dynamic_odt single_D[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt single_S[4] = {
+__maybe_unused static const struct dynamic_odt single_S[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -319,7 +319,7 @@ static const struct dynamic_odt single_S[4] = {
        {0, 0, 0, 0},
 };

-static const struct dynamic_odt dual_DD[4] = {
+__maybe_unused static const struct dynamic_odt dual_DD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -346,7 +346,7 @@ static const struct dynamic_odt dual_DD[4] = {
        }
 };

-static const struct dynamic_odt dual_DS[4] = {
+__maybe_unused static const struct dynamic_odt dual_DS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -367,7 +367,7 @@ static const struct dynamic_odt dual_DS[4] = {
        },
        {0, 0, 0, 0}
 };
-static const struct dynamic_odt dual_SD[4] = {
+__maybe_unused static const struct dynamic_odt dual_SD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_ALL,
@@ -389,7 +389,7 @@ static const struct dynamic_odt dual_SD[4] = {
        }
 };

-static const struct dynamic_odt dual_SS[4] = {
+__maybe_unused static const struct dynamic_odt dual_SS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_ALL,
@@ -406,7 +406,7 @@ static const struct dynamic_odt dual_SS[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_D0[4] = {
+__maybe_unused static const struct dynamic_odt dual_D0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_SAME_DIMM,
@@ -423,7 +423,7 @@ static const struct dynamic_odt dual_D0[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_0D[4] = {
+__maybe_unused static const struct dynamic_odt dual_0D[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -440,7 +440,7 @@ static const struct dynamic_odt dual_0D[4] = {
        }
 };

-static const struct dynamic_odt dual_S0[4] = {
+__maybe_unused static const struct dynamic_odt dual_S0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,
@@ -453,7 +453,7 @@ static const struct dynamic_odt dual_S0[4] = {

 };

-static const struct dynamic_odt dual_0S[4] = {
+__maybe_unused static const struct dynamic_odt dual_0S[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -466,7 +466,7 @@ static const struct dynamic_odt dual_0S[4] = {

 };

-static const struct dynamic_odt odt_unknown[4] = {
+__maybe_unused static const struct dynamic_odt odt_unknown[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,
@@ -493,14 +493,14 @@ static const struct dynamic_odt odt_unknown[4] = {
        }
 };
 #else  /* CONFIG_SYS_FSL_DDR3 */
-static const struct dynamic_odt single_Q[4] = {
+__maybe_unused static const struct dynamic_odt single_Q[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt single_D[4] = {
+__maybe_unused static const struct dynamic_odt single_D[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -517,7 +517,7 @@ static const struct dynamic_odt single_D[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt single_S[4] = {
+__maybe_unused static const struct dynamic_odt single_S[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -529,7 +529,7 @@ static const struct dynamic_odt single_S[4] = {
        {0, 0, 0, 0},
 };

-static const struct dynamic_odt dual_DD[4] = {
+__maybe_unused static const struct dynamic_odt dual_DD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_OTHER_DIMM,
@@ -556,7 +556,7 @@ static const struct dynamic_odt dual_DD[4] = {
        }
 };

-static const struct dynamic_odt dual_DS[4] = {
+__maybe_unused static const struct dynamic_odt dual_DS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_OTHER_DIMM,
@@ -578,7 +578,7 @@ static const struct dynamic_odt dual_DS[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_SD[4] = {
+__maybe_unused static const struct dynamic_odt dual_SD[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_OTHER_DIMM,
@@ -600,7 +600,7 @@ static const struct dynamic_odt dual_SD[4] = {
        }
 };

-static const struct dynamic_odt dual_SS[4] = {
+__maybe_unused static const struct dynamic_odt dual_SS[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_OTHER_DIMM,
                FSL_DDR_ODT_OTHER_DIMM,
@@ -617,7 +617,7 @@ static const struct dynamic_odt dual_SS[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_D0[4] = {
+__maybe_unused static const struct dynamic_odt dual_D0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_ALL,
@@ -634,7 +634,7 @@ static const struct dynamic_odt dual_D0[4] = {
        {0, 0, 0, 0}
 };

-static const struct dynamic_odt dual_0D[4] = {
+__maybe_unused static const struct dynamic_odt dual_0D[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -651,7 +651,7 @@ static const struct dynamic_odt dual_0D[4] = {
        }
 };

-static const struct dynamic_odt dual_S0[4] = {
+__maybe_unused static const struct dynamic_odt dual_S0[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,
@@ -664,7 +664,7 @@ static const struct dynamic_odt dual_S0[4] = {

 };

-static const struct dynamic_odt dual_0S[4] = {
+__maybe_unused static const struct dynamic_odt dual_0S[4] = {
        {0, 0, 0, 0},
        {0, 0, 0, 0},
        {       /* cs2 */
@@ -677,7 +677,7 @@ static const struct dynamic_odt dual_0S[4] = {

 };

-static const struct dynamic_odt odt_unknown[4] = {
+__maybe_unused static const struct dynamic_odt odt_unknown[4] = {
        {       /* cs0 */
                FSL_DDR_ODT_NEVER,
                FSL_DDR_ODT_CS,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: drivers_ddr_fsl_options2.patch
Type: application/octet-stream
Size: 9880 bytes
Desc: drivers_ddr_fsl_options2.patch
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170327/c15e3b83/attachment.obj>

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

* [U-Boot] unused-const-variable warnings in FSL DDR driver
  2017-03-27  9:32                 ` Thomas Schaefer
@ 2017-04-04 14:52                   ` Tom Rini
  0 siblings, 0 replies; 11+ messages in thread
From: Tom Rini @ 2017-04-04 14:52 UTC (permalink / raw)
  To: u-boot

On Mon, Mar 27, 2017 at 09:32:26AM +0000, Thomas Schaefer wrote:

> > From: york sun [mailto:york.sun at nxp.com] 
> > Sent: Samstag, 25. März 2017 16:35
> > To: Thomas Schaefer; Tom Rini
> > Cc: u-boot at lists.denx.de
> > Re: Re: AW: [U-Boot] unused-const-variable warnings in FSL DDR driver
> >
> > Thomas,
> >
> > Can you put your patch together with proper commit message and signature? I prefer your solution than this one http://patchwork.ozlabs.org/patch/726353/
> >
> > York
> >
> 
> Hi York,
> 
> please find the patch in the attachment.
> 
> Best regards,
> Thomas
> 
> 
> commit 66dcf316bf2649e576f1b79aad3a5bb950d178d6
> Author: Thomas Schaefer <thomas.schaefer@kontron.com>
> Date:   Mon Mar 27 10:17:09 2017 +0200
> 
>     drivers: ddr: fix unused-const-variable warnings
> 
>     Depending on DDR configuration, gcc-6.x will show up unused-const-
>     variable messages. Use __maybe_unused specifier for all dynamic_odt
>     variable definitions to remove these warnings.
> 
>     Memory footprint will not increase as gcc will optimize out unused
>     constants.
> 
>     Signed-off-by: Thomas Schaefer <thomas.schaefer@kontron.com>
> 
> diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
> index d6a8fcb216..64aaa77047 100644

Reviewed-by: Tom Rini <trini@konsulko.com>



-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170404/7dededa6/attachment.sig>

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

end of thread, other threads:[~2017-04-04 14:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-09 10:32 [U-Boot] unused-const-variable warnings in FSL DDR driver Thomas Schaefer
2017-02-09 16:51 ` york sun
2017-02-09 17:17   ` Thomas Schaefer
2017-02-09 17:30     ` york sun
2017-02-09 17:45       ` Thomas Schaefer
2017-02-09 17:51         ` york sun
2017-02-09 21:26           ` Tom Rini
2017-02-10 10:00             ` Thomas Schaefer
2017-03-25 15:34               ` york sun
2017-03-27  9:32                 ` Thomas Schaefer
2017-04-04 14:52                   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.