Skip to content

Commit 0581445

Browse files
author
Linus Torvalds
committed
Merge master.kernel.org:/home/rmk/linux-2.6-serial
2 parents 8e9c238 + a61c2d7 commit 0581445

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

Documentation/kernel-parameters.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,8 @@ running once the system is up.
998998

999999
nowb [ARM]
10001000

1001+
nr_uarts= [SERIAL] maximum number of UARTs to be registered.
1002+
10011003
opl3= [HW,OSS]
10021004
Format: <io>
10031005

drivers/serial/8250.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
*/
5555
static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
5656

57+
static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS;
58+
5759
/*
5860
* Debugging.
5961
*/
@@ -2118,7 +2120,7 @@ static void __init serial8250_isa_init_ports(void)
21182120
return;
21192121
first = 0;
21202122

2121-
for (i = 0; i < UART_NR; i++) {
2123+
for (i = 0; i < nr_uarts; i++) {
21222124
struct uart_8250_port *up = &serial8250_ports[i];
21232125

21242126
up->port.line = i;
@@ -2137,7 +2139,7 @@ static void __init serial8250_isa_init_ports(void)
21372139
}
21382140

21392141
for (i = 0, up = serial8250_ports;
2140-
i < ARRAY_SIZE(old_serial_port) && i < UART_NR;
2142+
i < ARRAY_SIZE(old_serial_port) && i < nr_uarts;
21412143
i++, up++) {
21422144
up->port.iobase = old_serial_port[i].port;
21432145
up->port.irq = irq_canonicalize(old_serial_port[i].irq);
@@ -2159,7 +2161,7 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
21592161

21602162
serial8250_isa_init_ports();
21612163

2162-
for (i = 0; i < UART_NR; i++) {
2164+
for (i = 0; i < nr_uarts; i++) {
21632165
struct uart_8250_port *up = &serial8250_ports[i];
21642166

21652167
up->port.dev = dev;
@@ -2262,7 +2264,7 @@ static int serial8250_console_setup(struct console *co, char *options)
22622264
* if so, search for the first available port that does have
22632265
* console support.
22642266
*/
2265-
if (co->index >= UART_NR)
2267+
if (co->index >= nr_uarts)
22662268
co->index = 0;
22672269
port = &serial8250_ports[co->index].port;
22682270
if (!port->iobase && !port->membase)
@@ -2298,7 +2300,7 @@ static int __init find_port(struct uart_port *p)
22982300
int line;
22992301
struct uart_port *port;
23002302

2301-
for (line = 0; line < UART_NR; line++) {
2303+
for (line = 0; line < nr_uarts; line++) {
23022304
port = &serial8250_ports[line].port;
23032305
if (uart_match_port(p, port))
23042306
return line;
@@ -2420,7 +2422,7 @@ static int __devexit serial8250_remove(struct platform_device *dev)
24202422
{
24212423
int i;
24222424

2423-
for (i = 0; i < UART_NR; i++) {
2425+
for (i = 0; i < nr_uarts; i++) {
24242426
struct uart_8250_port *up = &serial8250_ports[i];
24252427

24262428
if (up->port.dev == &dev->dev)
@@ -2487,7 +2489,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
24872489
/*
24882490
* First, find a port entry which matches.
24892491
*/
2490-
for (i = 0; i < UART_NR; i++)
2492+
for (i = 0; i < nr_uarts; i++)
24912493
if (uart_match_port(&serial8250_ports[i].port, port))
24922494
return &serial8250_ports[i];
24932495

@@ -2496,7 +2498,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
24962498
* free entry. We look for one which hasn't been previously
24972499
* used (indicated by zero iobase).
24982500
*/
2499-
for (i = 0; i < UART_NR; i++)
2501+
for (i = 0; i < nr_uarts; i++)
25002502
if (serial8250_ports[i].port.type == PORT_UNKNOWN &&
25012503
serial8250_ports[i].port.iobase == 0)
25022504
return &serial8250_ports[i];
@@ -2505,7 +2507,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
25052507
* That also failed. Last resort is to find any entry which
25062508
* doesn't have a real port associated with it.
25072509
*/
2508-
for (i = 0; i < UART_NR; i++)
2510+
for (i = 0; i < nr_uarts; i++)
25092511
if (serial8250_ports[i].port.type == PORT_UNKNOWN)
25102512
return &serial8250_ports[i];
25112513

@@ -2590,8 +2592,11 @@ static int __init serial8250_init(void)
25902592
{
25912593
int ret, i;
25922594

2595+
if (nr_uarts > UART_NR)
2596+
nr_uarts = UART_NR;
2597+
25932598
printk(KERN_INFO "Serial: 8250/16550 driver $Revision: 1.90 $ "
2594-
"%d ports, IRQ sharing %sabled\n", (int) UART_NR,
2599+
"%d ports, IRQ sharing %sabled\n", nr_uarts,
25952600
share_irqs ? "en" : "dis");
25962601

25972602
for (i = 0; i < NR_IRQS; i++)
@@ -2651,6 +2656,9 @@ module_param(share_irqs, uint, 0644);
26512656
MODULE_PARM_DESC(share_irqs, "Share IRQs with other non-8250/16x50 devices"
26522657
" (unsafe)");
26532658

2659+
module_param(nr_uarts, uint, 0644);
2660+
MODULE_PARM_DESC(nr_uarts, "Maximum number of UARTs supported. (1-" __MODULE_STRING(CONFIG_SERIAL_8250_NR_UARTS) ")");
2661+
26542662
#ifdef CONFIG_SERIAL_8250_RSA
26552663
module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444);
26562664
MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");

drivers/serial/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ config SERIAL_8250_NR_UARTS
9595
PCI enumeration and any ports that may be added at run-time
9696
via hot-plug, or any ISA multi-port serial cards.
9797

98+
config SERIAL_8250_RUNTIME_UARTS
99+
int "Number of 8250/16550 serial ports to register at runtime"
100+
depends on SERIAL_8250
101+
default "4"
102+
help
103+
Set this to the maximum number of serial ports you want
104+
the kernel to register at boot time. This can be overriden
105+
with the module parameter "nr_uarts", or boot-time parameter
106+
8250.nr_uarts
107+
98108
config SERIAL_8250_EXTENDED
99109
bool "Extended 8250/16550 serial driver options"
100110
depends on SERIAL_8250

drivers/serial/serial_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,7 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
14401440
* modem is ready for us.
14411441
*/
14421442
spin_lock_irq(&port->lock);
1443+
port->ops->enable_ms(port);
14431444
mctrl = port->ops->get_mctrl(port);
14441445
spin_unlock_irq(&port->lock);
14451446
if (mctrl & TIOCM_CAR)

0 commit comments

Comments
 (0)