* [PATCH] serial: 8250: Make SERIAL8250_CONFIG_RUNTIME_UARTS work correctly
@ 2013-03-28 20:20 Karthik Manamcheri
2013-03-28 21:22 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Karthik Manamcheri @ 2013-03-28 20:20 UTC (permalink / raw)
To: linux-serial; +Cc: Karthik Manamcheri
Currently, if you set SERIAL8250_CONFIG_RUNTIME_UARTS
to 0, you cannot get any working ports. This change
will enable serial8250_register_port to successfully
register a port even if SERIAL8250_CONFIG_RUNTIME_UARTS
is 0. If you need legacy ports, you will set the
SERIAL8250_CONFIG_RUNTIME_UARTS to the number of legacy
ports you need created at boot time.
Signed-off-by: Karthik Manamcheri <karthik.manamcheri@ni.com>
---
drivers/tty/serial/8250/8250.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index cf6a538..65f1478 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.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 < nr_uarts; i++) {
+ for (i = 0; i < UART_NR; 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 >= nr_uarts)
+ if (co->index >= UART_NR)
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 < nr_uarts; line++) {
+ for (line = 0; line < UART_NR; 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 < nr_uarts; i++) {
+ for (i = 0; i < UART_NR; 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 < nr_uarts; i++)
+ for (i = 0; i < UART_NR; 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 < nr_uarts; i++)
+ for (i = 0; i < UART_NR; 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 < nr_uarts; i++)
+ for (i = 0; i < UART_NR; i++)
if (serial8250_ports[i].port.type == PORT_UNKNOWN)
return &serial8250_ports[i];
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] serial: 8250: Make SERIAL8250_CONFIG_RUNTIME_UARTS work correctly
2013-03-28 20:20 [PATCH] serial: 8250: Make SERIAL8250_CONFIG_RUNTIME_UARTS work correctly Karthik Manamcheri
@ 2013-03-28 21:22 ` Greg KH
[not found] ` <OFCAF9F7AE.C68748CA-ON86257B3C.00771424-86257B3C.00798499@ni.com>
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2013-03-28 21:22 UTC (permalink / raw)
To: Karthik Manamcheri; +Cc: linux-serial, Karthik Manamcheri
On Thu, Mar 28, 2013 at 03:20:43PM -0500, Karthik Manamcheri wrote:
> Currently, if you set SERIAL8250_CONFIG_RUNTIME_UARTS
There is no such config option, please get it correct.
> to 0, you cannot get any working ports.
Isn't that on purpose? Why would you ever set that value to 0 and
expect things to work?
> This change will enable serial8250_register_port to successfully
> register a port even if SERIAL8250_CONFIG_RUNTIME_UARTS
> is 0. If you need legacy ports, you will set the
> SERIAL8250_CONFIG_RUNTIME_UARTS to the number of legacy
> ports you need created at boot time.
I don't understand, if you set the option to be 0, how can anything
work here?
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] serial: 8250: Make SERIAL8250_CONFIG_RUNTIME_UARTS work correctly
[not found] ` <OFCAF9F7AE.C68748CA-ON86257B3C.00771424-86257B3C.00798499@ni.com>
@ 2013-03-28 22:15 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2013-03-28 22:15 UTC (permalink / raw)
To: Karthik Manamcheri; +Cc: Karthik Manamcheri, linux-serial
A: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
On Thu, Mar 28, 2013 at 05:07:18PM -0500, Karthik Manamcheri wrote:
> The config option should have been SERIAL_8250_RUNTIME_UARTS. I mis-typed the
> name of the config option.
>
> Consider a situation where I have an ARM based system and therefore no legacy
> ports. Say, I have two memory-mapped ports. I use device tree to describe the
> ports. What would be the config options I set so that I get only the two ports
> in my system? I do not want legacy ports being created automatically and I want
> it to be flexible enough that it creates the devices based only on the device
> tree. I expected setting SERIAL_8250_RUNTIME_UARTS = 0 to work because the
> description said, "Set this to the maximum number of serial ports you want the
> kernel to register at boot time." Unfortunately, even though
> SERIAL_8250_NR_UARTS was set to a default value of 4, I did not get any device
> nodes (because SERIAL_8250_RUNTIME_UARTS was 0). This is what this patch is
> trying to address.
>
> SERIAL_8250_NR_UARTS controls the maximum number of ports you can support.
> SERIAL_8250_RUNTIME_UARTS specifies the number of ports you want to create
> automatically for legacy ports at boot time. All other ports will be created
> when serial8250_register_port is called (and if does not exceed the total
> number of supported ports as specified by SERIAL_8250_NR_UARTS).
Great, care to put all of that into the changelog section of the patch
and resend it after fixing the config option as well?
thanks,
greg "I have to drag it out of people" k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-28 22:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-28 20:20 [PATCH] serial: 8250: Make SERIAL8250_CONFIG_RUNTIME_UARTS work correctly Karthik Manamcheri
2013-03-28 21:22 ` Greg KH
[not found] ` <OFCAF9F7AE.C68748CA-ON86257B3C.00771424-86257B3C.00798499@ni.com>
2013-03-28 22:15 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.