History

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

Linus Torvalds committed 12 years ago

Commit 40a215f2 parents e2e481d 0930b0914 files · +77 −64Browse files

Unified · Split

14 files
  1. Documentation/ABI/testing/sysfs-tty +2 −1
  2. drivers/tty/hvc/hvc_opal.c +1 −7
  3. drivers/tty/hvc/hvc_rtas.c +1 −11
  4. drivers/tty/hvc/hvc_udbg.c +1 −8
  5. drivers/tty/hvc/hvc_xen.c +1 −16
  6. drivers/tty/n_gsm.c +11 −0
  7. drivers/tty/n_tty.c +8 −6
  8. drivers/tty/serial/8250/8250_core.c +18 −0
  9. drivers/tty/serial/8250/8250_dw.c +2 −2
  10. drivers/tty/serial/8250/8250_pci.c +2 −1
  11. drivers/tty/serial/omap-serial.c +7 −4
  12. drivers/tty/serial/sirfsoc_uart.c +3 −1
  13. drivers/tty/tty_io.c +18 −7
  14. drivers/tty/vt/vt.c +2 −0
Documentation/ABI/testing/sysfs-tty+2−1
@@ -3,7 +3,8 @@ Date: Nov 2010 · 2 unmodified lines
3Contact: Kay Sievers <kay.sievers@vrfy.org>3Contact: Kay Sievers <kay.sievers@vrfy.org>
4Description:4Description:
5 Shows the list of currently configured5 Shows the list of currently configured
6 console devices, like 'tty1 ttyS0'.6 tty devices used for the console,
7 like 'tty1 ttyS0'.
7 The last entry in the file is the active8 The last entry in the file is the active
8 device connected to /dev/console.9 device connected to /dev/console.
9 The file supports poll() to detect virtual10 The file supports poll() to detect virtual
drivers/tty/hvc/hvc_opal.c+1−7
@@ -255,13 +255,7 @@ static int __init hvc_opal_init(void) · 254 unmodified lines
255 /* Register as a vio device to receive callbacks */255 /* Register as a vio device to receive callbacks */
256 return platform_driver_register(&hvc_opal_driver);256 return platform_driver_register(&hvc_opal_driver);
257}257}
258module_init(hvc_opal_init);258device_initcall(hvc_opal_init);
259
260static void __exit hvc_opal_exit(void)
261{
262 platform_driver_unregister(&hvc_opal_driver);
263}
264module_exit(hvc_opal_exit);
265 259
266static void udbg_opal_putc(char c)260static void udbg_opal_putc(char c)
267{261{
drivers/tty/hvc/hvc_rtas.c+1−11
@@ -102,17 +102,7 @@ static int __init hvc_rtas_init(void) · 101 unmodified lines
102 102
103 return 0;103 return 0;
104}104}
105module_init(hvc_rtas_init);105device_initcall(hvc_rtas_init);
106
107/* This will tear down the tty portion of the driver */
108static 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}
115module_exit(hvc_rtas_exit);
116 106
117/* This will happen prior to module init. There is no tty at this time? */107/* This will happen prior to module init. There is no tty at this time? */
118static int __init hvc_rtas_console_init(void)108static int __init hvc_rtas_console_init(void)
drivers/tty/hvc/hvc_udbg.c+1−8
@@ -80,14 +80,7 @@ static int __init hvc_udbg_init(void) · 79 unmodified lines
80 80
81 return 0;81 return 0;
82}82}
83module_init(hvc_udbg_init);83device_initcall(hvc_udbg_init);
84
85static void __exit hvc_udbg_exit(void)
86{
87 if (hvc_udbg_dev)
88 hvc_remove(hvc_udbg_dev);
89}
90module_exit(hvc_udbg_exit);
91 84
92static int __init hvc_udbg_console_init(void)85static int __init hvc_udbg_console_init(void)
93{86{
drivers/tty/hvc/hvc_xen.c+1−16
@@ -561,18 +561,7 @@ static int __init xen_hvc_init(void) · 560 unmodified lines
561#endif561#endif
562 return r;562 return r;
563}563}
564 564device_initcall(xen_hvc_init);
565static 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}
576 565
577static int xen_cons_init(void)566static int xen_cons_init(void)
578{567{
@@ -598,10 +587,6 @@ static int xen_cons_init(void) · 19 unmodified lines
598 hvc_instantiate(HVC_COOKIE, 0, ops);587 hvc_instantiate(HVC_COOKIE, 0, ops);
599 return 0;588 return 0;
600}589}
601
602
603module_init(xen_hvc_init);
604module_exit(xen_hvc_fini);
605console_initcall(xen_cons_init);590console_initcall(xen_cons_init);
606 591
607#ifdef CONFIG_EARLY_PRINTK592#ifdef CONFIG_EARLY_PRINTK
drivers/tty/n_gsm.c+11−0
@@ -1090,6 +1090,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen) · 1089 unmodified lines
1090{1090{
1091 unsigned int addr = 0;1091 unsigned int addr = 0;
1092 unsigned int modem = 0;1092 unsigned int modem = 0;
1093 unsigned int brk = 0;
1093 struct gsm_dlci *dlci;1094 struct gsm_dlci *dlci;
1094 int len = clen;1095 int len = clen;
1095 u8 *dp = data;1096 u8 *dp = data;
@@ -1116,6 +1117,16 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen) · 20 unmodified lines
1116 if (len == 0)1117 if (len == 0)
1117 return;1118 return;
1118 }1119 }
1120 len--;
1121 if (len > 0) {
1122 while (gsm_read_ea(&brk, *dp++) == 0) {
1123 len--;
1124 if (len == 0)
1125 return;
1126 }
1127 modem <<= 7;
1128 modem |= (brk & 0x7f);
1129 }
1119 tty = tty_port_tty_get(&dlci->port);1130 tty = tty_port_tty_get(&dlci->port);
1120 gsm_process_modem(tty, dlci, modem, clen);1131 gsm_process_modem(tty, dlci, modem, clen);
1121 if (tty) {1132 if (tty) {
drivers/tty/n_tty.c+8−6
@@ -817,8 +817,7 @@ static void process_echoes(struct tty_struct *tty) · 816 unmodified lines
817 struct n_tty_data *ldata = tty->disc_data;817 struct n_tty_data *ldata = tty->disc_data;
818 size_t echoed;818 size_t echoed;
819 819
820 if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||820 if (ldata->echo_mark == ldata->echo_tail)
821 ldata->echo_mark == ldata->echo_tail)
822 return;821 return;
823 822
824 mutex_lock(&ldata->output_lock);823 mutex_lock(&ldata->output_lock);
@@ -1244,7 +1243,8 @@ n_tty_receive_signal_char(struct tty_struct *tty, int signal, unsigned char c) · 419 unmodified lines
1244 if (L_ECHO(tty)) {1243 if (L_ECHO(tty)) {
1245 echo_char(c, tty);1244 echo_char(c, tty);
1246 commit_echoes(tty);1245 commit_echoes(tty);
1247 }1246 } else
1247 process_echoes(tty);
1248 isig(signal, tty);1248 isig(signal, tty);
1249 return;1249 return;
1250}1250}
@@ -1274,7 +1274,7 @@ n_tty_receive_char_special(struct tty_struct *tty, unsigned char c) · 23 unmodified lines
1274 if (I_IXON(tty)) {1274 if (I_IXON(tty)) {
1275 if (c == START_CHAR(tty)) {1275 if (c == START_CHAR(tty)) {
1276 start_tty(tty);1276 start_tty(tty);
1277 commit_echoes(tty);1277 process_echoes(tty);
1278 return 0;1278 return 0;
1279 }1279 }
1280 if (c == STOP_CHAR(tty)) {1280 if (c == STOP_CHAR(tty)) {
@@ -1820,8 +1820,10 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old) · 539 unmodified lines
1820 * Fix tty hang when I_IXON(tty) is cleared, but the tty1820 * Fix tty hang when I_IXON(tty) is cleared, but the tty
1821 * been stopped by STOP_CHAR(tty) before it.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 start_tty(tty);1824 start_tty(tty);
1825 process_echoes(tty);
1826 }
1825 1827
1826 /* The termios change make the tty ready for I/O */1828 /* The termios change make the tty ready for I/O */
1827 if (waitqueue_active(&tty->write_wait))1829 if (waitqueue_active(&tty->write_wait))
@@ -1896,7 +1898,7 @@ err: · 68 unmodified lines
1896static inline int input_available_p(struct tty_struct *tty, int poll)1898static inline int input_available_p(struct tty_struct *tty, int poll)
1897{1899{
1898 struct n_tty_data *ldata = tty->disc_data;1900 struct n_tty_data *ldata = tty->disc_data;
1899 int amt = poll && !TIME_CHAR(tty) ? MIN_CHAR(tty) : 1;1901 int amt = poll && !TIME_CHAR(tty) && MIN_CHAR(tty) ? MIN_CHAR(tty) : 1;
1900 1902
1901 if (ldata->icanon && !L_EXTPROC(tty)) {1903 if (ldata->icanon && !L_EXTPROC(tty)) {
1902 if (ldata->canon_head != ldata->read_tail)1904 if (ldata->canon_head != ldata->read_tail)
drivers/tty/serial/8250/8250_core.c+18−0
@@ -2432,6 +2432,24 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, · 2431 unmodified lines
2432 2432
2433 serial_dl_write(up, quot);2433 serial_dl_write(up, quot);
2434 2434
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
2435 /*2453 /*
2436 * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR2454 * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR
2437 * is written without DLAB set, this mode will be disabled.2455 * is written without DLAB set, this mode will be disabled.
drivers/tty/serial/8250/8250_dw.c+2−2
@@ -391,7 +391,7 @@ static int dw8250_remove(struct platform_device *pdev) · 390 unmodified lines
391 return 0;391 return 0;
392}392}
393 393
394#ifdef CONFIG_PM394#ifdef CONFIG_PM_SLEEP
395static int dw8250_suspend(struct device *dev)395static int dw8250_suspend(struct device *dev)
396{396{
397 struct dw8250_data *data = dev_get_drvdata(dev);397 struct dw8250_data *data = dev_get_drvdata(dev);
@@ -409,7 +409,7 @@ static int dw8250_resume(struct device *dev) · 11 unmodified lines
409 409
410 return 0;410 return 0;
411}411}
412#endif /* CONFIG_PM */412#endif /* CONFIG_PM_SLEEP */
413 413
414#ifdef CONFIG_PM_RUNTIME414#ifdef CONFIG_PM_RUNTIME
415static int dw8250_runtime_suspend(struct device *dev)415static int dw8250_runtime_suspend(struct device *dev)
drivers/tty/serial/8250/8250_pci.c+2−1
@@ -783,7 +783,8 @@ static int pci_netmos_9900_setup(struct serial_private *priv, · 782 unmodified lines
783{783{
784 unsigned int bar;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 /* netmos apparently orders BARs by datasheet layout, so serial788 /* netmos apparently orders BARs by datasheet layout, so serial
788 * ports get BARs 0 and 3 (or 1 and 4 for memmapped)789 * ports get BARs 0 and 3 (or 1 and 4 for memmapped)
789 */790 */
drivers/tty/serial/omap-serial.c+7−4
@@ -738,9 +738,6 @@ static int serial_omap_startup(struct uart_port *port) · 737 unmodified lines
738 return retval;738 return retval;
739 }739 }
740 disable_irq(up->wakeirq);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 dev_dbg(up->port.dev, "serial_omap_startup+%d\n", up->port.line);743 dev_dbg(up->port.dev, "serial_omap_startup+%d\n", up->port.line);
@@ -1604,8 +1601,11 @@ static int serial_omap_probe_rs485(struct uart_omap_port *up, · 857 unmodified lines
1604 flags & SER_RS485_RTS_AFTER_SEND);1601 flags & SER_RS485_RTS_AFTER_SEND);
1605 if (ret < 0)1602 if (ret < 0)
1606 return ret;1603 return ret;
1607 } else1604 } else if (up->rts_gpio == -EPROBE_DEFER) {
1605 return -EPROBE_DEFER;
1606 } else {
1608 up->rts_gpio = -EINVAL;1607 up->rts_gpio = -EINVAL;
1608 }
1609 1609
1610 if (of_property_read_u32_array(np, "rs485-rts-delay",1610 if (of_property_read_u32_array(np, "rs485-rts-delay",
1611 rs485_delay, 2) == 0) {1611 rs485_delay, 2) == 0) {
@@ -1687,6 +1687,9 @@ static int serial_omap_probe(struct platform_device *pdev) · 75 unmodified lines
1687 up->port.iotype = UPIO_MEM;1687 up->port.iotype = UPIO_MEM;
1688 up->port.irq = uartirq;1688 up->port.irq = uartirq;
1689 up->wakeirq = wakeirq;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 up->port.regshift = 2;1694 up->port.regshift = 2;
1692 up->port.fifosize = 64;1695 up->port.fifosize = 64;
drivers/tty/serial/sirfsoc_uart.c+3−1
@@ -542,8 +542,10 @@ static void sirfsoc_rx_tmo_process_tl(unsigned long param) · 541 unmodified lines
542 wr_regl(port, ureg->sirfsoc_rx_dma_io_ctrl,542 wr_regl(port, ureg->sirfsoc_rx_dma_io_ctrl,
543 rd_regl(port, ureg->sirfsoc_rx_dma_io_ctrl) |543 rd_regl(port, ureg->sirfsoc_rx_dma_io_ctrl) |
544 SIRFUART_IO_MODE);544 SIRFUART_IO_MODE);
545 sirfsoc_uart_pio_rx_chars(port, 4 - sirfport->rx_io_count);
546 spin_unlock_irqrestore(&sirfport->rx_lock, flags);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 if (sirfport->rx_io_count == 4) {549 if (sirfport->rx_io_count == 4) {
548 spin_lock_irqsave(&sirfport->rx_lock, flags);550 spin_lock_irqsave(&sirfport->rx_lock, flags);
549 sirfport->rx_io_count = 0;551 sirfport->rx_io_count = 0;
drivers/tty/tty_io.c+18−7
@@ -1267,16 +1267,17 @@ static void pty_line_name(struct tty_driver *driver, int index, char *p) · 1266 unmodified lines
1267 * @p: output buffer of at least 7 bytes1267 * @p: output buffer of at least 7 bytes
1268 *1268 *
1269 * Generate a name from a driver reference and write it to the output1269 * 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 * Locking: None1272 * Locking: None
1273 */1273 */
1274static void tty_line_name(struct tty_driver *driver, int index, char *p)1274static ssize_t tty_line_name(struct tty_driver *driver, int index, char *p)
1275{1275{
1276 if (driver->flags & TTY_DRIVER_UNNUMBERED_NODE)1276 if (driver->flags & TTY_DRIVER_UNNUMBERED_NODE)
1277 strcpy(p, driver->name);1277 return sprintf(p, "%s", driver->name);
1278 else1278 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/**
@@ -3545,9 +3546,19 @@ static ssize_t show_cons_active(struct device *dev, · 2262 unmodified lines
3545 if (i >= ARRAY_SIZE(cs))3546 if (i >= ARRAY_SIZE(cs))
3546 break;3547 break;
3547 }3548 }
3548 while (i--)3549 while (i--) {
3549 count += sprintf(buf + count, "%s%d%c",3550 struct tty_driver *driver;
3550 cs[i]->name, cs[i]->index, i ? ' ':'\n');3551 const char *name = cs[i]->name;
3552 int index = cs[i]->index;
3553
3554 driver = cs[i]->device(cs[i], &index);
3555 if (driver) {
3556 count += tty_line_name(driver, index, buf + count);
3557 count += sprintf(buf + count, "%c", i ? ' ':'\n');
3558 } else
3559 count += sprintf(buf + count, "%s%d%c",
3560 name, index, i ? ' ':'\n');
3561 }
3551 console_unlock();3562 console_unlock();
3552 3563
3553 return count;3564 return count;
drivers/tty/vt/vt.c+2−0
@@ -1164,6 +1164,8 @@ static void csi_J(struct vc_data *vc, int vpar) · 1163 unmodified lines
1164 scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char,1164 scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char,
1165 vc->vc_screenbuf_size >> 1);1165 vc->vc_screenbuf_size >> 1);
1166 set_origin(vc);1166 set_origin(vc);
1167 if (CON_IS_VISIBLE(vc))
1168 update_screen(vc);
1167 /* fall through */1169 /* fall through */
1168 case 2: /* erase whole display */1170 case 2: /* erase whole display */
1169 count = vc->vc_cols * vc->vc_rows;1171 count = vc->vc_cols * vc->vc_rows;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t