summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-11-03 15:44:25 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2023-11-03 15:44:25 -1000
commit1f24458a1071f006e3f7449c08ae0f12af493923 (patch)
tree3ed2b1f8de10f6638ce37dc4a41377e2b086f301 /drivers/tty
parent4c7a0c95adc3ed8cc5e4c2187521aea3e40ba1aa (diff)
parent64ebf8797249e792af2143eb9e4bd404d10a022e (diff)
downloadlinux-1f24458a1071f006e3f7449c08ae0f12af493923.tar.gz
linux-1f24458a1071f006e3f7449c08ae0f12af493923.tar.bz2
linux-1f24458a1071f006e3f7449c08ae0f12af493923.zip
Merge tag 'tty-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty and serial updates from Greg KH: "Here is the big set of tty/serial driver changes for 6.7-rc1. Included in here are: - console/vgacon cleanups and removals from Arnd - tty core and n_tty cleanups from Jiri - lots of 8250 driver updates and cleanups - sc16is7xx serial driver updates - dt binding updates - first set of port lock wrapers from Thomas for the printk fixes coming in future releases - other small serial and tty core cleanups and updates All of these have been in linux-next for a while with no reported issues" * tag 'tty-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (193 commits) serdev: Replace custom code with device_match_acpi_handle() serdev: Simplify devm_serdev_device_open() function serdev: Make use of device_set_node() tty: n_gsm: add copyright Siemens Mobility GmbH tty: n_gsm: fix race condition in status line change on dead connections serial: core: Fix runtime PM handling for pending tx vgacon: fix mips/sibyte build regression dt-bindings: serial: drop unsupported samsung bindings tty: serial: samsung: drop earlycon support for unsupported platforms tty: 8250: Add note for PX-835 tty: 8250: Fix IS-200 PCI ID comment tty: 8250: Add Brainboxes Oxford Semiconductor-based quirks tty: 8250: Add support for Intashield IX cards tty: 8250: Add support for additional Brainboxes PX cards tty: 8250: Fix up PX-803/PX-857 tty: 8250: Fix port count of PX-257 tty: 8250: Add support for Intashield IS-100 tty: 8250: Add support for Brainboxes UP cards tty: 8250: Add support for additional Brainboxes UC cards tty: 8250: Remove UC-257 and UC-431 ...
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/hvc/hvc_xen.c39
-rw-r--r--drivers/tty/hvc/hvcs.c2
-rw-r--r--drivers/tty/mxser.c2
-rw-r--r--drivers/tty/n_gsm.c3
-rw-r--r--drivers/tty/n_tty.c77
-rw-r--r--drivers/tty/serdev/core.c24
-rw-r--r--drivers/tty/serial/21285.c8
-rw-r--r--drivers/tty/serial/8250/8250_aspeed_vuart.c33
-rw-r--r--drivers/tty/serial/8250/8250_bcm7271.c69
-rw-r--r--drivers/tty/serial/8250/8250_core.c14
-rw-r--r--drivers/tty/serial/8250/8250_dma.c8
-rw-r--r--drivers/tty/serial/8250/8250_dw.c35
-rw-r--r--drivers/tty/serial/8250/8250_exar.c63
-rw-r--r--drivers/tty/serial/8250/8250_fsl.c6
-rw-r--r--drivers/tty/serial/8250/8250_mid.c18
-rw-r--r--drivers/tty/serial/8250/8250_mtk.c8
-rw-r--r--drivers/tty/serial/8250/8250_of.c44
-rw-r--r--drivers/tty/serial/8250/8250_omap.c114
-rw-r--r--drivers/tty/serial/8250/8250_pci.c591
-rw-r--r--drivers/tty/serial/8250/8250_pci1xxxx.c10
-rw-r--r--drivers/tty/serial/8250/8250_port.c111
-rw-r--r--drivers/tty/serial/8250/Kconfig2
-rw-r--r--drivers/tty/serial/8250/Makefile42
-rw-r--r--drivers/tty/serial/Kconfig26
-rw-r--r--drivers/tty/serial/Makefile126
-rw-r--r--drivers/tty/serial/altera_jtaguart.c28
-rw-r--r--drivers/tty/serial/altera_uart.c20
-rw-r--r--drivers/tty/serial/amba-pl010.c20
-rw-r--r--drivers/tty/serial/amba-pl011.c74
-rw-r--r--drivers/tty/serial/apbuart.c8
-rw-r--r--drivers/tty/serial/ar933x_uart.c26
-rw-r--r--drivers/tty/serial/arc_uart.c16
-rw-r--r--drivers/tty/serial/atmel_serial.c24
-rw-r--r--drivers/tty/serial/bcm63xx_uart.c22
-rw-r--r--drivers/tty/serial/cpm_uart.c8
-rw-r--r--drivers/tty/serial/digicolor-usart.c18
-rw-r--r--drivers/tty/serial/dz.c32
-rw-r--r--drivers/tty/serial/esp32_acm.c459
-rw-r--r--drivers/tty/serial/esp32_uart.c784
-rw-r--r--drivers/tty/serial/fsl_linflexuart.c32
-rw-r--r--drivers/tty/serial/fsl_lpuart.c88
-rw-r--r--drivers/tty/serial/icom.c26
-rw-r--r--drivers/tty/serial/imx.c128
-rw-r--r--drivers/tty/serial/ip22zilog.c36
-rw-r--r--drivers/tty/serial/jsm/jsm_neo.c4
-rw-r--r--drivers/tty/serial/jsm/jsm_tty.c16
-rw-r--r--drivers/tty/serial/liteuart.c20
-rw-r--r--drivers/tty/serial/lpc32xx_hs.c26
-rw-r--r--drivers/tty/serial/ma35d1_serial.c25
-rw-r--r--drivers/tty/serial/max310x.c2
-rw-r--r--drivers/tty/serial/mcf.c20
-rw-r--r--drivers/tty/serial/men_z135_uart.c8
-rw-r--r--drivers/tty/serial/meson_uart.c48
-rw-r--r--drivers/tty/serial/milbeaut_usio.c16
-rw-r--r--drivers/tty/serial/mpc52xx_uart.c12
-rw-r--r--drivers/tty/serial/mps2-uart.c16
-rw-r--r--drivers/tty/serial/msm_serial.c38
-rw-r--r--drivers/tty/serial/mvebu-uart.c18
-rw-r--r--drivers/tty/serial/omap-serial.c38
-rw-r--r--drivers/tty/serial/owl-uart.c26
-rw-r--r--drivers/tty/serial/pch_uart.c10
-rw-r--r--drivers/tty/serial/pic32_uart.c20
-rw-r--r--drivers/tty/serial/pmac_zilog.c52
-rw-r--r--drivers/tty/serial/pxa.c30
-rw-r--r--drivers/tty/serial/qcom_geni_serial.c8
-rw-r--r--drivers/tty/serial/rda-uart.c34
-rw-r--r--drivers/tty/serial/rp2.c20
-rw-r--r--drivers/tty/serial/sa1100.c20
-rw-r--r--drivers/tty/serial/samsung_tty.c171
-rw-r--r--drivers/tty/serial/sb1250-duart.c12
-rw-r--r--drivers/tty/serial/sc16is7xx.c83
-rw-r--r--drivers/tty/serial/serial-tegra.c32
-rw-r--r--drivers/tty/serial/serial_core.c131
-rw-r--r--drivers/tty/serial/serial_mctrl_gpio.c4
-rw-r--r--drivers/tty/serial/serial_port.c4
-rw-r--r--drivers/tty/serial/serial_txx9.c26
-rw-r--r--drivers/tty/serial/sh-sci.c68
-rw-r--r--drivers/tty/serial/sifive.c16
-rw-r--r--drivers/tty/serial/sprd_serial.c30
-rw-r--r--drivers/tty/serial/st-asc.c18
-rw-r--r--drivers/tty/serial/stm32-usart.c51
-rw-r--r--drivers/tty/serial/sunhv.c28
-rw-r--r--drivers/tty/serial/sunplus-uart.c26
-rw-r--r--drivers/tty/serial/sunsab.c34
-rw-r--r--drivers/tty/serial/sunsu.c46
-rw-r--r--drivers/tty/serial/sunzilog.c42
-rw-r--r--drivers/tty/serial/timbuart.c8
-rw-r--r--drivers/tty/serial/uartlite.c18
-rw-r--r--drivers/tty/serial/ucc_uart.c4
-rw-r--r--drivers/tty/serial/vt8500_serial.c8
-rw-r--r--drivers/tty/serial/xilinx_uartps.c58
-rw-r--r--drivers/tty/sysrq.c3
-rw-r--r--drivers/tty/tty.h13
-rw-r--r--drivers/tty/tty_buffer.c5
-rw-r--r--drivers/tty/tty_io.c130
-rw-r--r--drivers/tty/tty_ioctl.c234
-rw-r--r--drivers/tty/tty_jobctrl.c17
-rw-r--r--drivers/tty/tty_port.c6
-rw-r--r--drivers/tty/vcc.c16
-rw-r--r--drivers/tty/vt/consolemap.c2
-rw-r--r--drivers/tty/vt/keyboard.c7
-rw-r--r--drivers/tty/vt/vc_screen.c32
-rw-r--r--drivers/tty/vt/vt.c29
103 files changed, 3415 insertions, 1848 deletions
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index 98764e740c07..34c01874f45b 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -377,18 +377,21 @@ void xen_console_resume(void)
#ifdef CONFIG_HVC_XEN_FRONTEND
static void xencons_disconnect_backend(struct xencons_info *info)
{
- if (info->irq > 0)
- unbind_from_irqhandler(info->irq, NULL);
- info->irq = 0;
+ if (info->hvc != NULL)
+ hvc_remove(info->hvc);
+ info->hvc = NULL;
+ if (info->irq > 0) {
+ evtchn_put(info->evtchn);
+ info->irq = 0;
+ info->evtchn = 0;
+ }
+ /* evtchn_put() will also close it so this is only an error path */
if (info->evtchn > 0)
xenbus_free_evtchn(info->xbdev, info->evtchn);
info->evtchn = 0;
if (info->gntref > 0)
gnttab_free_grant_references(info->gntref);
info->gntref = 0;
- if (info->hvc != NULL)
- hvc_remove(info->hvc);
- info->hvc = NULL;
}
static void xencons_free(struct xencons_info *info)
@@ -433,7 +436,7 @@ static int xencons_connect_backend(struct xenbus_device *dev,
if (ret)
return ret;
info->evtchn = evtchn;
- irq = bind_interdomain_evtchn_to_irq_lateeoi(dev, evtchn);
+ irq = bind_evtchn_to_irq_lateeoi(evtchn);
if (irq < 0)
return irq;
info->irq = irq;
@@ -553,10 +556,23 @@ static void xencons_backend_changed(struct xenbus_device *dev,
if (dev->state == XenbusStateClosed)
break;
fallthrough; /* Missed the backend's CLOSING state */
- case XenbusStateClosing:
+ case XenbusStateClosing: {
+ struct xencons_info *info = dev_get_drvdata(&dev->dev);;
+
+ /*
+ * Don't tear down the evtchn and grant ref before the other
+ * end has disconnected, but do stop userspace from trying
+ * to use the device before we allow the backend to close.
+ */
+ if (info->hvc) {
+ hvc_remove(info->hvc);
+ info->hvc = NULL;
+ }
+
xenbus_frontend_closed(dev);
break;
}
+ }
}
static const struct xenbus_device_id xencons_ids[] = {
@@ -588,7 +604,7 @@ static int __init xen_hvc_init(void)
ops = &dom0_hvc_ops;
r = xen_initial_domain_console_init();
if (r < 0)
- return r;
+ goto register_fe;
info = vtermno_to_xencons(HVC_COOKIE);
} else {
ops = &domU_hvc_ops;
@@ -597,7 +613,7 @@ static int __init xen_hvc_init(void)
else
r = xen_pv_console_init();
if (r < 0)
- return r;
+ goto register_fe;
info = vtermno_to_xencons(HVC_COOKIE);
info->irq = bind_evtchn_to_irq_lateeoi(info->evtchn);
@@ -616,12 +632,13 @@ static int __init xen_hvc_init(void)
list_del(&info->list);
spin_unlock_irqrestore(&xencons_lock, flags);
if (info->irq)
- unbind_from_irqhandler(info->irq, NULL);
+ evtchn_put(info->evtchn);
kfree(info);
return r;
}
r = 0;
+ register_fe:
#ifdef CONFIG_HVC_XEN_FRONTEND
r = xenbus_register_frontend(&xencons_driver);
#endif
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 98433a53bae1..f57fd9095f75 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -664,7 +664,6 @@ static void hvcs_return_index(int index)
static void hvcs_destruct_port(struct tty_port *p)
{
struct hvcs_struct *hvcsd = container_of(p, struct hvcs_struct, port);
- struct vio_dev *vdev;
struct completion *comp;
unsigned long flags;
@@ -686,7 +685,6 @@ static void hvcs_destruct_port(struct tty_port *p)
printk(KERN_INFO "HVCS: Destroyed hvcs_struct for vty-server@%X.\n",
hvcsd->vdev->unit_address);
- vdev = hvcsd->vdev;
hvcsd->vdev = NULL;
hvcsd->p_unit_address = 0;
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 10aa4ed38793..6ce7f259968f 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -288,7 +288,7 @@ struct mxser_board {
enum mxser_must_hwid must_hwid;
speed_t max_baud;
- struct mxser_port ports[];
+ struct mxser_port ports[] __counted_by(nports);
};
static DECLARE_BITMAP(mxser_boards, MXSER_BOARDS);
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 1f3aba607cd5..a3ab3946e4ad 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2,6 +2,7 @@
/*
* n_gsm.c GSM 0710 tty multiplexor
* Copyright (c) 2009/10 Intel Corporation
+ * Copyright (c) 2022/23 Siemens Mobility GmbH
*
* * THIS IS A DEVELOPMENT SNAPSHOT IT IS NOT A FINAL RELEASE *
*
@@ -4108,6 +4109,8 @@ static int gsm_modem_upd_via_msc(struct gsm_dlci *dlci, u8 brk)
static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk)
{
+ if (dlci->gsm->dead)
+ return -EL2HLT;
if (dlci->adaption == 2) {
/* Send convergence layer type 2 empty data frame. */
gsm_modem_upd_via_data(dlci, brk);
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 6c9a408d67cd..f252d0b5a434 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -249,15 +249,12 @@ static void n_tty_check_throttle(struct tty_struct *tty)
if (ldata->icanon && ldata->canon_head == ldata->read_tail)
return;
- while (1) {
- int throttled;
+ do {
tty_set_flow_change(tty, TTY_THROTTLE_SAFE);
if (N_TTY_BUF_SIZE - read_cnt(ldata) >= TTY_THRESHOLD_THROTTLE)
break;
- throttled = tty_throttle_safe(tty);
- if (!throttled)
- break;
- }
+ } while (!tty_throttle_safe(tty));
+
__tty_set_flow_change(tty, 0);
}
@@ -279,16 +276,14 @@ static void n_tty_check_unthrottle(struct tty_struct *tty)
* we won't get any more characters.
*/
- while (1) {
- int unthrottled;
+ do {
tty_set_flow_change(tty, TTY_UNTHROTTLE_SAFE);
if (chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE)
break;
+
n_tty_kick_worker(tty);
- unthrottled = tty_unthrottle_safe(tty);
- if (!unthrottled)
- break;
- }
+ } while (!tty_unthrottle_safe(tty));
+
__tty_set_flow_change(tty, 0);
}
@@ -1965,26 +1960,27 @@ static bool copy_from_read_buf(const struct tty_struct *tty, u8 **kbp,
size_t head = smp_load_acquire(&ldata->commit_head);
size_t tail = MASK(ldata->read_tail);
- n = min(head - ldata->read_tail, N_TTY_BUF_SIZE - tail);
- n = min(*nr, n);
- if (n) {
- u8 *from = read_buf_addr(ldata, tail);
- memcpy(*kbp, from, n);
- is_eof = n == 1 && *from == EOF_CHAR(tty);
- tty_audit_add_data(tty, from, n);
- zero_buffer(tty, from, n);
- smp_store_release(&ldata->read_tail, ldata->read_tail + n);
- /* Turn single EOF into zero-length read */
- if (L_EXTPROC(tty) && ldata->icanon && is_eof &&
- (head == ldata->read_tail))
- return false;
- *kbp += n;
- *nr -= n;
-
- /* If we have more to copy, let the caller know */
- return head != ldata->read_tail;
- }
- return false;
+ n = min3(head - ldata->read_tail, N_TTY_BUF_SIZE - tail, *nr);
+ if (!n)
+ return false;
+
+ u8 *from = read_buf_addr(ldata, tail);
+ memcpy(*kbp, from, n);
+ is_eof = n == 1 && *from == EOF_CHAR(tty);
+ tty_audit_add_data(tty, from, n);
+ zero_buffer(tty, from, n