[PATCH -next 11/17] serial: 8250: Initialize fixed type fields when setting defaults

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prepare for 8250 split; move fixed type initialization into
serial8250_set_defaults(). This enables uart_config[] array to remain
file scope in base port operations after the split.

NB: the call to serial8250_init_fixed_type_port() from
serial8250_register_ports() was added by commit b5d228cc4f85
("serial: copy UART properties of UPF_FIXED_TYPE ports provisioned
using early_serial_setup") specifically to support ports initialized
by early_serial_setup(). Since serial8250_set_defaults() is called
from early_serial_setup(), fixed type initialization is now already
handled there before serial8250_register_ports() is called.

Signed-off-by: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
---
 drivers/tty/serial/8250/8250_core.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 3e88cd8..f06bdea 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -3149,6 +3149,17 @@ static void serial8250_set_defaults(struct uart_8250_port *up)
 {
 	struct uart_port *port = &up->port;
 
+	if (up->port.flags & UPF_FIXED_TYPE) {
+		unsigned int type = up->port.type;
+
+		if (!up->port.fifosize)
+			up->port.fifosize = uart_config[type].fifo_size;
+		if (!up->tx_loadsz)
+			up->tx_loadsz = uart_config[type].tx_loadsz;
+		if (!up->capabilities)
+			up->capabilities = uart_config[type].flags;
+	}
+
 	set_io_from_upio(port);
 }
 
@@ -3209,18 +3220,6 @@ static void __init serial8250_isa_init_ports(void)
 	}
 }
 
-static void
-serial8250_init_fixed_type_port(struct uart_8250_port *up, unsigned int type)
-{
-	up->port.type = type;
-	if (!up->port.fifosize)
-		up->port.fifosize = uart_config[type].fifo_size;
-	if (!up->tx_loadsz)
-		up->tx_loadsz = uart_config[type].tx_loadsz;
-	if (!up->capabilities)
-		up->capabilities = uart_config[type].flags;
-}
-
 static void __init
 serial8250_register_ports(struct uart_driver *drv, struct device *dev)
 {
@@ -3237,9 +3236,6 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
 		if (skip_txen_test)
 			up->port.flags |= UPF_NO_TXEN_TEST;
 
-		if (up->port.flags & UPF_FIXED_TYPE)
-			serial8250_init_fixed_type_port(up, up->port.type);
-
 		uart_add_one_port(drv, &up->port);
 	}
 }
@@ -3758,7 +3754,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 			uart->port.flags |= UPF_NO_TXEN_TEST;
 
 		if (up->port.flags & UPF_FIXED_TYPE)
-			serial8250_init_fixed_type_port(uart, up->port.type);
+			uart->port.type = up->port.type;
 
 		serial8250_set_defaults(uart);
 
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux