LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] sparc: io_64.h: Replace io function-link macros
@ 2015-01-29 14:52 Ricardo Ribalda Delgado
  2015-01-29 16:02 ` Arnd Bergmann
  2015-01-31  2:07 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-01-29 14:52 UTC (permalink / raw)
  To: Arnd Bergmann, Will Deacon, sparclinux, linux-kernel
  Cc: Ricardo Ribalda Delgado

Function like macros cannot be assigned to function pointers. This patch
convert the function-like macros into object-macros, that the
precompiler will replace with the name of the final function.

With this patch this kind of code will work:

if (priv->mode_big_endian)
	priv.read = ioread32be;
else
	priv.read = ioread32;

Same approach has been taken on asm-generic/io.h

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 99082eab63449f9d spi/xilinx: Remove iowrite/ioread wrappers
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
 arch/sparc/include/asm/io_64.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 9b672be..50d4840 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -407,16 +407,16 @@ static inline void iounmap(volatile void __iomem *addr)
 {
 }
 
-#define ioread8(X)			readb(X)
-#define ioread16(X)			readw(X)
-#define ioread16be(X)			__raw_readw(X)
-#define ioread32(X)			readl(X)
-#define ioread32be(X)			__raw_readl(X)
-#define iowrite8(val,X)			writeb(val,X)
-#define iowrite16(val,X)		writew(val,X)
-#define iowrite16be(val,X)		__raw_writew(val,X)
-#define iowrite32(val,X)		writel(val,X)
-#define iowrite32be(val,X)		__raw_writel(val,X)
+#define ioread8			readb
+#define ioread16		readw
+#define ioread16be		__raw_readw
+#define ioread32		readl
+#define ioread32be		__raw_readl
+#define iowrite8		writeb
+#define iowrite16		writew
+#define iowrite16be		__raw_writew
+#define iowrite32		writel
+#define iowrite32be		__raw_writel
 
 /* Create a virtual mapping cookie for an IO port range */
 void __iomem *ioport_map(unsigned long port, unsigned int nr);
-- 
2.1.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-31  2:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-29 14:52 [PATCH] sparc: io_64.h: Replace io function-link macros Ricardo Ribalda Delgado
2015-01-29 16:02 ` Arnd Bergmann
2015-01-29 16:33   ` Ricardo Ribalda Delgado
2015-01-31  2:07 ` David Miller

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).