All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: David Wood <david@dtwood.co.uk>
Cc: Nick Krause <xerofoiffy@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	"open list:SPI SUBSYSTEM" <linux-spi@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Richard Weinberger <richard.weinberger@gmail.com>
Subject: Re: [PATCH] spi: Fix warning about redefinition
Date: Wed, 6 Aug 2014 12:04:12 -0700	[thread overview]
Message-ID: <20140806190412.GA5605@roeck-us.net> (raw)
In-Reply-To: <CAO+Sx3nGKN1jh0VB9NjcFCqV7ZmWWjJge0nohdUGta9BF60EWQ@mail.gmail.com>

On Wed, Aug 06, 2014 at 08:53:41PM +0200, David Wood wrote:
> On Wed, 6 Aug 2014 11:33:28 -0700, Guenter Roeck wrote:
> > On Wed, Aug 06, 2014 at 07:19:54PM +0200, Richard Weinberger wrote:
> > > On Wed, Aug 6, 2014 at 6:55 PM, Nick Krause <xerofoiffy@gmail.com> wrote:
> > > > Fix the following warnings about redefining READ and write
> > > >
> > > > drivers/spi/spi-omap-100k.c:73:0: warning: "WRITE" redefined [enabled by default]
> > > > include/linux/fs.h:193:0: note: this is the location of the previous definition
> > > > drivers/spi/spi-omap-100k.c:74:0: warning: "READ" redefined [enabled by default]
> > > > include/linux/fs.h:192:0: note: this is the location of the previous definition
> > > >
> > > > Signed-off-by: Nick Krause <xerofoiffy@gmail.com>
> > > > ---
> > > >  drivers/spi/spi-omap-100k.c | 6 ++++++
> > > >  1 file changed, 6 insertions(+)
> > > >
> > > > diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c
> > > > index 5e91858..eb8ae4e 100644
> > > > --- a/drivers/spi/spi-omap-100k.c
> > > > +++ b/drivers/spi/spi-omap-100k.c
> > > > @@ -70,6 +70,12 @@
> > > >  #define SPI_STATUS_WE                   (1UL << 1)
> > > >  #define SPI_STATUS_RD                   (1UL << 0)
> > > >
> > > > +#ifdef WRITE
> > > > +#undef WRITE
> > > > +#endif
> > > > +#ifdef READ
> > > > +#undef READ
> > > > +#endif
> > > >  #define WRITE 0
> > > >  #define READ  1
> > >
> > > Are these symbols even in use?
> > >
> >
> > It is always fun watching those patches flow by :-)
> > With the following patch:
> > diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c
> > index 5e91858..f72ddfc 100644
> > --- a/drivers/spi/spi-omap-100k.c
> > +++ b/drivers/spi/spi-omap-100k.c
> > @@ -70,8 +70,8 @@
> >  #define SPI_STATUS_WE                   (1UL << 1)
> >  #define SPI_STATUS_RD                   (1UL << 0)
> > -#define WRITE 0
> > -#define READ  1
> > +#undef WRITE
> > +#undef READ
> > [ just to make sure that no existing defines are used instead of the new ones ]
> > When compiling the resulting code with W=1, I get:
> > drivers/spi/spi-omap-100k.c: In function 'spi100k_read_data':
> > drivers/spi/spi-omap-100k.c:148:6: warning: variable 'dataH' set but not used
> > [-Wunused-but-set-variable]
> > So, one might conclude that the defines are not used.
> > Guenter
> 
> There's also no need to have the undefines, as the READ is defined as

That was purely to ensure that there is no hidden use through a macro
defined elsewhere, not a suggestion for a real patch.

Guenter

  reply	other threads:[~2014-08-06 19:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06 18:53 [PATCH] spi: Fix warning about redefinition David Wood
2014-08-06 18:53 ` David Wood
2014-08-06 19:04 ` Guenter Roeck [this message]
     [not found]   ` <20140806190412.GA5605-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-08-06 19:07     ` David Wood
2014-08-06 19:07       ` David Wood
2014-08-06 19:18       ` Guenter Roeck
  -- strict thread matches above, loose matches on Subject: below --
2014-08-06 16:55 Nick Krause
2014-08-06 16:55 ` Nick Krause
     [not found] ` <1407344128-9754-1-git-send-email-xerofoiffy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-06 17:19   ` Richard Weinberger
2014-08-06 17:19     ` Richard Weinberger
     [not found]     ` <CAFLxGvxfSD+dW1oUyKAqq8tUMHYS7fuJdsdRKOR94O+nD8RoMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-06 18:33       ` Guenter Roeck
2014-08-06 18:33         ` Guenter Roeck
2014-08-06 17:56   ` Mark Brown
2014-08-06 17:56     ` Mark Brown

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=20140806190412.GA5605@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=broonie@kernel.org \
    --cc=david@dtwood.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=richard.weinberger@gmail.com \
    --cc=xerofoiffy@gmail.com \
    /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 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.