diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-21 03:36:21 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-12-21 03:36:21 -0500 |
commit | 0529357f102b96f68bc199f858d1c3b07f4b674c (patch) | |
tree | eaa047952a768099e00a5245afa0d84799df6990 /drivers/tty | |
parent | a9f1a3e4c1c7dc82711bc22dc52c7b0d6912ed56 (diff) | |
parent | 4ef7675344d687a0ef5b0d7c0cee12da005870c0 (diff) |
Merge tag 'v4.4-rc6' into devel
Linux 4.4-rc6
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/n_tty.c | 24 | ||||
-rw-r--r-- | drivers/tty/serial/8250/8250_fsl.c | 1 | ||||
-rw-r--r-- | drivers/tty/serial/8250/8250_uniphier.c | 8 | ||||
-rw-r--r-- | drivers/tty/serial/8250/Kconfig | 1 | ||||
-rw-r--r-- | drivers/tty/serial/Kconfig | 2 | ||||
-rw-r--r-- | drivers/tty/serial/bcm63xx_uart.c | 2 | ||||
-rw-r--r-- | drivers/tty/serial/earlycon.c | 2 | ||||
-rw-r--r-- | drivers/tty/serial/etraxfs-uart.c | 2 | ||||
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 2 | ||||
-rw-r--r-- | drivers/tty/tty_audit.c | 2 | ||||
-rw-r--r-- | drivers/tty/tty_buffer.c | 2 | ||||
-rw-r--r-- | drivers/tty/tty_io.c | 4 | ||||
-rw-r--r-- | drivers/tty/tty_ioctl.c | 4 | ||||
-rw-r--r-- | drivers/tty/tty_ldisc.c | 2 |
14 files changed, 31 insertions, 27 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 13844261cd5f..e49c2bce551d 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -169,7 +169,7 @@ static inline int tty_copy_to_user(struct tty_struct *tty, | |||
169 | { | 169 | { |
170 | struct n_tty_data *ldata = tty->disc_data; | 170 | struct n_tty_data *ldata = tty->disc_data; |
171 | 171 | ||
172 | tty_audit_add_data(tty, to, n, ldata->icanon); | 172 | tty_audit_add_data(tty, from, n, ldata->icanon); |
173 | return copy_to_user(to, from, n); | 173 | return copy_to_user(to, from, n); |
174 | } | 174 | } |
175 | 175 | ||
@@ -2054,13 +2054,13 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, | |||
2054 | size_t eol; | 2054 | size_t eol; |
2055 | size_t tail; | 2055 | size_t tail; |
2056 | int ret, found = 0; | 2056 | int ret, found = 0; |
2057 | bool eof_push = 0; | ||
2058 | 2057 | ||
2059 | /* N.B. avoid overrun if nr == 0 */ | 2058 | /* N.B. avoid overrun if nr == 0 */ |
2060 | n = min(*nr, smp_load_acquire(&ldata->canon_head) - ldata->read_tail); | 2059 | if (!*nr) |
2061 | if (!n) | ||
2062 | return 0; | 2060 | return 0; |
2063 | 2061 | ||
2062 | n = min(*nr + 1, smp_load_acquire(&ldata->canon_head) - ldata->read_tail); | ||
2063 | |||
2064 | tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); | 2064 | tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); |
2065 | size = min_t(size_t, tail + n, N_TTY_BUF_SIZE); | 2065 | size = min_t(size_t, tail + n, N_TTY_BUF_SIZE); |
2066 | 2066 | ||
@@ -2081,12 +2081,11 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, | |||
2081 | n = eol - tail; | 2081 | n = eol - tail; |
2082 | if (n > N_TTY_BUF_SIZE) | 2082 | if (n > N_TTY_BUF_SIZE) |
2083 | n += N_TTY_BUF_SIZE; | 2083 | n += N_TTY_BUF_SIZE; |
2084 | n += found; | 2084 | c = n + found; |
2085 | c = n; | ||
2086 | 2085 | ||
2087 | if (found && !ldata->push && read_buf(ldata, eol) == __DISABLED_CHAR) { | 2086 | if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) { |
2088 | n--; | 2087 | c = min(*nr, c); |
2089 | eof_push = !n && ldata->read_tail != ldata->line_start; | 2088 | n = c; |
2090 | } | 2089 | } |
2091 | 2090 | ||
2092 | n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu size:%zu more:%zu\n", | 2091 | n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu size:%zu more:%zu\n", |
@@ -2116,7 +2115,7 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, | |||
2116 | ldata->push = 0; | 2115 | ldata->push = 0; |
2117 | tty_audit_push(tty); | 2116 | tty_audit_push(tty); |
2118 | } | 2117 | } |
2119 | return eof_push ? -EAGAIN : 0; | 2118 | return 0; |
2120 | } | 2119 | } |
2121 | 2120 | ||
2122 | extern ssize_t redirected_tty_write(struct file *, const char __user *, | 2121 | extern ssize_t redirected_tty_write(struct file *, const char __user *, |
@@ -2273,10 +2272,7 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, | |||
2273 | 2272 | ||
2274 | if (ldata->icanon && !L_EXTPROC(tty)) { | 2273 | if (ldata->icanon && !L_EXTPROC(tty)) { |
2275 | retval = canon_copy_from_read_buf(tty, &b, &nr); | 2274 | retval = canon_copy_from_read_buf(tty, &b, &nr); |
2276 | if (retval == -EAGAIN) { | 2275 | if (retval) |
2277 | retval = 0; | ||
2278 | continue; | ||
2279 | } else if (retval) | ||
2280 | break; | 2276 | break; |
2281 | } else { | 2277 | } else { |
2282 | int uncopied; | 2278 | int uncopied; |
diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8250_fsl.c index c0533a57ec53..910bfee5a88b 100644 --- a/drivers/tty/serial/8250/8250_fsl.c +++ b/drivers/tty/serial/8250/8250_fsl.c | |||
@@ -60,3 +60,4 @@ int fsl8250_handle_irq(struct uart_port *port) | |||
60 | spin_unlock_irqrestore(&up->port.lock, flags); | 60 | spin_unlock_irqrestore(&up->port.lock, flags); |
61 | return 1; | 61 | return 1; |
62 | } | 62 | } |
63 | EXPORT_SYMBOL_GPL(fsl8250_handle_irq); | ||
diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c index d11621e2cf1d..245edbb68d4b 100644 --- a/drivers/tty/serial/8250/8250_uniphier.c +++ b/drivers/tty/serial/8250/8250_uniphier.c | |||
@@ -115,12 +115,16 @@ static void uniphier_serial_out(struct uart_port *p, int offset, int value) | |||
115 | */ | 115 | */ |
116 | static int uniphier_serial_dl_read(struct uart_8250_port *up) | 116 | static int uniphier_serial_dl_read(struct uart_8250_port *up) |
117 | { | 117 | { |
118 | return readl(up->port.membase + UNIPHIER_UART_DLR); | 118 | int offset = UNIPHIER_UART_DLR << up->port.regshift; |
119 | |||
120 | return readl(up->port.membase + offset); | ||
119 | } | 121 | } |
120 | 122 | ||
121 | static void uniphier_serial_dl_write(struct uart_8250_port *up, int value) | 123 | static void uniphier_serial_dl_write(struct uart_8250_port *up, int value) |
122 | { | 124 | { |
123 | writel(value, up->port.membase + UNIPHIER_UART_DLR); | 125 | int offset = UNIPHIER_UART_DLR << up->port.regshift; |
126 | |||
127 | writel(value, up->port.membase + offset); | ||
124 | } | 128 | } |
125 | 129 | ||
126 | static int uniphier_of_serial_setup(struct device *dev, struct uart_port *port, | 130 | static int uniphier_of_serial_setup(struct device *dev, struct uart_port *port, |
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig index e6f5e12a2d83..6412f1455beb 100644 --- a/drivers/tty/serial/8250/Kconfig +++ b/drivers/tty/serial/8250/Kconfig | |||
@@ -373,6 +373,7 @@ config SERIAL_8250_MID | |||
373 | depends on SERIAL_8250 && PCI | 373 | depends on SERIAL_8250 && PCI |
374 | select HSU_DMA if SERIAL_8250_DMA | 374 | select HSU_DMA if SERIAL_8250_DMA |
375 | select HSU_DMA_PCI if X86_INTEL_MID | 375 | select HSU_DMA_PCI if X86_INTEL_MID |
376 | select RATIONAL | ||
376 | help | 377 | help |
377 | Selecting this option will enable handling of the extra features | 378 | Selecting this option will enable handling of the extra features |
378 | present on the UART found on Intel Medfield SOC and various other | 379 | present on the UART found on Intel Medfield SOC and various other |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 1aec4404062d..f38beb28e7ae 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -1539,7 +1539,6 @@ config SERIAL_FSL_LPUART | |||
1539 | tristate "Freescale lpuart serial port support" | 1539 | tristate "Freescale lpuart serial port support" |
1540 | depends on HAS_DMA | 1540 | depends on HAS_DMA |
1541 | select SERIAL_CORE | 1541 | select SERIAL_CORE |
1542 | select SERIAL_EARLYCON | ||
1543 | help | 1542 | help |
1544 | Support for the on-chip lpuart on some Freescale SOCs. | 1543 | Support for the on-chip lpuart on some Freescale SOCs. |
1545 | 1544 | ||
@@ -1547,6 +1546,7 @@ config SERIAL_FSL_LPUART_CONSOLE | |||
1547 | bool "Console on Freescale lpuart serial port" | 1546 | bool "Console on Freescale lpuart serial port" |
1548 | depends on SERIAL_FSL_LPUART=y | 1547 | depends on SERIAL_FSL_LPUART=y |
1549 | select SERIAL_CORE_CONSOLE | 1548 | select SERIAL_CORE_CONSOLE |
1549 | select SERIAL_EARLYCON | ||
1550 | help | 1550 | help |
1551 | If you have enabled the lpuart serial port on the Freescale SoCs, | 1551 | If you have enabled the lpuart serial port on the Freescale SoCs, |
1552 | you can make it the console by answering Y to this option. | 1552 | you can make it the console by answering Y to this option. |
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c index 681e0f3d5e0e..a1c0a89d9c7f 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c | |||
@@ -474,7 +474,7 @@ static int bcm_uart_startup(struct uart_port *port) | |||
474 | 474 | ||
475 | /* register irq and enable rx interrupts */ | 475 | /* register irq and enable rx interrupts */ |
476 | ret = request_irq(port->irq, bcm_uart_interrupt, 0, | 476 | ret = request_irq(port->irq, bcm_uart_interrupt, 0, |
477 | bcm_uart_type(port), port); | 477 | dev_name(port->dev), port); |
478 | if (ret) | 478 | if (ret) |
479 | return ret; | 479 | return ret; |
480 | bcm_uart_writel(port, UART_RX_INT_MASK, UART_IR_REG); | 480 | bcm_uart_writel(port, UART_RX_INT_MASK, UART_IR_REG); |
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index f09636083426..b5b2f2be6be7 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c | |||
@@ -115,6 +115,7 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match) | |||
115 | if (buf && !parse_options(&early_console_dev, buf)) | 115 | if (buf && !parse_options(&early_console_dev, buf)) |
116 | buf = NULL; | 116 | buf = NULL; |
117 | 117 | ||
118 | spin_lock_init(&port->lock); | ||
118 | port->uartclk = BASE_BAUD * 16; | 119 | port->uartclk = BASE_BAUD * 16; |
119 | if (port->mapbase) | 120 | if (port->mapbase) |
120 | port->membase = earlycon_map(port->mapbase, 64); | 121 | port->membase = earlycon_map(port->mapbase, 64); |
@@ -202,6 +203,7 @@ int __init of_setup_earlycon(unsigned long addr, | |||
202 | int err; | 203 | int err; |
203 | struct uart_port *port = &early_console_dev.port; | 204 | struct uart_port *port = &early_console_dev.port; |
204 | 205 | ||
206 | spin_lock_init(&port->lock); | ||
205 | port->iotype = UPIO_MEM; | 207 | port->iotype = UPIO_MEM; |
206 | port->mapbase = addr; | 208 | port->mapbase = addr; |
207 | port->uartclk = BASE_BAUD * 16; | 209 | port->uartclk = BASE_BAUD * 16; |
diff --git a/drivers/tty/serial/etraxfs-uart.c b/drivers/tty/serial/etraxfs-uart.c index 6813e316e9ff..2f80bc7e44fb 100644 --- a/drivers/tty/serial/etraxfs-uart.c +++ b/drivers/tty/serial/etraxfs-uart.c | |||
@@ -894,7 +894,7 @@ static int etraxfs_uart_probe(struct platform_device *pdev) | |||
894 | up->regi_ser = of_iomap(np, 0); | 894 | up->regi_ser = of_iomap(np, 0); |
895 | up->port.dev = &pdev->dev; | 895 | up->port.dev = &pdev->dev; |
896 | 896 | ||
897 | up->gpios = mctrl_gpio_init(&pdev->dev, 0); | 897 | up->gpios = mctrl_gpio_init_noauto(&pdev->dev, 0); |
898 | if (IS_ERR(up->gpios)) | 898 | if (IS_ERR(up->gpios)) |
899 | return PTR_ERR(up->gpios); | 899 | return PTR_ERR(up->gpios); |
900 | 900 | ||
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 960e50a97558..51c7507b0444 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -1437,7 +1437,7 @@ static void sci_request_dma(struct uart_port *port) | |||
1437 | sg_init_table(sg, 1); | 1437 | sg_init_table(sg, 1); |
1438 | s->rx_buf[i] = buf; | 1438 | s->rx_buf[i] = buf; |
1439 | sg_dma_address(sg) = dma; | 1439 | sg_dma_address(sg) = dma; |
1440 | sg->length = s->buf_len_rx; | 1440 | sg_dma_len(sg) = s->buf_len_rx; |
1441 | 1441 | ||
1442 | buf += s->buf_len_rx; | 1442 | buf += s->buf_len_rx; |
1443 | dma += s->buf_len_rx; | 1443 | dma += s->buf_len_rx; |
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c index 90ca082935f6..3d245cd3d8e6 100644 --- a/drivers/tty/tty_audit.c +++ b/drivers/tty/tty_audit.c | |||
@@ -265,7 +265,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty, | |||
265 | * | 265 | * |
266 | * Audit @data of @size from @tty, if necessary. | 266 | * Audit @data of @size from @tty, if necessary. |
267 | */ | 267 | */ |
268 | void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, | 268 | void tty_audit_add_data(struct tty_struct *tty, const void *data, |
269 | size_t size, unsigned icanon) | 269 | size_t size, unsigned icanon) |
270 | { | 270 | { |
271 | struct tty_audit_buf *buf; | 271 | struct tty_audit_buf *buf; |
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 9a479e61791a..3cd31e0d4bd9 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -450,7 +450,7 @@ receive_buf(struct tty_struct *tty, struct tty_buffer *head, int count) | |||
450 | count = disc->ops->receive_buf2(tty, p, f, count); | 450 | count = disc->ops->receive_buf2(tty, p, f, count); |
451 | else { | 451 | else { |
452 | count = min_t(int, count, tty->receive_room); | 452 | count = min_t(int, count, tty->receive_room); |
453 | if (count) | 453 | if (count && disc->ops->receive_buf) |
454 | disc->ops->receive_buf(tty, p, f, count); | 454 | disc->ops->receive_buf(tty, p, f, count); |
455 | } | 455 | } |
456 | return count; | 456 | return count; |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 0c41dbcb90b8..bcc8e1e8bb72 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -1282,18 +1282,22 @@ int tty_send_xchar(struct tty_struct *tty, char ch) | |||
1282 | int was_stopped = tty->stopped; | 1282 | int was_stopped = tty->stopped; |
1283 | 1283 | ||
1284 | if (tty->ops->send_xchar) { | 1284 | if (tty->ops->send_xchar) { |
1285 | down_read(&tty->termios_rwsem); | ||
1285 | tty->ops->send_xchar(tty, ch); | 1286 | tty->ops->send_xchar(tty, ch); |
1287 | up_read(&tty->termios_rwsem); | ||
1286 | return 0; | 1288 | return 0; |
1287 | } | 1289 | } |
1288 | 1290 | ||
1289 | if (tty_write_lock(tty, 0) < 0) | 1291 | if (tty_write_lock(tty, 0) < 0) |
1290 | return -ERESTARTSYS; | 1292 | return -ERESTARTSYS; |
1291 | 1293 | ||
1294 | down_read(&tty->termios_rwsem); | ||
1292 | if (was_stopped) | 1295 | if (was_stopped) |
1293 | start_tty(tty); | 1296 | start_tty(tty); |
1294 | tty->ops->write(tty, &ch, 1); | 1297 | tty->ops->write(tty, &ch, 1); |
1295 | if (was_stopped) | 1298 | if (was_stopped) |
1296 | stop_tty(tty); | 1299 | stop_tty(tty); |
1300 | up_read(&tty->termios_rwsem); | ||
1297 | tty_write_unlock(tty); | 1301 | tty_write_unlock(tty); |
1298 | return 0; | 1302 | return 0; |
1299 | } | 1303 | } |
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index 9c5aebfe7053..1445dd39aa62 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c | |||
@@ -1147,16 +1147,12 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, | |||
1147 | spin_unlock_irq(&tty->flow_lock); | 1147 | spin_unlock_irq(&tty->flow_lock); |
1148 | break; | 1148 | break; |
1149 | case TCIOFF: | 1149 | case TCIOFF: |
1150 | down_read(&tty->termios_rwsem); | ||
1151 | if (STOP_CHAR(tty) != __DISABLED_CHAR) | 1150 | if (STOP_CHAR(tty) != __DISABLED_CHAR) |
1152 | retval = tty_send_xchar(tty, STOP_CHAR(tty)); | 1151 | retval = tty_send_xchar(tty, STOP_CHAR(tty)); |
1153 | up_read(&tty->termios_rwsem); | ||
1154 | break; | 1152 | break; |
1155 | case TCION: | 1153 | case TCION: |
1156 | down_read(&tty->termios_rwsem); | ||
1157 | if (START_CHAR(tty) != __DISABLED_CHAR) | 1154 | if (START_CHAR(tty) != __DISABLED_CHAR) |
1158 | retval = tty_send_xchar(tty, START_CHAR(tty)); | 1155 | retval = tty_send_xchar(tty, START_CHAR(tty)); |
1159 | up_read(&tty->termios_rwsem); | ||
1160 | break; | 1156 | break; |
1161 | default: | 1157 | default: |
1162 | return -EINVAL; | 1158 | return -EINVAL; |
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 5af8f1874c1a..629e3c865072 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -592,7 +592,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) | |||
592 | 592 | ||
593 | /* Restart the work queue in case no characters kick it off. Safe if | 593 | /* Restart the work queue in case no characters kick it off. Safe if |
594 | already running */ | 594 | already running */ |
595 | schedule_work(&tty->port->buf.work); | 595 | tty_buffer_restart_work(tty->port); |
596 | 596 | ||
597 | tty_unlock(tty); | 597 | tty_unlock(tty); |
598 | return retval; | 598 | return retval; |