History

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

Pull tty/serial driver fixes from Greg KH: "Here are some small tty and serial driver fixes for 6.2-rc5 that resolve a number of tiny reported issues and some new device ids. They include: - new device id for the exar serial driver - speakup tty driver bugfix - atmel serial driver baudrate fixup - stm32 serial driver bugfix and then revert as the bugfix broke the build. That will come back in a later pull request once it is all worked out properly. - amba-pl011 serial driver rs486 mode bugfix - qcom_geni serial driver bugfix Most of these have been in linux-next with no reported problems (well, other than the build breakage which generated the revert), the new device id passed 0-day testing" * tag 'tty-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: serial: exar: Add support for Sealevel 7xxxC serial cards Revert "serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler" tty: serial: qcom_geni: avoid duplicate struct member init serial: atmel: fix incorrect baudrate setup tty: fix possible null-ptr-defer in spk_ttyio_release serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler serial: amba-pl011: fix high priority character transmission in rs486 mode serial: pch_uart: Pass correct sg to dma_unmap_sg() tty: serial: qcom-geni-serial: fix slab-out-of-bounds on RX FIFO buffer

Linus Torvalds committed 3 years ago

Commit bd5cc6e2 parents e67da28 14ee78d6 files · +47 −20Browse files

Unified · Split

6 files
  1. drivers/accessibility/speakup/spk_ttyio.c +3 −0
  2. drivers/tty/serial/8250/8250_exar.c +14 −0
  3. drivers/tty/serial/amba-pl011.c +4 −4
  4. drivers/tty/serial/atmel_serial.c +1 −7
  5. drivers/tty/serial/pch_uart.c +1 −1
  6. drivers/tty/serial/qcom_geni_serial.c +24 −8
