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

+47 -20
+3
drivers/accessibility/speakup/spk_ttyio.c
··· 354 354 { 355 355 struct tty_struct *tty = in_synth->dev; 356 356 357 + if (tty == NULL) 358 + return; 359 + 357 360 tty_lock(tty); 358 361 359 362 if (tty->ops->close)
+14
drivers/tty/serial/8250/8250_exar.c
··· 43 43 #define PCI_DEVICE_ID_EXAR_XR17V4358 0x4358 44 44 #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 52 #define UART_EXAR_INT0 0x80 47 53 #define UART_EXAR_8XMODE 0x88 /* 8X sampling rate select */ 48 54 #define UART_EXAR_SLEEP 0x8b /* Sleep mode */ ··· 644 638 nr_ports = BIT(((pcidev->device & 0x38) >> 3) - 1); 645 639 else if (board->num_ports) 646 640 nr_ports = board->num_ports; 641 + else if (pcidev->vendor == PCI_VENDOR_ID_SEALEVEL) 642 + nr_ports = pcidev->device & 0xff; 647 643 else 648 644 nr_ports = pcidev->device & 0x0f; 649 645 ··· 872 864 EXAR_DEVICE(COMMTECH, 4224PCI335, pbn_fastcom335_4), 873 865 EXAR_DEVICE(COMMTECH, 2324PCI335, pbn_fastcom335_4), 874 866 EXAR_DEVICE(COMMTECH, 2328PCI335, pbn_fastcom335_8), 867 + 868 + EXAR_DEVICE(SEALEVEL, 710xC, pbn_exar_XR17V35x), 869 + EXAR_DEVICE(SEALEVEL, 720xC, pbn_exar_XR17V35x), 870 + EXAR_DEVICE(SEALEVEL, 740xC, pbn_exar_XR17V35x), 871 + EXAR_DEVICE(SEALEVEL, 780xC, pbn_exar_XR17V35x), 872 + EXAR_DEVICE(SEALEVEL, 716xC, pbn_exar_XR17V35x), 875 873 { 0, } 876 874 }; 877 875 MODULE_DEVICE_TABLE(pci, exar_pci_tbl);
+4 -4
drivers/tty/serial/amba-pl011.c
··· 1466 1466 struct circ_buf *xmit = &uap->port.state->xmit; 1467 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 1473 if (uap->port.x_char) { 1470 1474 if (!pl011_tx_char(uap, uap->port.x_char, from_irq)) 1471 1475 return true; ··· 1480 1476 pl011_stop_tx(&uap->port); 1481 1477 return false; 1482 1478 } 1483 - 1484 - if ((uap->port.rs485.flags & SER_RS485_ENABLED) && 1485 - !uap->rs485_tx_started) 1486 - pl011_rs485_tx_start(uap); 1487 1479 1488 1480 /* If we are using DMA mode, try to send some characters. */ 1489 1481 if (pl011_dma_tx_irq(uap))
+1 -7
drivers/tty/serial/atmel_serial.c
··· 2657 2657 else if (mr == ATMEL_US_PAR_ODD) 2658 2658 *parity = 'o'; 2659 2659 2660 - /* 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)); 2660 + *baud = port->uartclk / (16 * quot); 2667 2661 } 2668 2662 2669 2663 static int __init atmel_console_setup(struct console *co, char *options)
+1 -1
drivers/tty/serial/pch_uart.c
··· 749 749 uart_xmit_advance(port, sg_dma_len(sg)); 750 750 751 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 753 priv->tx_dma_use = 0; 754 754 priv->nent = 0; 755 755 priv->orig_nent = 0;
+24 -8
drivers/tty/serial/qcom_geni_serial.c
··· 864 864 return IRQ_HANDLED; 865 865 } 866 866 867 - static void get_tx_fifo_size(struct qcom_geni_serial_port *port) 867 + static int setup_fifos(struct qcom_geni_serial_port *port) 868 868 { 869 869 struct uart_port *uport; 870 + u32 old_rx_fifo_depth = port->rx_fifo_depth; 870 871 871 872 uport = &port->uport; 872 873 port->tx_fifo_depth = geni_se_get_tx_fifo_depth(&port->se); ··· 875 874 port->rx_fifo_depth = geni_se_get_rx_fifo_depth(&port->se); 876 875 uport->fifosize = 877 876 (port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE; 877 + 878 + if (port->rx_fifo && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) { 879 + port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo, 880 + port->rx_fifo_depth * sizeof(u32), 881 + GFP_KERNEL); 882 + if (!port->rx_fifo) 883 + return -ENOMEM; 884 + } 885 + 886 + return 0; 878 887 } 879 888 880 889 ··· 899 888 u32 rxstale = DEFAULT_BITS_PER_CHAR * STALE_TIMEOUT; 900 889 u32 proto; 901 890 u32 pin_swap; 891 + int ret; 902 892 903 893 proto = geni_se_read_proto(&port->se); 904 894 if (proto != GENI_SE_UART) { ··· 909 897 910 898 qcom_geni_serial_stop_rx(uport); 911 899 912 - get_tx_fifo_size(port); 900 + ret = setup_fifos(port); 901 + if (ret) 902 + return ret; 913 903 914 904 writel(rxstale, uport->membase + SE_UART_RX_STALE_CNT); 915 905 ··· 1530 1516 return 0; 1531 1517 } 1532 1518 1533 - static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev) 1519 + static int qcom_geni_serial_sys_suspend(struct device *dev) 1534 1520 { 1535 1521 struct qcom_geni_serial_port *port = dev_get_drvdata(dev); 1536 1522 struct uart_port *uport = &port->uport; ··· 1547 1533 return uart_suspend_port(private_data->drv, uport); 1548 1534 } 1549 1535 1550 - static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev) 1536 + static int qcom_geni_serial_sys_resume(struct device *dev) 1551 1537 { 1552 1538 int ret; 1553 1539 struct qcom_geni_serial_port *port = dev_get_drvdata(dev); ··· 1595 1581 } 1596 1582 1597 1583 static const struct dev_pm_ops qcom_geni_serial_pm_ops = { 1598 - SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend, 1599 - qcom_geni_serial_sys_resume) 1600 - .restore = qcom_geni_serial_sys_hib_resume, 1601 - .thaw = qcom_geni_serial_sys_hib_resume, 1584 + .suspend = pm_sleep_ptr(qcom_geni_serial_sys_suspend), 1585 + .resume = pm_sleep_ptr(qcom_geni_serial_sys_resume), 1586 + .freeze = pm_sleep_ptr(qcom_geni_serial_sys_suspend), 1587 + .poweroff = pm_sleep_ptr(qcom_geni_serial_sys_suspend), 1588 + .restore = pm_sleep_ptr(qcom_geni_serial_sys_hib_resume), 1589 + .thaw = pm_sleep_ptr(qcom_geni_serial_sys_hib_resume), 1602 1590 }; 1603 1591 1604 1592 static const struct of_device_id qcom_geni_serial_match_table[] = {