From 5d65805989856b0f3ddd4e512e0dad1cfa0a330d Mon Sep 17 00:00:00 2001 From: David Dillow Date: Sun, 4 Jan 2004 19:23:47 -0800 Subject: [PATCH] [SUNZILOG]: Register the correct number of ports, ignore keyb/mouse lines. --- drivers/serial/sunzilog.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index ee859f9d30408..1f343cc2b9528 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c @@ -1631,6 +1631,8 @@ static int __init sunzilog_ports_init(void) { struct zs_probe_scan scan; int ret; + int uart_count; + int i; printk(KERN_DEBUG "SunZilog: %d chips.\n", NUM_SUNZILOG); @@ -1650,18 +1652,27 @@ static int __init sunzilog_ports_init(void) sunzilog_init_hw(); /* We can only init this once we have probed the Zilogs - * in the system. + * in the system. Do not count channels assigned to keyboards + * or mice when we are deciding how many ports to register. */ - sunzilog_reg.nr = NUM_CHANNELS; + uart_count = 0; + for (i = 0; i < NUM_CHANNELS; i++) { + struct uart_sunzilog_port *up = &sunzilog_port_table[i]; + + if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up)) + continue; + + uart_count++; + } + + sunzilog_reg.nr = uart_count; sunzilog_reg.cons = SUNZILOG_CONSOLE; sunzilog_reg.minor = sunserial_current_minor; - sunserial_current_minor += NUM_CHANNELS; + sunserial_current_minor += uart_count; ret = uart_register_driver(&sunzilog_reg); if (ret == 0) { - int i; - for (i = 0; i < NUM_CHANNELS; i++) { struct uart_sunzilog_port *up = &sunzilog_port_table[i]; -- 2.53.0