public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Revert "serial: 8250: Make SERIAL_8250_RUNTIME_UARTS work correctly"
@ 2013-06-03 13:38 Kyle McMartin
  2013-06-03 16:55 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle McMartin @ 2013-06-03 13:38 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, karthik.manamcheri, torvalds

This reverts commit cfcec52e9781f08948c6eb98198d65c45be75a70.

This regresses a longstanding behaviour on X86 systems, which end up with
PCI serial ports moving between ttyS4 and ttyS0 when you bisect to opposite
sides of this commit, resulting in the need to constantly modify the console
setting in order to bisect across it.

Please revert, we can work on solving this for ARM platforms in a less
disruptive way.

Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>

--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -2755,7 +2755,7 @@ static void __init serial8250_isa_init_ports(void)
 	if (nr_uarts > UART_NR)
 		nr_uarts = UART_NR;
 
-	for (i = 0; i < UART_NR; i++) {
+	for (i = 0; i < nr_uarts; i++) {
 		struct uart_8250_port *up = &serial8250_ports[i];
 		struct uart_port *port = &up->port;
 
@@ -2916,7 +2916,7 @@ static int __init serial8250_console_setup(struct console *co, char *options)
 	 * if so, search for the first available port that does have
 	 * console support.
 	 */
-	if (co->index >= UART_NR)
+	if (co->index >= nr_uarts)
 		co->index = 0;
 	port = &serial8250_ports[co->index].port;
 	if (!port->iobase && !port->membase)
@@ -2957,7 +2957,7 @@ int serial8250_find_port(struct uart_port *p)
 	int line;
 	struct uart_port *port;
 
-	for (line = 0; line < UART_NR; line++) {
+	for (line = 0; line < nr_uarts; line++) {
 		port = &serial8250_ports[line].port;
 		if (uart_match_port(p, port))
 			return line;
@@ -3110,7 +3110,7 @@ static int serial8250_remove(struct platform_device *dev)
 {
 	int i;
 
-	for (i = 0; i < UART_NR; i++) {
+	for (i = 0; i < nr_uarts; i++) {
 		struct uart_8250_port *up = &serial8250_ports[i];
 
 		if (up->port.dev == &dev->dev)
@@ -3178,7 +3178,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
 	/*
 	 * First, find a port entry which matches.
 	 */
-	for (i = 0; i < UART_NR; i++)
+	for (i = 0; i < nr_uarts; i++)
 		if (uart_match_port(&serial8250_ports[i].port, port))
 			return &serial8250_ports[i];
 
@@ -3187,7 +3187,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
 	 * free entry.  We look for one which hasn't been previously
 	 * used (indicated by zero iobase).
 	 */
-	for (i = 0; i < UART_NR; i++)
+	for (i = 0; i < nr_uarts; i++)
 		if (serial8250_ports[i].port.type == PORT_UNKNOWN &&
 		    serial8250_ports[i].port.iobase == 0)
 			return &serial8250_ports[i];
@@ -3196,7 +3196,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
 	 * That also failed.  Last resort is to find any entry which
 	 * doesn't have a real port associated with it.
 	 */
-	for (i = 0; i < UART_NR; i++)
+	for (i = 0; i < nr_uarts; i++)
 		if (serial8250_ports[i].port.type == PORT_UNKNOWN)
 			return &serial8250_ports[i];
 

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Revert "serial: 8250: Make SERIAL_8250_RUNTIME_UARTS work correctly"
@ 2013-06-03 20:05 Karthik Manamcheri
  0 siblings, 0 replies; 7+ messages in thread
From: Karthik Manamcheri @ 2013-06-03 20:05 UTC (permalink / raw)
  To: kyle, gregkh, linux-kernel, torvalds, linux-serial

> No worries, I undertand what Karthik is talking about, so I'll try to
> figure this out.
>
> CONFIG_SERIAL_8250_NR_UARTS=32
> CONFIG_SERIAL_8250_RUNTIME_UARTS=4

The description for "CONFIG_SERIAL_8250_RUNTIME_UARTS" is "Set this to the maximum number of serial ports you want the kernel to register at boot time."
Setting it to 4 means that you want to use 4 legacy ports! If you do not have any legacy UARTs, you are to set this to 0.

>
> is what was set in my .config, resulting in:
>
> [3.9.y]
> 0: uart:16550A port:00001030 irq:16 tx:16522 rx:0 RTS|CTS|DTR|CD
> 1: uart:unknown port:000002F8 irq:3
> 2: uart:unknown port:000003E8 irq:4
> 3: uart:unknown port:000002E8 irq:3
>
> [3.10-rc2]
> 0: uart:unknown port:000003F8 irq:4
> 1: uart:unknown port:000002F8 irq:3
> 2: uart:unknown port:000003E8 irq:4
> 3: uart:unknown port:000002E8 irq:3
> 4: uart:16550A port:00001030 irq:16 tx:16226 rx:0 RTS|CTS|DTR|CD

You have five ports because you set CONFIG_SERIAL_8250_RUNTIME_UARTS to 4 and then you have to PCI port. This is exactly what my change addressed. We had issues with the ghost ports created in the system. In your case, if you set CONFIG_SERIAL_8250_RUNTIME_UARTS to 0, you'll have just one port which is the working available port.

> There's undeniably something wrong if RUNTIME_UARTS=0 doesn't result
> in his serial ports showing up, I'll try to help debug that, but I
> think the 3.9 behaviour is desireable if no "legacy" uarts are found.

The variable nr_uarts is set to CONFIG_SERIAL_8250_RUNTIME_UARTS and if you set it to 0, then well, nothing will be created since you are looping to nr_uarts time, which is what I changed.

> regards, Kyle

Karthik Manamcheri | Software R&D | Instrument control products | National Instruments | (512) 683 6174

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

end of thread, other threads:[~2013-06-03 21:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-03 13:38 Revert "serial: 8250: Make SERIAL_8250_RUNTIME_UARTS work correctly" Kyle McMartin
2013-06-03 16:55 ` Greg KH
2013-06-03 17:03   ` Kyle McMartin
2013-06-03 17:09     ` Greg KH
     [not found]     ` <CAES2cWxYsxgjWzgNuhrWDoC7t2XrZQdeTe47ftWaCdg-2QoHUg@mail.gmail.com>
2013-06-03 20:32       ` Greg KH
     [not found]         ` <CAES2cWwPSpsqYdBHH51gVsCFdh_YVnADwzU+SKXqgzQwZMUVEA@mail.gmail.com>
2013-06-03 21:37           ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2013-06-03 20:05 Karthik Manamcheri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox