lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090622220419.a60dbe71.akpm@linux-foundation.org>
Date:	Mon, 22 Jun 2009 22:04:19 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Richard Röjfors 
	<richard.rojfors.ext@...ean-labs.com>
Cc:	spi-devel-general@...ts.sourceforge.net,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	dbrownell@...rs.sourceforge.net, linuxppc-dev@...abs.org,
	Andrei Konovalov <akonovalov@...mvista.com>,
	John Linn <john.linn@...inx.com>
Subject: Re: [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@...ean-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.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