aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-15 15:36:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-15 15:36:32 -0500
commit7f138b9706f5f3528d598aefd35337d54a8c1afb (patch)
tree5e916b34eba72e20719807259d69cf585253b082
parent793e039ea07191946b5ec136db00f8b03ee4a13e (diff)
parent802c03881f29844af0252b6e22be5d2f65f93fd0 (diff)
Merge tag 'tty-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial fixes from Greg KH: "Here are some small tty/serial driver fixes for 4.10-rc4 to resolve a number of reported issues. Nothing major here at all, one revert of a problematic patch, and some other tiny bugfixes. Full details are in the shortlog below. All have been in linux-next with no reported issues" * tag 'tty-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: sysrq: attach sysrq handler correctly for 32-bit kernel Revert "tty: serial: 8250: add CON_CONSDEV to flags" Clearing FIFOs in RS485 emulation mode causes subsequent transmits to break 8250_pci: Fix potential use-after-free in error path tty/serial: atmel: RS485 half duplex w/DMA: enable RX after TX is done tty/serial: atmel_serial: BUG: stop DMA from transmitting in stop_tx
-rw-r--r--drivers/tty/serial/8250/8250_core.c2
-rw-r--r--drivers/tty/serial/8250/8250_pci.c12
-rw-r--r--drivers/tty/serial/8250/8250_port.c2
-rw-r--r--drivers/tty/serial/atmel_serial.c22
-rw-r--r--drivers/tty/sysrq.c4
5 files changed, 25 insertions, 17 deletions
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 61569a765d9e..76e03a7de9cc 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -675,7 +675,7 @@ static struct console univ8250_console = {
675 .device = uart_console_device, 675 .device = uart_console_device,
676 .setup = univ8250_console_setup, 676 .setup = univ8250_console_setup,
677 .match = univ8250_console_match, 677 .match = univ8250_console_match,
678 .flags = CON_PRINTBUFFER | CON_ANYTIME | CON_CONSDEV, 678 .flags = CON_PRINTBUFFER | CON_ANYTIME,
679 .index = -1, 679 .index = -1,
680 .data = &serial8250_reg, 680 .data = &serial8250_reg,
681}; 681};
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index aa0166b6d450..116436b7fa52 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -5642,17 +5642,15 @@ static pci_ers_result_t serial8250_io_slot_reset(struct pci_dev *dev)
5642static void serial8250_io_resume(struct pci_dev *dev) 5642static void serial8250_io_resume(struct pci_dev *dev)
5643{ 5643{
5644 struct serial_private *priv = pci_get_drvdata(dev); 5644 struct serial_private *priv = pci_get_drvdata(dev);
5645 const struct pciserial_board *board; 5645 struct serial_private *new;
5646 5646
5647 if (!priv) 5647 if (!priv)
5648 return; 5648 return;
5649 5649
5650 board = priv->board; 5650 new = pciserial_init_ports(dev, priv->board);
5651 kfree(priv); 5651 if (!IS_ERR(new)) {
5652 priv = pciserial_init_ports(dev, board); 5652 pci_set_drvdata(dev, new);
5653 5653 kfree(priv);
5654 if (!IS_ERR(priv)) {
5655 pci_set_drvdata(dev, priv);
5656 } 5654 }
5657} 5655}
5658 5656
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index fe4399b41df6..c13fec451d03 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1413,7 +1413,7 @@ static void __do_stop_tx_rs485(struct uart_8250_port *p)
1413 * Enable previously disabled RX interrupts. 1413 * Enable previously disabled RX interrupts.
1414 */ 1414 */
1415 if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) { 1415 if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) {
1416 serial8250_clear_fifos(p); 1416 serial8250_clear_and_reinit_fifos(p);
1417 1417
1418 p->ier |= UART_IER_RLSI | UART_IER_RDI; 1418 p->ier |= UART_IER_RLSI | UART_IER_RDI;
1419 serial_port_out(&p->port, UART_IER, p->ier); 1419 serial_port_out(&p->port, UART_IER, p->ier);
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 168b10cad47b..fabbe76203bb 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -481,6 +481,14 @@ static void atmel_stop_tx(struct uart_port *port)
481 /* disable PDC transmit */ 481 /* disable PDC transmit */
482 atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTDIS); 482 atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTDIS);
483 } 483 }
484
485 /*
486 * Disable the transmitter.
487 * This is mandatory when DMA is used, otherwise the DMA buffer
488 * is fully transmitted.
489 */
490 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXDIS);
491
484 /* Disable interrupts */ 492 /* Disable interrupts */
485 atmel_uart_writel(port, ATMEL_US_IDR, atmel_port->tx_done_mask); 493 atmel_uart_writel(port, ATMEL_US_IDR, atmel_port->tx_done_mask);
486 494
@@ -513,6 +521,9 @@ static void atmel_start_tx(struct uart_port *port)
513 521
514 /* Enable interrupts */ 522 /* Enable interrupts */
515 atmel_uart_writel(port, ATMEL_US_IER, atmel_port->tx_done_mask); 523 atmel_uart_writel(port, ATMEL_US_IER, atmel_port->tx_done_mask);
524
525 /* re-enable the transmitter */
526 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN);
516} 527}
517 528
518/* 529/*
@@ -798,6 +809,11 @@ static void atmel_complete_tx_dma(void *arg)
798 */ 809 */
799 if (!uart_circ_empty(xmit)) 810 if (!uart_circ_empty(xmit))
800 atmel_tasklet_schedule(atmel_port, &atmel_port->tasklet_tx); 811 atmel_tasklet_schedule(atmel_port, &atmel_port->tasklet_tx);
812 else if ((port->rs485.flags & SER_RS485_ENABLED) &&
813 !(port->rs485.flags & SER_RS485_RX_DURING_TX)) {
814 /* DMA done, stop TX, start RX for RS485 */
815 atmel_start_rx(port);
816 }
801 817
802 spin_unlock_irqrestore(&port->lock, flags); 818 spin_unlock_irqrestore(&port->lock, flags);
803} 819}
@@ -900,12 +916,6 @@ static void atmel_tx_dma(struct uart_port *port)
900 desc->callback = atmel_complete_tx_dma; 916 desc->callback = atmel_complete_tx_dma;
901 desc->callback_param = atmel_port; 917 desc->callback_param = atmel_port;
902 atmel_port->cookie_tx = dmaengine_submit(desc); 918 atmel_port->cookie_tx = dmaengine_submit(desc);
903
904 } else {
905 if (port->rs485.flags & SER_RS485_ENABLED) {
906 /* DMA done, stop TX, start RX for RS485 */
907 atmel_start_rx(port);
908 }
909 } 919 }
910 920
911 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 921 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 52bbd27e93ae..701c085bb19b 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -946,8 +946,8 @@ static const struct input_device_id sysrq_ids[] = {
946 { 946 {
947 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 947 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
948 INPUT_DEVICE_ID_MATCH_KEYBIT, 948 INPUT_DEVICE_ID_MATCH_KEYBIT,
949 .evbit = { BIT_MASK(EV_KEY) }, 949 .evbit = { [BIT_WORD(EV_KEY)] = BIT_MASK(EV_KEY) },
950 .keybit = { BIT_MASK(KEY_LEFTALT) }, 950 .keybit = { [BIT_WORD(KEY_LEFTALT)] = BIT_MASK(KEY_LEFTALT) },
951 }, 951 },
952 { }, 952 { },
953}; 953};