Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: serial: 8250: Add generic port init macro

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>

authored by

Anton Wuerfel and committed by
Greg Kroah-Hartman
b3bd6668 b3d67936

+49 -62
+12
drivers/tty/serial/8250/8250.h
··· 92 92 #define SERIAL8250_SHARE_IRQS 0 93 93 #endif 94 94 95 + #define SERIAL8250_PORT_FLAGS(_base, _irq, _flags) \ 96 + { \ 97 + .iobase = _base, \ 98 + .irq = _irq, \ 99 + .uartclk = 1843200, \ 100 + .iotype = UPIO_PORT, \ 101 + .flags = UPF_BOOT_AUTOCONF | (_flags), \ 102 + } 103 + 104 + #define SERIAL8250_PORT(_base, _irq) SERIAL8250_PORT_FLAGS(_base, _irq, 0) 105 + 106 + 95 107 static inline int serial_in(struct uart_8250_port *up, int offset) 96 108 { 97 109 return up->port.serial_in(&up->port, offset);
+3 -10
drivers/tty/serial/8250/8250_accent.c
··· 10 10 #include <linux/init.h> 11 11 #include <linux/serial_8250.h> 12 12 13 - #define PORT(_base,_irq) \ 14 - { \ 15 - .iobase = _base, \ 16 - .irq = _irq, \ 17 - .uartclk = 1843200, \ 18 - .iotype = UPIO_PORT, \ 19 - .flags = UPF_BOOT_AUTOCONF, \ 20 - } 13 + #include "8250.h" 21 14 22 15 static struct plat_serial8250_port accent_data[] = { 23 - PORT(0x330, 4), 24 - PORT(0x338, 4), 16 + SERIAL8250_PORT(0x330, 4), 17 + SERIAL8250_PORT(0x338, 4), 25 18 { }, 26 19 }; 27 20
+17 -24
drivers/tty/serial/8250/8250_boca.c
··· 10 10 #include <linux/init.h> 11 11 #include <linux/serial_8250.h> 12 12 13 - #define PORT(_base,_irq) \ 14 - { \ 15 - .iobase = _base, \ 16 - .irq = _irq, \ 17 - .uartclk = 1843200, \ 18 - .iotype = UPIO_PORT, \ 19 - .flags = UPF_BOOT_AUTOCONF, \ 20 - } 13 + #include "8250.h" 21 14 22 15 static struct plat_serial8250_port boca_data[] = { 23 - PORT(0x100, 12), 24 - PORT(0x108, 12), 25 - PORT(0x110, 12), 26 - PORT(0x118, 12), 27 - PORT(0x120, 12), 28 - PORT(0x128, 12), 29 - PORT(0x130, 12), 30 - PORT(0x138, 12), 31 - PORT(0x140, 12), 32 - PORT(0x148, 12), 33 - PORT(0x150, 12), 34 - PORT(0x158, 12), 35 - PORT(0x160, 12), 36 - PORT(0x168, 12), 37 - PORT(0x170, 12), 38 - PORT(0x178, 12), 16 + SERIAL8250_PORT(0x100, 12), 17 + SERIAL8250_PORT(0x108, 12), 18 + SERIAL8250_PORT(0x110, 12), 19 + SERIAL8250_PORT(0x118, 12), 20 + SERIAL8250_PORT(0x120, 12), 21 + SERIAL8250_PORT(0x128, 12), 22 + SERIAL8250_PORT(0x130, 12), 23 + SERIAL8250_PORT(0x138, 12), 24 + SERIAL8250_PORT(0x140, 12), 25 + SERIAL8250_PORT(0x148, 12), 26 + SERIAL8250_PORT(0x150, 12), 27 + SERIAL8250_PORT(0x158, 12), 28 + SERIAL8250_PORT(0x160, 12), 29 + SERIAL8250_PORT(0x168, 12), 30 + SERIAL8250_PORT(0x170, 12), 31 + SERIAL8250_PORT(0x178, 12), 39 32 { }, 40 33 }; 41 34
+5 -12
drivers/tty/serial/8250/8250_exar_st16c554.c
··· 13 13 #include <linux/init.h> 14 14 #include <linux/serial_8250.h> 15 15 16 - #define PORT(_base,_irq) \ 17 - { \ 18 - .iobase = _base, \ 19 - .irq = _irq, \ 20 - .uartclk = 1843200, \ 21 - .iotype = UPIO_PORT, \ 22 - .flags = UPF_BOOT_AUTOCONF, \ 23 - } 16 + #include "8250.h" 24 17 25 18 static struct plat_serial8250_port exar_data[] = { 26 - PORT(0x100, 5), 27 - PORT(0x108, 5), 28 - PORT(0x110, 5), 29 - PORT(0x118, 5), 19 + SERIAL8250_PORT(0x100, 5), 20 + SERIAL8250_PORT(0x108, 5), 21 + SERIAL8250_PORT(0x110, 5), 22 + SERIAL8250_PORT(0x118, 5), 30 23 { }, 31 24 }; 32 25
+12 -16
drivers/tty/serial/8250/8250_fourport.c
··· 10 10 #include <linux/init.h> 11 11 #include <linux/serial_8250.h> 12 12 13 - #define PORT(_base,_irq) \ 14 - { \ 15 - .iobase = _base, \ 16 - .irq = _irq, \ 17 - .uartclk = 1843200, \ 18 - .iotype = UPIO_PORT, \ 19 - .flags = UPF_BOOT_AUTOCONF | UPF_FOURPORT, \ 20 - } 13 + #include "8250.h" 14 + 15 + #define SERIAL8250_FOURPORT(_base, _irq) \ 16 + SERIAL8250_PORT_FLAGS(_base, _irq, UPF_FOURPORT) 21 17 22 18 static struct plat_serial8250_port fourport_data[] = { 23 - PORT(0x1a0, 9), 24 - PORT(0x1a8, 9), 25 - PORT(0x1b0, 9), 26 - PORT(0x1b8, 9), 27 - PORT(0x2a0, 5), 28 - PORT(0x2a8, 5), 29 - PORT(0x2b0, 5), 30 - PORT(0x2b8, 5), 19 + SERIAL8250_FOURPORT(0x1a0, 9), 20 + SERIAL8250_FOURPORT(0x1a8, 9), 21 + SERIAL8250_FOURPORT(0x1b0, 9), 22 + SERIAL8250_FOURPORT(0x1b8, 9), 23 + SERIAL8250_FOURPORT(0x2a0, 5), 24 + SERIAL8250_FOURPORT(0x2a8, 5), 25 + SERIAL8250_FOURPORT(0x2b0, 5), 26 + SERIAL8250_FOURPORT(0x2b8, 5), 31 27 { }, 32 28 }; 33 29