]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARM: ixp4xx: fix ioport_unmap definition
authorArnd Bergmann <arnd@arndb.de>
Fri, 10 Jun 2016 08:51:04 +0000 (10:51 +0200)
committerArnd Bergmann <arnd@arndb.de>
Thu, 27 Jul 2017 20:57:53 +0000 (22:57 +0200)
An empty macro definition can cause unexpected behavior, in
case of the ixp4xx ioport_unmap, we get two warnings:

drivers/net/wireless/marvell/libertas/if_cs.c: In function 'if_cs_release':
drivers/net/wireless/marvell/libertas/if_cs.c:826:3: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
   ioport_unmap(card->iobase);
drivers/vfio/pci/vfio_pci_rdwr.c: In function 'vfio_pci_vga_rw':
drivers/vfio/pci/vfio_pci_rdwr.c:230:15: error: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Werror=parentheses]
   is_ioport ? ioport_unmap(iomem) : iounmap(iomem);

This uses an inline function to define the macro in a safer way.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Krzysztof Halasa <khalasa@piap.pl>
arch/arm/mach-ixp4xx/include/mach/io.h

index d04d3ec97ac0370020a3a5cabc441a9c7e91d526..844e8ac593e270125980df3ecced92b6d6322f5e 100644 (file)
@@ -534,8 +534,15 @@ static inline void iowrite32_rep(void __iomem *addr, const void *vaddr,
 #endif
 }
 
-#define        ioport_map(port, nr)            ((void __iomem*)(port + PIO_OFFSET))
-#define        ioport_unmap(addr)
+#define ioport_map(port, nr) ioport_map(port, nr)
+static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
+{
+       return ((void __iomem*)((port) + PIO_OFFSET));
+}
+#define        ioport_unmap(addr) ioport_unmap(addr)
+static inline void ioport_unmap(void __iomem *addr)
+{
+}
 #endif /* CONFIG_PCI */
 
 #endif /* __ASM_ARM_ARCH_IO_H */