Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'tty-3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial driver fixes from Greg KH:
"Here are a small number of tty/serial driver fixes to resolve reported
issues with 3.14-rc and earlier (in the case of the vt bugfix). Some
of these have been tested and reported by a number of people as the
tty bugfix was pretty commonly hit on some platforms.

All have been in linux-next for a while"

* tag 'tty-3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
vt: Fix secure clear screen
serial: 8250: Support XR17V35x fraction divisor
n_tty: Fix stale echo output
serial: sirf: fix kernel panic caused by unpaired spinlock
serial: 8250_pci: unbreak last serial ports on NetMos 9865 cards
n_tty: Fix poll() when TIME_CHAR and MIN_CHAR == 0
serial: omap: fix rs485 probe on defered pinctrl
serial: 8250_dw: fix compilation warning when !CONFIG_PM_SLEEP
serial: omap-serial: Move info message to probe function
tty: Set correct tty name in 'active' sysfs attribute
tty: n_gsm: Fix for modems with brk in modem status control
drivers/tty/hvc: don't use module_init in non-modular hyp. console code

+77 -64
+2 -1
Documentation/ABI/testing/sysfs-tty
··· 3 3 Contact: Kay Sievers <kay.sievers@vrfy.org> 4 4 Description: 5 5 Shows the list of currently configured 6 - console devices, like 'tty1 ttyS0'. 6 + tty devices used for the console, 7 + like 'tty1 ttyS0'. 7 8 The last entry in the file is the active 8 9 device connected to /dev/console. 9 10 The file supports poll() to detect virtual
+1 -7
drivers/tty/hvc/hvc_opal.c
··· 255 255 /* Register as a vio device to receive callbacks */ 256 256 return platform_driver_register(&hvc_opal_driver); 257 257 } 258 - module_init(hvc_opal_init); 259 - 260 - static void __exit hvc_opal_exit(void) 261 - { 262 - platform_driver_unregister(&hvc_opal_driver); 263 - } 264 - module_exit(hvc_opal_exit); 258 + device_initcall(hvc_opal_init); 265 259 266 260 static void udbg_opal_putc(char c) 267 261 {
+1 -11
drivers/tty/hvc/hvc_rtas.c
··· 102 102 103 103 return 0; 104 104 } 105 - module_init(hvc_rtas_init); 106 - 107 - /* This will tear down the tty portion of the driver */ 108 - static void __exit hvc_rtas_exit(void) 109 - { 110 - /* Really the fun isn't over until the worker thread breaks down and 111 - * the tty cleans up */ 112 - if (hvc_rtas_dev) 113 - hvc_remove(hvc_rtas_dev); 114 - } 115 - module_exit(hvc_rtas_exit); 105 + device_initcall(hvc_rtas_init); 116 106 117 107 /* This will happen prior to module init. There is no tty at this time? */ 118 108 static int __init hvc_rtas_console_init(void)
+1 -8
drivers/tty/hvc/hvc_udbg.c
··· 80 80 81 81 return 0; 82 82 } 83 - module_init(hvc_udbg_init); 84 - 85 - static void __exit hvc_udbg_exit(void) 86 - { 87 - if (hvc_udbg_dev) 88 - hvc_remove(hvc_udbg_dev); 89 - } 90 - module_exit(hvc_udbg_exit); 83 + device_initcall(hvc_udbg_init); 91 84 92 85 static int __init hvc_udbg_console_init(void) 93 86 {
+1 -16
drivers/tty/hvc/hvc_xen.c
··· 561 561 #endif 562 562 return r; 563 563 } 564 - 565 - static void __exit xen_hvc_fini(void) 566 - { 567 - struct xencons_info *entry, *next; 568 - 569 - if (list_empty(&xenconsoles)) 570 - return; 571 - 572 - list_for_each_entry_safe(entry, next, &xenconsoles, list) { 573 - xen_console_remove(entry); 574 - } 575 - } 564 + device_initcall(xen_hvc_init); 576 565 577 566 static int xen_cons_init(void) 578 567 { ··· 587 598 hvc_instantiate(HVC_COOKIE, 0, ops); 588 599 return 0; 589 600 } 590 - 591 - 592 - module_init(xen_hvc_init); 593 - module_exit(xen_hvc_fini); 594 601 console_initcall(xen_cons_init); 595 602 596 603 #ifdef CONFIG_EARLY_PRINTK
+11
drivers/tty/n_gsm.c
··· 1090 1090 { 1091 1091 unsigned int addr = 0; 1092 1092 unsigned int modem = 0; 1093 + unsigned int brk = 0; 1093 1094 struct gsm_dlci *dlci; 1094 1095 int len = clen; 1095 1096 u8 *dp = data; ··· 1116 1115 len--; 1117 1116 if (len == 0) 1118 1117 return; 1118 + } 1119 + len--; 1120 + if (len > 0) { 1121 + while (gsm_read_ea(&brk, *dp++) == 0) { 1122 + len--; 1123 + if (len == 0) 1124 + return; 1125 + } 1126 + modem <<= 7; 1127 + modem |= (brk & 0x7f); 1119 1128 } 1120 1129 tty = tty_port_tty_get(&dlci->port); 1121 1130 gsm_process_modem(tty, dlci, modem, clen);
+8 -6
drivers/tty/n_tty.c
··· 817 817 struct n_tty_data *ldata = tty->disc_data; 818 818 size_t echoed; 819 819 820 - if ((!L_ECHO(tty) && !L_ECHONL(tty)) || 821 - ldata->echo_mark == ldata->echo_tail) 820 + if (ldata->echo_mark == ldata->echo_tail) 822 821 return; 823 822 824 823 mutex_lock(&ldata->output_lock); ··· 1243 1244 if (L_ECHO(tty)) { 1244 1245 echo_char(c, tty); 1245 1246 commit_echoes(tty); 1246 - } 1247 + } else 1248 + process_echoes(tty); 1247 1249 isig(signal, tty); 1248 1250 return; 1249 1251 } ··· 1274 1274 if (I_IXON(tty)) { 1275 1275 if (c == START_CHAR(tty)) { 1276 1276 start_tty(tty); 1277 - commit_echoes(tty); 1277 + process_echoes(tty); 1278 1278 return 0; 1279 1279 } 1280 1280 if (c == STOP_CHAR(tty)) { ··· 1820 1820 * Fix tty hang when I_IXON(tty) is cleared, but the tty 1821 1821 * been stopped by STOP_CHAR(tty) before it. 1822 1822 */ 1823 - if (!I_IXON(tty) && old && (old->c_iflag & IXON) && !tty->flow_stopped) 1823 + if (!I_IXON(tty) && old && (old->c_iflag & IXON) && !tty->flow_stopped) { 1824 1824 start_tty(tty); 1825 + process_echoes(tty); 1826 + } 1825 1827 1826 1828 /* The termios change make the tty ready for I/O */ 1827 1829 if (waitqueue_active(&tty->write_wait)) ··· 1898 1896 static inline int input_available_p(struct tty_struct *tty, int poll) 1899 1897 { 1900 1898 struct n_tty_data *ldata = tty->disc_data; 1901 - int amt = poll && !TIME_CHAR(tty) ? MIN_CHAR(tty) : 1; 1899 + int amt = poll && !TIME_CHAR(tty) && MIN_CHAR(tty) ? MIN_CHAR(tty) : 1; 1902 1900 1903 1901 if (ldata->icanon && !L_EXTPROC(tty)) { 1904 1902 if (ldata->canon_head != ldata->read_tail)
+18
drivers/tty/serial/8250/8250_core.c
··· 2433 2433 serial_dl_write(up, quot); 2434 2434 2435 2435 /* 2436 + * XR17V35x UARTs have an extra fractional divisor register (DLD) 2437 + * 2438 + * We need to recalculate all of the registers, because DLM and DLL 2439 + * are already rounded to a whole integer. 2440 + * 2441 + * When recalculating we use a 32x clock instead of a 16x clock to 2442 + * allow 1-bit for rounding in the fractional part. 2443 + */ 2444 + if (up->port.type == PORT_XR17V35X) { 2445 + unsigned int baud_x32 = (port->uartclk * 2) / baud; 2446 + u16 quot = baud_x32 / 32; 2447 + u8 quot_frac = DIV_ROUND_CLOSEST(baud_x32 % 32, 2); 2448 + 2449 + serial_dl_write(up, quot); 2450 + serial_port_out(port, 0x2, quot_frac & 0xf); 2451 + } 2452 + 2453 + /* 2436 2454 * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR 2437 2455 * is written without DLAB set, this mode will be disabled. 2438 2456 */
+2 -2
drivers/tty/serial/8250/8250_dw.c
··· 391 391 return 0; 392 392 } 393 393 394 - #ifdef CONFIG_PM 394 + #ifdef CONFIG_PM_SLEEP 395 395 static int dw8250_suspend(struct device *dev) 396 396 { 397 397 struct dw8250_data *data = dev_get_drvdata(dev); ··· 409 409 410 410 return 0; 411 411 } 412 - #endif /* CONFIG_PM */ 412 + #endif /* CONFIG_PM_SLEEP */ 413 413 414 414 #ifdef CONFIG_PM_RUNTIME 415 415 static int dw8250_runtime_suspend(struct device *dev)
+2 -1
drivers/tty/serial/8250/8250_pci.c
··· 783 783 { 784 784 unsigned int bar; 785 785 786 - if ((priv->dev->subsystem_device & 0xff00) == 0x3000) { 786 + if ((priv->dev->device != PCI_DEVICE_ID_NETMOS_9865) && 787 + (priv->dev->subsystem_device & 0xff00) == 0x3000) { 787 788 /* netmos apparently orders BARs by datasheet layout, so serial 788 789 * ports get BARs 0 and 3 (or 1 and 4 for memmapped) 789 790 */
+7 -4
drivers/tty/serial/omap-serial.c
··· 738 738 return retval; 739 739 } 740 740 disable_irq(up->wakeirq); 741 - } else { 742 - dev_info(up->port.dev, "no wakeirq for uart%d\n", 743 - up->port.line); 744 741 } 745 742 746 743 dev_dbg(up->port.dev, "serial_omap_startup+%d\n", up->port.line); ··· 1601 1604 flags & SER_RS485_RTS_AFTER_SEND); 1602 1605 if (ret < 0) 1603 1606 return ret; 1604 - } else 1607 + } else if (up->rts_gpio == -EPROBE_DEFER) { 1608 + return -EPROBE_DEFER; 1609 + } else { 1605 1610 up->rts_gpio = -EINVAL; 1611 + } 1606 1612 1607 1613 if (of_property_read_u32_array(np, "rs485-rts-delay", 1608 1614 rs485_delay, 2) == 0) { ··· 1687 1687 up->port.iotype = UPIO_MEM; 1688 1688 up->port.irq = uartirq; 1689 1689 up->wakeirq = wakeirq; 1690 + if (!up->wakeirq) 1691 + dev_info(up->port.dev, "no wakeirq for uart%d\n", 1692 + up->port.line); 1690 1693 1691 1694 up->port.regshift = 2; 1692 1695 up->port.fifosize = 64;
+3 -1
drivers/tty/serial/sirfsoc_uart.c
··· 542 542 wr_regl(port, ureg->sirfsoc_rx_dma_io_ctrl, 543 543 rd_regl(port, ureg->sirfsoc_rx_dma_io_ctrl) | 544 544 SIRFUART_IO_MODE); 545 - sirfsoc_uart_pio_rx_chars(port, 4 - sirfport->rx_io_count); 546 545 spin_unlock_irqrestore(&sirfport->rx_lock, flags); 546 + spin_lock(&port->lock); 547 + sirfsoc_uart_pio_rx_chars(port, 4 - sirfport->rx_io_count); 548 + spin_unlock(&port->lock); 547 549 if (sirfport->rx_io_count == 4) { 548 550 spin_lock_irqsave(&sirfport->rx_lock, flags); 549 551 sirfport->rx_io_count = 0;
+18 -7
drivers/tty/tty_io.c
··· 1267 1267 * @p: output buffer of at least 7 bytes 1268 1268 * 1269 1269 * Generate a name from a driver reference and write it to the output 1270 - * buffer. 1270 + * buffer. Return the number of bytes written. 1271 1271 * 1272 1272 * Locking: None 1273 1273 */ 1274 - static void tty_line_name(struct tty_driver *driver, int index, char *p) 1274 + static ssize_t tty_line_name(struct tty_driver *driver, int index, char *p) 1275 1275 { 1276 1276 if (driver->flags & TTY_DRIVER_UNNUMBERED_NODE) 1277 - strcpy(p, driver->name); 1277 + return sprintf(p, "%s", driver->name); 1278 1278 else 1279 - sprintf(p, "%s%d", driver->name, index + driver->name_base); 1279 + return sprintf(p, "%s%d", driver->name, 1280 + index + driver->name_base); 1280 1281 } 1281 1282 1282 1283 /** ··· 3546 3545 if (i >= ARRAY_SIZE(cs)) 3547 3546 break; 3548 3547 } 3549 - while (i--) 3550 - count += sprintf(buf + count, "%s%d%c", 3551 - cs[i]->name, cs[i]->index, i ? ' ':'\n'); 3548 + while (i--) { 3549 + struct tty_driver *driver; 3550 + const char *name = cs[i]->name; 3551 + int index = cs[i]->index; 3552 + 3553 + driver = cs[i]->device(cs[i], &index); 3554 + if (driver) { 3555 + count += tty_line_name(driver, index, buf + count); 3556 + count += sprintf(buf + count, "%c", i ? ' ':'\n'); 3557 + } else 3558 + count += sprintf(buf + count, "%s%d%c", 3559 + name, index, i ? ' ':'\n'); 3560 + } 3552 3561 console_unlock(); 3553 3562 3554 3563 return count;
+2
drivers/tty/vt/vt.c
··· 1164 1164 scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char, 1165 1165 vc->vc_screenbuf_size >> 1); 1166 1166 set_origin(vc); 1167 + if (CON_IS_VISIBLE(vc)) 1168 + update_screen(vc); 1167 1169 /* fall through */ 1168 1170 case 2: /* erase whole display */ 1169 1171 count = vc->vc_cols * vc->vc_rows;