public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ddr:fsl: Fix warnings on gcc-6.x
Date: Fri, 10 Feb 2017 16:46:22 -0500	[thread overview]
Message-ID: <20170210214622.GD26129@bill-the-cat> (raw)
In-Reply-To: <AM4PR0401MB1732F9275EEEECE53872B4F09A440@AM4PR0401MB1732.eurprd04.prod.outlook.com>

On Fri, Feb 10, 2017 at 04:45:12PM +0000, york sun wrote:
> On 02/09/2017 03:10 PM, Tom Rini wrote:
> > With gcc-6.x we will see many warnings like:
> > warning: ?dual_0S? defined but not used [-Wunused-const-variable=]
> >
> > Depending on exactly what DDR choices are or are not enabled when we use
> > this file.  So we use slightly more exact #ifdef tests in order to
> > silence the warnings.
> >
> > Reported-by: Thomas Schaefer <Thomas.Schaefer@kontron.com>
> > Cc: York Sun <york.sun@nxp.com>
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > ---
> >  drivers/ddr/fsl/options.c | 27 ++++++++++++++++++++++++---
> >  1 file changed, 24 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
> > index d6a8fcb216a4..7f7c16ced6f3 100644
> > --- a/drivers/ddr/fsl/options.c
> > +++ b/drivers/ddr/fsl/options.c
> > @@ -29,10 +29,12 @@ struct dynamic_odt {
> >  	unsigned int odt_rtt_wr;
> >  };
> >
> > -#ifdef CONFIG_SYS_FSL_DDR4
> > +#if defined(CONFIG_SYS_FSL_DDR4) && defined(CONFIG_DIMM_SLOTS_PER_CTLR)
> >  /* Quad rank is not verified yet due availability.
> >   * Replacing 20 OHM with 34 OHM since DDR4 doesn't have 20 OHM option
> >   */
> > +#if (CONFIG_DIMM_SLOTS_PER_CTLR == 1) || ((CONFIG_DIMM_SLOTS_PER_CTLR == 2) && \
> > +				defined(CONFIG_FSL_DDR_FIRST_SLOT_QUAD_CAPABLE))
> >  static const struct dynamic_odt single_Q[4] = {
> >  	{	/* cs0 */
> >  		FSL_DDR_ODT_NEVER,
> > @@ -59,7 +61,9 @@ static const struct dynamic_odt single_Q[4] = {
> >  		DDR4_RTT_120_OHM
> >  	}
> >  };
> > +#endif
> >
> > +#if (CONFIG_DIMM_SLOTS_PER_CTLR == 1)
> >  static const struct dynamic_odt single_D[4] = {
> >  	{	/* cs0 */
> >  		FSL_DDR_ODT_NEVER,
> > @@ -89,6 +93,8 @@ static const struct dynamic_odt single_S[4] = {
> >  	{0, 0, 0, 0},
> >  };
> >
> > +#elif (CONFIG_DIMM_SLOTS_PER_CTLR == 2)
> > +
> 
> <snip>
> 
> Tom,
> 
> What do you think about using __maybe_unused instead? As Thomas Schaefer 
> has verified that GCC optimized out unused constants.

Yeah, that ends up being clearer I think esp since we're not concerned
with the data being included by accident.  Thanks!

-- 
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/20170210/2c92f466/attachment.sig>

      reply	other threads:[~2017-02-10 21:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09 23:10 [U-Boot] [PATCH] ddr:fsl: Fix warnings on gcc-6.x Tom Rini
2017-02-10 16:45 ` york sun
2017-02-10 21:46   ` Tom Rini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170210214622.GD26129@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox