lkml.org 
[lkml]   [2009]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RESEND][PATCH] SPI: xilinx_spi: Added platform driver and support for DS570

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.




\
 
 \ /
  Last update: 2009-06-23 07:07    [W:0.111 / U:0.476 seconds]
©2003-2014 Jasper Spaans. Advertise on this site