diff options
Diffstat (limited to 'drivers/serial/sunsu.c')
-rw-r--r-- | drivers/serial/sunsu.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 4e453fa966ae..46c44b83f57c 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -1280,6 +1280,7 @@ static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up, int channel) | |||
1280 | struct serio *serio; | 1280 | struct serio *serio; |
1281 | #endif | 1281 | #endif |
1282 | 1282 | ||
1283 | spin_lock_init(&up->port.lock); | ||
1283 | up->port.line = channel; | 1284 | up->port.line = channel; |
1284 | up->port.type = PORT_UNKNOWN; | 1285 | up->port.type = PORT_UNKNOWN; |
1285 | up->port.uartclk = (SU_BASE_BAUD * 16); | 1286 | up->port.uartclk = (SU_BASE_BAUD * 16); |
@@ -1464,18 +1465,17 @@ static struct console sunsu_cons = { | |||
1464 | .index = -1, | 1465 | .index = -1, |
1465 | .data = &sunsu_reg, | 1466 | .data = &sunsu_reg, |
1466 | }; | 1467 | }; |
1467 | #define SUNSU_CONSOLE (&sunsu_cons) | ||
1468 | 1468 | ||
1469 | /* | 1469 | /* |
1470 | * Register console. | 1470 | * Register console. |
1471 | */ | 1471 | */ |
1472 | 1472 | ||
1473 | static int __init sunsu_serial_console_init(void) | 1473 | static inline struct console *SUNSU_CONSOLE(void) |
1474 | { | 1474 | { |
1475 | int i; | 1475 | int i; |
1476 | 1476 | ||
1477 | if (con_is_present()) | 1477 | if (con_is_present()) |
1478 | return 0; | 1478 | return NULL; |
1479 | 1479 | ||
1480 | for (i = 0; i < UART_NR; i++) { | 1480 | for (i = 0; i < UART_NR; i++) { |
1481 | int this_minor = sunsu_reg.minor + i; | 1481 | int this_minor = sunsu_reg.minor + i; |
@@ -1484,16 +1484,16 @@ static int __init sunsu_serial_console_init(void) | |||
1484 | break; | 1484 | break; |
1485 | } | 1485 | } |
1486 | if (i == UART_NR) | 1486 | if (i == UART_NR) |
1487 | return 0; | 1487 | return NULL; |
1488 | if (sunsu_ports[i].port_node == 0) | 1488 | if (sunsu_ports[i].port_node == 0) |
1489 | return 0; | 1489 | return NULL; |
1490 | 1490 | ||
1491 | sunsu_cons.index = i; | 1491 | sunsu_cons.index = i; |
1492 | register_console(&sunsu_cons); | 1492 | |
1493 | return 0; | 1493 | return &sunsu_cons; |
1494 | } | 1494 | } |
1495 | #else | 1495 | #else |
1496 | #define SUNSU_CONSOLE (NULL) | 1496 | #define SUNSU_CONSOLE() (NULL) |
1497 | #define sunsu_serial_console_init() do { } while (0) | 1497 | #define sunsu_serial_console_init() do { } while (0) |
1498 | #endif | 1498 | #endif |
1499 | 1499 | ||
@@ -1510,6 +1510,7 @@ static int __init sunsu_serial_init(void) | |||
1510 | up->su_type == SU_PORT_KBD) | 1510 | up->su_type == SU_PORT_KBD) |
1511 | continue; | 1511 | continue; |
1512 | 1512 | ||
1513 | spin_lock_init(&up->port.lock); | ||
1513 | up->port.flags |= UPF_BOOT_AUTOCONF; | 1514 | up->port.flags |= UPF_BOOT_AUTOCONF; |
1514 | up->port.type = PORT_UNKNOWN; | 1515 | up->port.type = PORT_UNKNOWN; |
1515 | up->port.uartclk = (SU_BASE_BAUD * 16); | 1516 | up->port.uartclk = (SU_BASE_BAUD * 16); |
@@ -1523,16 +1524,19 @@ static int __init sunsu_serial_init(void) | |||
1523 | } | 1524 | } |
1524 | 1525 | ||
1525 | sunsu_reg.minor = sunserial_current_minor; | 1526 | sunsu_reg.minor = sunserial_current_minor; |
1526 | sunserial_current_minor += instance; | ||
1527 | 1527 | ||
1528 | sunsu_reg.nr = instance; | 1528 | sunsu_reg.nr = instance; |
1529 | sunsu_reg.cons = SUNSU_CONSOLE; | ||
1530 | 1529 | ||
1531 | ret = uart_register_driver(&sunsu_reg); | 1530 | ret = uart_register_driver(&sunsu_reg); |
1532 | if (ret < 0) | 1531 | if (ret < 0) |
1533 | return ret; | 1532 | return ret; |
1534 | 1533 | ||
1535 | sunsu_serial_console_init(); | 1534 | sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64; |
1535 | |||
1536 | sunserial_current_minor += instance; | ||
1537 | |||
1538 | sunsu_reg.cons = SUNSU_CONSOLE(); | ||
1539 | |||
1536 | for (i = 0; i < UART_NR; i++) { | 1540 | for (i = 0; i < UART_NR; i++) { |
1537 | struct uart_sunsu_port *up = &sunsu_ports[i]; | 1541 | struct uart_sunsu_port *up = &sunsu_ports[i]; |
1538 | 1542 | ||