]> git.karo-electronics.de Git - linux-beck.git/commitdiff
tty: serial: 8250: Add generic port init macro
authorAnton Wuerfel <anton.wuerfel@fau.de>
Thu, 14 Jan 2016 15:08:24 +0000 (16:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 7 Feb 2016 07:15:53 +0000 (23:15 -0800)
This patch removes redundant 8250 port initialization macros and
replaces them by a single generic base-macro, which is specialized
as needed.

Signed-off-by: Anton Würfel <anton.wuerfel@fau.de>
Signed-off-by: Phillip Raffeck <phillip.raffeck@fau.de>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-kernel@i4.cs.fau.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250.h
drivers/tty/serial/8250/8250_accent.c
drivers/tty/serial/8250/8250_boca.c
drivers/tty/serial/8250/8250_exar_st16c554.c
drivers/tty/serial/8250/8250_fourport.c

index ce587c03efc38df9977344844c23e4a60043208d..047a7ba6796ad1f3b96e1f3eb9e3bab3a167a01b 100644 (file)
@@ -92,6 +92,18 @@ struct serial8250_config {
 #define SERIAL8250_SHARE_IRQS 0
 #endif
 
+#define SERIAL8250_PORT_FLAGS(_base, _irq, _flags)             \
+       {                                                       \
+               .iobase         = _base,                        \
+               .irq            = _irq,                         \
+               .uartclk        = 1843200,                      \
+               .iotype         = UPIO_PORT,                    \
+               .flags          = UPF_BOOT_AUTOCONF | (_flags), \
+       }
+
+#define SERIAL8250_PORT(_base, _irq) SERIAL8250_PORT_FLAGS(_base, _irq, 0)
+
+
 static inline int serial_in(struct uart_8250_port *up, int offset)
 {
        return up->port.serial_in(&up->port, offset);
index 34b51c651192e8d81a6c9c9453c4a206a3405a20..522aeae05192c11ada5310e0d9628ae3fc3da0c7 100644 (file)
 #include <linux/init.h>
 #include <linux/serial_8250.h>
 
-#define PORT(_base,_irq)                               \
-       {                                               \
-               .iobase         = _base,                \
-               .irq            = _irq,                 \
-               .uartclk        = 1843200,              \
-               .iotype         = UPIO_PORT,            \
-               .flags          = UPF_BOOT_AUTOCONF,    \
-       }
+#include "8250.h"
 
 static struct plat_serial8250_port accent_data[] = {
-       PORT(0x330, 4),
-       PORT(0x338, 4),
+       SERIAL8250_PORT(0x330, 4),
+       SERIAL8250_PORT(0x338, 4),
        { },
 };
 
index d125dc107985b28f59bb302a636a3e3aa3cc2028..a63b5998e383059cb5261cd7606ceae8e6bfec34 100644 (file)
 #include <linux/init.h>
 #include <linux/serial_8250.h>
 
-#define PORT(_base,_irq)                               \
-       {                                               \
-               .iobase         = _base,                \
-               .irq            = _irq,                 \
-               .uartclk        = 1843200,              \
-               .iotype         = UPIO_PORT,            \
-               .flags          = UPF_BOOT_AUTOCONF,    \
-       }
+#include "8250.h"
 
 static struct plat_serial8250_port boca_data[] = {
-       PORT(0x100, 12),
-       PORT(0x108, 12),
-       PORT(0x110, 12),
-       PORT(0x118, 12),
-       PORT(0x120, 12),
-       PORT(0x128, 12),
-       PORT(0x130, 12),
-       PORT(0x138, 12),
-       PORT(0x140, 12),
-       PORT(0x148, 12),
-       PORT(0x150, 12),
-       PORT(0x158, 12),
-       PORT(0x160, 12),
-       PORT(0x168, 12),
-       PORT(0x170, 12),
-       PORT(0x178, 12),
+       SERIAL8250_PORT(0x100, 12),
+       SERIAL8250_PORT(0x108, 12),
+       SERIAL8250_PORT(0x110, 12),
+       SERIAL8250_PORT(0x118, 12),
+       SERIAL8250_PORT(0x120, 12),
+       SERIAL8250_PORT(0x128, 12),
+       SERIAL8250_PORT(0x130, 12),
+       SERIAL8250_PORT(0x138, 12),
+       SERIAL8250_PORT(0x140, 12),
+       SERIAL8250_PORT(0x148, 12),
+       SERIAL8250_PORT(0x150, 12),
+       SERIAL8250_PORT(0x158, 12),
+       SERIAL8250_PORT(0x160, 12),
+       SERIAL8250_PORT(0x168, 12),
+       SERIAL8250_PORT(0x170, 12),
+       SERIAL8250_PORT(0x178, 12),
        { },
 };
 
index bf53aabf9b5e34919c9967f6d7e94106b04738b1..3a7cb8262bb9fa2701051d19f89a3354dd3e2e25 100644 (file)
 #include <linux/init.h>
 #include <linux/serial_8250.h>
 
-#define PORT(_base,_irq)                               \
-       {                                               \
-               .iobase         = _base,                \
-               .irq            = _irq,                 \
-               .uartclk        = 1843200,              \
-               .iotype         = UPIO_PORT,            \
-               .flags          = UPF_BOOT_AUTOCONF,    \
-       }
+#include "8250.h"
 
 static struct plat_serial8250_port exar_data[] = {
-       PORT(0x100, 5),
-       PORT(0x108, 5),
-       PORT(0x110, 5),
-       PORT(0x118, 5),
+       SERIAL8250_PORT(0x100, 5),
+       SERIAL8250_PORT(0x108, 5),
+       SERIAL8250_PORT(0x110, 5),
+       SERIAL8250_PORT(0x118, 5),
        { },
 };
 
index be1582609626b433739f15879c8697fe97e9b07d..4045180a8cfca0536fb46cfa6f1c37f301fabf1a 100644 (file)
 #include <linux/init.h>
 #include <linux/serial_8250.h>
 
-#define PORT(_base,_irq)                                               \
-       {                                                               \
-               .iobase         = _base,                                \
-               .irq            = _irq,                                 \
-               .uartclk        = 1843200,                              \
-               .iotype         = UPIO_PORT,                            \
-               .flags          = UPF_BOOT_AUTOCONF | UPF_FOURPORT,     \
-       }
+#include "8250.h"
+
+#define SERIAL8250_FOURPORT(_base, _irq) \
+       SERIAL8250_PORT_FLAGS(_base, _irq, UPF_FOURPORT)
 
 static struct plat_serial8250_port fourport_data[] = {
-       PORT(0x1a0, 9),
-       PORT(0x1a8, 9),
-       PORT(0x1b0, 9),
-       PORT(0x1b8, 9),
-       PORT(0x2a0, 5),
-       PORT(0x2a8, 5),
-       PORT(0x2b0, 5),
-       PORT(0x2b8, 5),
+       SERIAL8250_FOURPORT(0x1a0, 9),
+       SERIAL8250_FOURPORT(0x1a8, 9),
+       SERIAL8250_FOURPORT(0x1b0, 9),
+       SERIAL8250_FOURPORT(0x1b8, 9),
+       SERIAL8250_FOURPORT(0x2a0, 5),
+       SERIAL8250_FOURPORT(0x2a8, 5),
+       SERIAL8250_FOURPORT(0x2b0, 5),
+       SERIAL8250_FOURPORT(0x2b8, 5),
        { },
 };