All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Han Xu <xhnjupt@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>, Han Xu <b45815@freescale.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] mtd: fsl-quadspi: Never build on SPARC
Date: Fri, 23 Oct 2015 09:55:07 -0700	[thread overview]
Message-ID: <20151023165507.GJ13239@google.com> (raw)
In-Reply-To: <CA+EcR214vdP=W2Sg0zGHUxywxWcjs6e=+ffW41j7eVvQXb42og@mail.gmail.com>

On Fri, Oct 23, 2015 at 11:31:47AM -0500, Han Xu wrote:
> On Thu, Oct 22, 2015 at 8:13 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> > On 10/22/2015 06:07 PM, Brian Norris wrote:
> >>
> >> + Han
> >>
> >> On Wed, Oct 21, 2015 at 07:31:46AM -0700, Guenter Roeck wrote:
> >>>
> >>> Attempts to build fsl-quadspi on SPARC fail with
> >>>
> >>> drivers/mtd/spi-nor/fsl-quadspi.c: In function 'fsl_qspi_init_lut':
> >>> drivers/mtd/spi-nor/fsl-quadspi.c:369:1: error:
> >>>         'LUT_0' undeclared (first use in this function)
> >>> drivers/mtd/spi-nor/fsl-quadspi.c:418:1: error:
> >>>         pasting "LUT_" and "(" does not give a valid preprocessing token
> >>> drivers/mtd/spi-nor/fsl-quadspi.c:418:2: error:
> >>>         implicit declaration of function 'LUT_'
> >>
> >>
> >> I don't think this is only a SPARC problem. The macro concatenation is
> >> generally suspect.
> >>
> >> I see that READ and WRITE are problems at least. If something like
> >> <linux/fs.h> gets included somehow, then these tokens resolve to
> >> integers or expressions before they fall through to literal
> >> concatentation, so we get 'LUT_0' or 'LUT_(1ULL << __REQ_WRITE)' instead
> >> of 'LUT_READ' and 'LUT_WRITE'.
> Hi Brian
> We have two options, either undef READ and WRITE before these macros
> or change the LUT_READ to LUT_FSLREAD and same as WRITE. So what's
> your opinion? Thanks.

I'd rule out #undef'ing other macros. That just looks like a hack.

There's at least one other option: de-obfuscate your code by directly
using macros instead of concatenating LUT_ to save a few characters. So:

#define LUT0(ins, pad, opr)                                             \
                (((opr) << OPRND0_SHIFT) | ((pad) << PAD0_SHIFT) | \
                ((ins) << INSTR0_SHIFT))

and for example:

	writel(LUT0(LUT_WRITE, LUT_PAD1, 0), base + QUADSPI_LUT(lut_base + 1));

I'd take either that option, or renaming your LUT_READ and LUT_WRITE to
LUT_FSL_READ and LUT_FSL_WRITE (not LUT_FSLREAD and LUT_FSLWRITE).

Brian

      parent reply	other threads:[~2015-10-23 16:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21 14:31 [PATCH -next] mtd: fsl-quadspi: Never build on SPARC Guenter Roeck
2015-10-23  1:07 ` Brian Norris
2015-10-23  1:13   ` Guenter Roeck
2015-10-23 16:31     ` Han Xu
2015-10-23 16:53       ` Guenter Roeck
2015-10-23 16:55       ` Brian Norris [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=20151023165507.GJ13239@google.com \
    --to=computersforpeace@gmail.com \
    --cc=b45815@freescale.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux@roeck-us.net \
    --cc=xhnjupt@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.