Thread (13 messages) 13 messages, 4 authors, 2018-10-08

[PATCH v3 1/5] spi: spi-mem: Add driver for NXP FlexSPI controller

From: Boris Brezillon <hidden>
Date: 2018-10-01 09:10:01
Also in: linux-devicetree, linux-spi, lkml

On Mon, 1 Oct 2018 09:02:32 +0000
Yogesh Narayan Gaur [off-list ref] wrote:
quoted
quoted
static void fspi_writel(struct nxp_fspi *f, u32 val, void __iomem
*addr) {
	if (f->big_endian)
		iowrite32be(val, addr);
	else
		iowrite32(val, addr);
}


static u32 fspi_readl(struct nxp_fspi *f, void __iomem *addr) {
	if (f->big_endian)
		return ioread32be(addr);
	else
		return ioread32(addr);
}  
I introduced the ->read/write() hooks in the QSPI driver because I
was told to remove the conditional in the read/write path, but I
can't really tell if this really makes any difference.
  
Yes, I have taken these hooks by looking into the comments received
for Frieder's QSPI patch series. For me this looks more clean and can
be decided in the controller initialization sequence which hook would
going to be invoked.

Well, depending on your CPU, the indirect branch (caused by the
function pointer call) might have an higher cost than the conditional
branch. Not sure we care about such micro-optimizations though.
Regarding the readability aspect, I still prefer my version, but I
guess that's a matter of taste.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help