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
354354 {
355355 struct tty_struct *tty = in_synth->dev;
356356
357+ if (tty == NULL)
358+ return;
359+
357360 tty_lock(tty);
358361
359362 if (tty->ops->close)
drivers/tty/serial/8250/8250_exar.c+14−0
@@ -43,6 +43,12 @@ · 42 unmodified lines
4343 #define PCI_DEVICE_ID_EXAR_XR17V4358 0x4358
4444 #define PCI_DEVICE_ID_EXAR_XR17V8358 0x8358
4545
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+
4652 #define UART_EXAR_INT0 0x80
4753 #define UART_EXAR_8XMODE 0x88 /* 8X sampling rate select */
4854 #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
638644 nr_ports = BIT(((pcidev->device & 0x38) >> 3) - 1);
639645 else if (board->num_ports)
640646 nr_ports = board->num_ports;
647+ else if (pcidev->vendor == PCI_VENDOR_ID_SEALEVEL)
648+ nr_ports = pcidev->device & 0xff;
641649 else
642650 nr_ports = pcidev->device & 0x0f;
643651
@@ -864,6 +872,12 @@ static const struct pci_device_id exar_pci_tbl[] = { · 220 unmodified lines
864872 EXAR_DEVICE(COMMTECH, 4224PCI335, pbn_fastcom335_4),
865873 EXAR_DEVICE(COMMTECH, 2324PCI335, pbn_fastcom335_4),
866874 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),
867881 { 0, }
868882 };
869883 MODULE_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
14661466 struct circ_buf *xmit = &uap->port.state->xmit;
14671467 int count = uap->fifosize >> 1;
14681468
1469+ if ((uap->port.rs485.flags & SER_RS485_ENABLED) &&
1470+ !uap->rs485_tx_started)
1471+ pl011_rs485_tx_start(uap);
1472+
14691473 if (uap->port.x_char) {
14701474 if (!pl011_tx_char(uap, uap->port.x_char, from_irq))
14711475 return true;
@@ -1477,10 +1481,6 @@ static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq) · 5 unmodified lines
14771481 return false;
14781482 }
14791483
1480− if ((uap->port.rs485.flags & SER_RS485_ENABLED) &&
1481− !uap->rs485_tx_started)
1482− pl011_rs485_tx_start(uap);
1483−
14841484 /* If we are using DMA mode, try to send some characters. */
14851485 if (pl011_dma_tx_irq(uap))
14861486 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
26572657 else if (mr == ATMEL_US_PAR_ODD)
26582658 *parity = 'o';
26592659
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);
26672661 }
26682662
26692663 static 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
749749 uart_xmit_advance(port, sg_dma_len(sg));
750750
751751 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);
753753 priv->tx_dma_use = 0;
754754 priv->nent = 0;
755755 priv->orig_nent = 0;
drivers/tty/serial/qcom_geni_serial.c+24−8
@@ -864,9 +864,10 @@ out_unlock: · 863 unmodified lines
864864 return IRQ_HANDLED;
865865 }
866866
867−static void get_tx_fifo_size(struct qcom_geni_serial_port *port)
867+static int setup_fifos(struct qcom_geni_serial_port *port)
868868 {
869869 struct uart_port *uport;
870+ u32 old_rx_fifo_depth = port->rx_fifo_depth;
870871
871872 uport = &port->uport;
872873 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
874875 port->rx_fifo_depth = geni_se_get_rx_fifo_depth(&port->se);
875876 uport->fifosize =
876877 (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;
877888 }
878889
879890
@@ -888,6 +899,7 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) · 8 unmodified lines
888899 u32 rxstale = DEFAULT_BITS_PER_CHAR * STALE_TIMEOUT;
889900 u32 proto;
890901 u32 pin_swap;
902+ int ret;
891903
892904 proto = geni_se_read_proto(&port->se);
893905 if (proto != GENI_SE_UART) {
@@ -897,7 +909,9 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) · 3 unmodified lines
897909
898910 qcom_geni_serial_stop_rx(uport);
899911
900− get_tx_fifo_size(port);
912+ ret = setup_fifos(port);
913+ if (ret)
914+ return ret;
901915
902916 writel(rxstale, uport->membase + SE_UART_RX_STALE_CNT);
903917
@@ -1516,7 +1530,7 @@ static int qcom_geni_serial_remove(struct platform_device *pdev) · 612 unmodified lines
15161530 return 0;
15171531 }
15181532
1519−static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev)
1533+static int qcom_geni_serial_sys_suspend(struct device *dev)
15201534 {
15211535 struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
15221536 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
15331547 return uart_suspend_port(private_data->drv, uport);
15341548 }
15351549
1536−static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev)
1550+static int qcom_geni_serial_sys_resume(struct device *dev)
15371551 {
15381552 int ret;
15391553 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
15811595 }
15821596
15831597 static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
1584− SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend,
1585− qcom_geni_serial_sys_resume)
1586− .restore = qcom_geni_serial_sys_hib_resume,
1587− .thaw = qcom_geni_serial_sys_hib_resume,
1598+ .suspend = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
1599+ .resume = pm_sleep_ptr(qcom_geni_serial_sys_resume),
1600+ .freeze = pm_sleep_ptr(qcom_geni_serial_sys_suspend),
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),
15881604 };
15891605
15901606 static const struct of_device_id qcom_geni_serial_match_table[] = {