drivers/accessibility/speakup/spk_ttyio.c+3−0
@@ -354,6 +354,9 @@ void spk_ttyio_release(struct spk_synth *in_synth) · 353 unmodified lines
354{354{
355 struct tty_struct *tty = in_synth->dev;355 struct tty_struct *tty = in_synth->dev;
356 356
357 if (tty == NULL)
358 return;
359
357 tty_lock(tty);360 tty_lock(tty);
358 361
359 if (tty->ops->close)362 if (tty->ops->close)
drivers/tty/serial/8250/8250_exar.c+14−0
@@ -43,6 +43,12 @@ · 42 unmodified lines
43#define PCI_DEVICE_ID_EXAR_XR17V4358 0x435843#define PCI_DEVICE_ID_EXAR_XR17V4358 0x4358
44#define PCI_DEVICE_ID_EXAR_XR17V8358 0x835844#define PCI_DEVICE_ID_EXAR_XR17V8358 0x8358
45 45
46#define PCI_DEVICE_ID_SEALEVEL_710xC 0x1001
47#define PCI_DEVICE_ID_SEALEVEL_720xC 0x1002
48#define PCI_DEVICE_ID_SEALEVEL_740xC 0x1004
49#define PCI_DEVICE_ID_SEALEVEL_780xC 0x1008
50#define PCI_DEVICE_ID_SEALEVEL_716xC 0x1010
51
46#define UART_EXAR_INT0 0x8052#define UART_EXAR_INT0 0x80
47#define UART_EXAR_8XMODE 0x88 /* 8X sampling rate select */53#define UART_EXAR_8XMODE 0x88 /* 8X sampling rate select */
48#define UART_EXAR_SLEEP 0x8b /* Sleep mode */54#define UART_EXAR_SLEEP 0x8b /* Sleep mode */
@@ -638,6 +644,8 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) · 589 unmodified lines
638 nr_ports = BIT(((pcidev->device & 0x38) >> 3) - 1);644 nr_ports = BIT(((pcidev->device & 0x38) >> 3) - 1);
639 else if (board->num_ports)645 else if (board->num_ports)
640 nr_ports = board->num_ports;646 nr_ports = board->num_ports;
647 else if (pcidev->vendor == PCI_VENDOR_ID_SEALEVEL)
648 nr_ports = pcidev->device & 0xff;
641 else649 else
642 nr_ports = pcidev->device & 0x0f;650 nr_ports = pcidev->device & 0x0f;
643 651
@@ -864,6 +872,12 @@ static const struct pci_device_id exar_pci_tbl[] = { · 220 unmodified lines
864 EXAR_DEVICE(COMMTECH, 4224PCI335, pbn_fastcom335_4),872 EXAR_DEVICE(COMMTECH, 4224PCI335, pbn_fastcom335_4),
865 EXAR_DEVICE(COMMTECH, 2324PCI335, pbn_fastcom335_4),873 EXAR_DEVICE(COMMTECH, 2324PCI335, pbn_fastcom335_4),
866 EXAR_DEVICE(COMMTECH, 2328PCI335, pbn_fastcom335_8),874 EXAR_DEVICE(COMMTECH, 2328PCI335, pbn_fastcom335_8),
875
876 EXAR_DEVICE(SEALEVEL, 710xC, pbn_exar_XR17V35x),
877 EXAR_DEVICE(SEALEVEL, 720xC, pbn_exar_XR17V35x),
878 EXAR_DEVICE(SEALEVEL, 740xC, pbn_exar_XR17V35x),
879 EXAR_DEVICE(SEALEVEL, 780xC, pbn_exar_XR17V35x),
880 EXAR_DEVICE(SEALEVEL, 716xC, pbn_exar_XR17V35x),
867 { 0, }881 { 0, }
868};882};
869MODULE_DEVICE_TABLE(pci, exar_pci_tbl);883MODULE_DEVICE_TABLE(pci, exar_pci_tbl);
drivers/tty/serial/amba-pl011.c+4−4
@@ -1466,6 +1466,10 @@ static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq) · 1465 unmodified lines
1466 struct circ_buf *xmit = &uap->port.state->xmit;1466 struct circ_buf *xmit = &uap->port.state->xmit;
1467 int count = uap->fifosize >> 1;1467 int count = uap->fifosize >> 1;
1468 1468
1469 if ((uap->port.rs485.flags & SER_RS485_ENABLED) &&
1470 !uap->rs485_tx_started)
1471 pl011_rs485_tx_start(uap);
1472
1469 if (uap->port.x_char) {1473 if (uap->port.x_char) {
1470 if (!pl011_tx_char(uap, uap->port.x_char, from_irq))1474 if (!pl011_tx_char(uap, uap->port.x_char, from_irq))
1471 return true;1475 return true;
@@ -1477,10 +1481,6 @@ static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq) · 5 unmodified lines
1477 return false;1481 return false;
1478 }1482 }
1479 1483
1480 if ((uap->port.rs485.flags & SER_RS485_ENABLED) &&
1481 !uap->rs485_tx_started)
1482 pl011_rs485_tx_start(uap);
1483
1484 /* If we are using DMA mode, try to send some characters. */1484 /* If we are using DMA mode, try to send some characters. */
1485 if (pl011_dma_tx_irq(uap))1485 if (pl011_dma_tx_irq(uap))
1486 return true;1486 return true;
drivers/tty/serial/atmel_serial.c+1−7
@@ -2657,13 +2657,7 @@ static void __init atmel_console_get_options(struct uart_port *port, int *baud, · 2656 unmodified lines
2657 else if (mr == ATMEL_US_PAR_ODD)2657 else if (mr == ATMEL_US_PAR_ODD)
2658 *parity = 'o';2658 *parity = 'o';
2659 2659
2660 /*2660 *baud = port->uartclk / (16 * quot);
2661 * The serial core only rounds down when matching this to a
2662 * supported baud rate. Make sure we don't end up slightly
2663 * lower than one of those, as it would make us fall through
2664 * to a much lower baud rate than we really want.
2665 */
2666 *baud = port->uartclk / (16 * (quot - 1));
2667}2661}
2668 2662
2669static int __init atmel_console_setup(struct console *co, char *options)2663static int __init atmel_console_setup(struct console *co, char *options)
drivers/tty/serial/pch_uart.c+1−1
@@ -749,7 +749,7 @@ static void pch_dma_tx_complete(void *arg) · 748 unmodified lines
749 uart_xmit_advance(port, sg_dma_len(sg));749 uart_xmit_advance(port, sg_dma_len(sg));
750 750
751 async_tx_ack(priv->desc_tx);751 async_tx_ack(priv->desc_tx);
752 dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE);752 dma_unmap_sg(port->dev, priv->sg_tx_p, priv->orig_nent, DMA_TO_DEVICE);
753 priv->tx_dma_use = 0;753 priv->tx_dma_use = 0;
754 priv->nent = 0;754 priv->nent = 0;
755 priv->orig_nent = 0;755 priv->orig_nent = 0;
drivers/tty/serial/qcom_geni_serial.c+24−8
@@ -864,9 +864,10 @@ out_unlock: · 863 unmodified lines
864 return IRQ_HANDLED;864 return IRQ_HANDLED;
865}865}
866 866
867static void get_tx_fifo_size(struct qcom_geni_serial_port *port)867static int setup_fifos(struct qcom_geni_serial_port *port)
868{868{
869 struct uart_port *uport;869 struct uart_port *uport;
870 u32 old_rx_fifo_depth = port->rx_fifo_depth;
870 871
871 uport = &port->uport;872 uport = &port->uport;
872 port->tx_fifo_depth = geni_se_get_tx_fifo_depth(&port->se);873 port->tx_fifo_depth = geni_se_get_tx_fifo_depth(&port->se);
@@ -874,6 +875,16 @@ static void get_tx_fifo_size(struct qcom_geni_serial_port *port) · 1 unmodified line
874 port->rx_fifo_depth = geni_se_get_rx_fifo_depth(&port->se);875 port->rx_fifo_depth = geni_se_get_rx_fifo_depth(&port->se);
875 uport->fifosize =876 uport->fifosize =
876 (port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE;877 (port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE;
878
879 if (port->rx_fifo && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
880 port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
881 port->rx_fifo_depth * sizeof(u32),
882 GFP_KERNEL);
883 if (!port->rx_fifo)
884 return -ENOMEM;
885 }
886
887 return 0;
877}888}
878 889
879 890
@@ -888,6 +899,7 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) · 8 unmodified lines
888 u32 rxstale = DEFAULT_BITS_PER_CHAR * STALE_TIMEOUT;899 u32 rxstale = DEFAULT_BITS_PER_CHAR * STALE_TIMEOUT;
889 u32 proto;900 u32 proto;
890 u32 pin_swap;901 u32 pin_swap;
902 int ret;
891 903
892 proto = geni_se_read_proto(&port->se);904 proto = geni_se_read_proto(&port->se);
893 if (proto != GENI_SE_UART) {905 if (proto != GENI_SE_UART) {
@@ -897,7 +909,9 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) · 3 unmodified lines
897 909
898 qcom_geni_serial_stop_rx(uport);910 qcom_geni_serial_stop_rx(uport);
899 911
900 get_tx_fifo_size(port);912 ret = setup_fifos(port);
913 if (ret)
914 return ret;
901 915
902 writel(rxstale, uport->membase + SE_UART_RX_STALE_CNT);916 writel(rxstale, uport->membase + SE_UART_RX_STALE_CNT);
903 917
@@ -1516,7 +1530,7 @@ static int qcom_geni_serial_remove(struct platform_device *pdev) · 612 unmodified lines
1516 return 0;1530 return 0;
1517}1531}
1518 1532
1519static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev)1533static int qcom_geni_serial_sys_suspend(struct device *dev)
1520{1534{
1521 struct qcom_geni_serial_port *port = dev_get_drvdata(dev);1535 struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
1522 struct uart_port *uport = &port->uport;1536 struct uart_port *uport = &port->uport;
@@ -1533,7 +1547,7 @@ static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev) · 10 unmodified lines
1533 return uart_suspend_port(private_data->drv, uport);1547 return uart_suspend_port(private_data->drv, uport);
1534}1548}
1535 1549
1536static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev)1550static int qcom_geni_serial_sys_resume(struct device *dev)
1537{1551{
1538 int ret;1552 int ret;
1539 struct qcom_geni_serial_port *port = dev_get_drvdata(dev);1553 struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
@@ -1581,10 +1595,12 @@ static int qcom_geni_serial_sys_hib_resume(struct device *dev) · 41 unmodified lines
1581}1595}
1582 1596
1583static const struct dev_pm_ops qcom_geni_serial_pm_ops = {1597static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
1584 SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend,1598 .suspend = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
1585 qcom_geni_serial_sys_resume)1599 .resume = pm_sleep_ptr(qcom_geni_serial_sys_resume),
1586 .restore = qcom_geni_serial_sys_hib_resume,1600 .freeze = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
1587 .thaw = qcom_geni_serial_sys_hib_resume,1601 .poweroff = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
1602 .restore = pm_sleep_ptr(qcom_geni_serial_sys_hib_resume),
1603 .thaw = pm_sleep_ptr(qcom_geni_serial_sys_hib_resume),
1588};1604};
1589 1605
1590static const struct of_device_id qcom_geni_serial_match_table[] = {1606static const struct of_device_id qcom_geni_serial_match_table[] = {