From: Andrew Morton <akpm@linux-foundation.org>
To: "Richard Röjfors" <richard.rojfors.ext@mocean-labs.com>
Cc: dbrownell@users.sourceforge.net,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linuxppc-dev@ozlabs.org, spi-devel-general@lists.sourceforge.net,
Andrei Konovalov <akonovalov@ru.mvista.com>,
John, Linn <john.linn@xilinx.com>
Subject: Re: [RESEND][PATCH] SPI: xilinx_spi: Added platform driver and support for DS570
Date: Mon, 22 Jun 2009 22:04:19 -0700 [thread overview]
Message-ID: <20090622220419.a60dbe71.akpm@linux-foundation.org> (raw)
In-Reply-To: <4A366622.2050606@mocean-labs.com>
This appears to be a ppc thing, so let's cc that list. Let's also cc
the driver's author and other contributors. Please cc these people on
future versions of the patch also.
On Mon, 15 Jun 2009 17:17:54 +0200 Richard R__jfors <richard.rojfors.ext@mocean-labs.com> wrote:
> This patch splits xilinx_spi into three parts, an OF and a platform
> driver and generic part.
>
> The generic part now also works on X86 and also supports the Xilinx
> SPI IP DS570
>
>
> ...
>
> +#ifndef CONFIG_PPC
> +#define in_8(addr) ioread8(addr)
> +#define in_be16(addr) ioread16(addr)
> +#define in_be32(addr) ioread32(addr)
> +
> +#define out_8(addr, b) iowrite8(b, addr)
> +#define out_be16(addr, w) iowrite16(w, addr)
> +#define out_be32(addr, l) iowrite32(l, addr)
> +#endif
Why do we need these?
> +#define XSPI_WRITE8(xspi, offs, val) \
> + do { \
> + if (xspi->model == XILINX_SPI_MODEL_DS464) \
> + out_8(xspi->regs + offs, (val) & 0xff); \
> + else \
> + XSPI_WRITE32(xspi, offs, val); \
> + } while (0)
> +
> +#define XSPI_WRITE16(xspi, offs, val) \
> + do { \
> + if (xspi->model == XILINX_SPI_MODEL_DS464) \
> + out_be16(xspi->regs + offs, (val) & 0xffff); \
> + else \
> + XSPI_WRITE32(xspi, offs, val); \
> + } while (0)
> +
> +#define XSPI_WRITE32(xspi, offs, val) \
> + out_be32(xspi->regs + offs, val)
> +
> +#define XSPI_READ8(xspi, offs) \
> + (xspi->model == XILINX_SPI_MODEL_DS464) ? \
> + in_8(xspi->regs + offs) : XSPI_READ32(xspi, offs)
> +
> +#define XSPI_READ16(xspi, offs) \
> + (xspi->model == XILINX_SPI_MODEL_DS464) ? \
> + in_be16(xspi->regs + offs) : XSPI_READ32(xspi, offs)
> +
> +#define XSPI_READ32(xspi, offs) \
> + in_be32(xspi->regs + offs)
I'm seeing no reason why these had to be implemented as macros.
They're ugly, add considerable code bloat and, because they evaluate
their args multiple times they will fail if passed as expression with
side-effects.
I suggest that they be reimplemented as lower-case, uninlined C functions.
parent reply other threads:[~2009-06-23 5:04 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <4A366622.2050606@mocean-labs.com>]
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=20090622220419.a60dbe71.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=akonovalov@ru.mvista.com \
--cc=dbrownell@users.sourceforge.net \
--cc=john.linn@xilinx.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=richard.rojfors.ext@mocean-labs.com \
--cc=spi-devel-general@lists.sourceforge.net \
/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;
as well as URLs for NNTP newsgroup(s).