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
33 Contact: Kay Sievers <kay.sievers@vrfy.org>
44 Description:
55 Shows the list of currently configured
6− console devices, like 'tty1 ttyS0'.
6+ tty devices used for the console,
7+ like 'tty1 ttyS0'.
78 The last entry in the file is the active
89 device connected to /dev/console.
910 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
255255 /* Register as a vio device to receive callbacks */
256256 return platform_driver_register(&hvc_opal_driver);
257257 }
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);
265259
266260 static void udbg_opal_putc(char c)
267261 {
drivers/tty/hvc/hvc_rtas.c+1−11
@@ -102,17 +102,7 @@ static int __init hvc_rtas_init(void) · 101 unmodified lines
102102
103103 return 0;
104104 }
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);
116106
117107 /* This will happen prior to module init. There is no tty at this time? */
118108 static 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
8080
8181 return 0;
8282 }
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);
9184
9285 static int __init hvc_udbg_console_init(void)
9386 {
drivers/tty/hvc/hvc_xen.c+1−16
@@ -561,18 +561,7 @@ static int __init xen_hvc_init(void) · 560 unmodified lines
561561 #endif
562562 return r;
563563 }
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);
576565
577566 static int xen_cons_init(void)
578567 {
@@ -598,10 +587,6 @@ static int xen_cons_init(void) · 19 unmodified lines
598587 hvc_instantiate(HVC_COOKIE, 0, ops);
599588 return 0;
600589 }
601−
602−
603−module_init(xen_hvc_init);
604−module_exit(xen_hvc_fini);
605590 console_initcall(xen_cons_init);
606591
607592 #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
10901090 {
10911091 unsigned int addr = 0;
10921092 unsigned int modem = 0;
1093+ unsigned int brk = 0;
10931094 struct gsm_dlci *dlci;
10941095 int len = clen;
10951096 u8 *dp = data;
@@ -1116,6 +1117,16 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen) · 20 unmodified lines
11161117 if (len == 0)
11171118 return;
11181119 }
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+ }
11191130 tty = tty_port_tty_get(&dlci->port);
11201131 gsm_process_modem(tty, dlci, modem, clen);
11211132 if (tty) {
drivers/tty/n_tty.c+8−6
@@ -817,8 +817,7 @@ static void process_echoes(struct tty_struct *tty) · 816 unmodified lines
817817 struct n_tty_data *ldata = tty->disc_data;
818818 size_t echoed;
819819
820− if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||
821− ldata->echo_mark == ldata->echo_tail)
820+ if (ldata->echo_mark == ldata->echo_tail)
822821 return;
823822
824823 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
12441243 if (L_ECHO(tty)) {
12451244 echo_char(c, tty);
12461245 commit_echoes(tty);
1247− }
1246+ } else
1247+ process_echoes(tty);
12481248 isig(signal, tty);
12491249 return;
12501250 }
@@ -1274,7 +1274,7 @@ n_tty_receive_char_special(struct tty_struct *tty, unsigned char c) · 23 unmodified lines
12741274 if (I_IXON(tty)) {
12751275 if (c == START_CHAR(tty)) {
12761276 start_tty(tty);
1277− commit_echoes(tty);
1277+ process_echoes(tty);
12781278 return 0;
12791279 }
12801280 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
18201820 * Fix tty hang when I_IXON(tty) is cleared, but the tty
18211821 * been stopped by STOP_CHAR(tty) before it.
18221822 */
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) {
18241824 start_tty(tty);
1825+ process_echoes(tty);
1826+ }
18251827
18261828 /* The termios change make the tty ready for I/O */
18271829 if (waitqueue_active(&tty->write_wait))
@@ -1896,7 +1898,7 @@ err: · 68 unmodified lines
18961898 static inline int input_available_p(struct tty_struct *tty, int poll)
18971899 {
18981900 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;
19001902
19011903 if (ldata->icanon && !L_EXTPROC(tty)) {
19021904 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
24322432
24332433 serial_dl_write(up, quot);
24342434
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+
24352453 /*
24362454 * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR
24372455 * 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
391391 return 0;
392392 }
393393
394−#ifdef CONFIG_PM
394+#ifdef CONFIG_PM_SLEEP
395395 static int dw8250_suspend(struct device *dev)
396396 {
397397 struct dw8250_data *data = dev_get_drvdata(dev);
@@ -409,7 +409,7 @@ static int dw8250_resume(struct device *dev) · 11 unmodified lines
409409
410410 return 0;
411411 }
412−#endif /* CONFIG_PM */
412+#endif /* CONFIG_PM_SLEEP */
413413
414414 #ifdef CONFIG_PM_RUNTIME
415415 static 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
783783 {
784784 unsigned int bar;
785785
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) {
787788 /* netmos apparently orders BARs by datasheet layout, so serial
788789 * ports get BARs 0 and 3 (or 1 and 4 for memmapped)
789790 */
drivers/tty/serial/omap-serial.c+7−4
@@ -738,9 +738,6 @@ static int serial_omap_startup(struct uart_port *port) · 737 unmodified lines
738738 return retval;
739739 }
740740 disable_irq(up->wakeirq);
741− } else {
742− dev_info(up->port.dev, "no wakeirq for uart%d\n",
743− up->port.line);
744741 }
745742
746743 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
16041601 flags & SER_RS485_RTS_AFTER_SEND);
16051602 if (ret < 0)
16061603 return ret;
1607− } else
1604+ } else if (up->rts_gpio == -EPROBE_DEFER) {
1605+ return -EPROBE_DEFER;
1606+ } else {
16081607 up->rts_gpio = -EINVAL;
1608+ }
16091609
16101610 if (of_property_read_u32_array(np, "rs485-rts-delay",
16111611 rs485_delay, 2) == 0) {
@@ -1687,6 +1687,9 @@ static int serial_omap_probe(struct platform_device *pdev) · 75 unmodified lines
16871687 up->port.iotype = UPIO_MEM;
16881688 up->port.irq = uartirq;
16891689 up->wakeirq = wakeirq;
1690+ if (!up->wakeirq)
1691+ dev_info(up->port.dev, "no wakeirq for uart%d\n",
1692+ up->port.line);
16901693
16911694 up->port.regshift = 2;
16921695 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
542542 wr_regl(port, ureg->sirfsoc_rx_dma_io_ctrl,
543543 rd_regl(port, ureg->sirfsoc_rx_dma_io_ctrl) |
544544 SIRFUART_IO_MODE);
545− sirfsoc_uart_pio_rx_chars(port, 4 - sirfport->rx_io_count);
546545 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);
547549 if (sirfport->rx_io_count == 4) {
548550 spin_lock_irqsave(&sirfport->rx_lock, flags);
549551 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
12671267 * @p: output buffer of at least 7 bytes
12681268 *
12691269 * Generate a name from a driver reference and write it to the output
1270− * buffer.
1270+ * buffer. Return the number of bytes written.
12711271 *
12721272 * Locking: None
12731273 */
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)
12751275 {
12761276 if (driver->flags & TTY_DRIVER_UNNUMBERED_NODE)
1277− strcpy(p, driver->name);
1277+ return sprintf(p, "%s", driver->name);
12781278 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);
12801281 }
12811282
12821283 /**
@@ -3545,9 +3546,19 @@ static ssize_t show_cons_active(struct device *dev, · 2262 unmodified lines
35453546 if (i >= ARRAY_SIZE(cs))
35463547 break;
35473548 }
3548− while (i--)
3549− count += sprintf(buf + count, "%s%d%c",
3550− cs[i]->name, cs[i]->index, i ? ' ':'\n');
3549+ while (i--) {
3550+ struct tty_driver *driver;
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+ }
35513562 console_unlock();
35523563
35533564 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
11641164 scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char,
11651165 vc->vc_screenbuf_size >> 1);
11661166 set_origin(vc);
1167+ if (CON_IS_VISIBLE(vc))
1168+ update_screen(vc);
11671169 /* fall through */
11681170 case 2: /* erase whole display */
11691171 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