Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull tty/serial fixes from Greg KH:
"Here are some tty/serial driver fixes for 4.4-rc6 that resolve some
reported problems. All of these have been in linux-next. The details
are in the shortlog"

* tag 'tty-4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
tty: Fix GPF in flush_to_ldisc()
serial: earlycon: Add missing spinlock initialization
serial: sh-sci: Fix length of scatterlist
n_tty: Fix poll() after buffer-limited eof push read
serial: 8250_uniphier: fix dl_read and dl_write functions

+19 -17
+9 -13
drivers/tty/n_tty.c
··· 2054 2054 size_t eol; 2055 2055 size_t tail; 2056 2056 int ret, found = 0; 2057 - bool eof_push = 0; 2058 2057 2059 2058 /* N.B. avoid overrun if nr == 0 */ 2060 - n = min(*nr, smp_load_acquire(&ldata->canon_head) - ldata->read_tail); 2061 - if (!n) 2059 + if (!*nr) 2062 2060 return 0; 2061 + 2062 + n = min(*nr + 1, smp_load_acquire(&ldata->canon_head) - ldata->read_tail); 2063 2063 2064 2064 tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); 2065 2065 size = min_t(size_t, tail + n, N_TTY_BUF_SIZE); ··· 2081 2081 n = eol - tail; 2082 2082 if (n > N_TTY_BUF_SIZE) 2083 2083 n += N_TTY_BUF_SIZE; 2084 - n += found; 2085 - c = n; 2084 + c = n + found; 2086 2085 2087 - if (found && !ldata->push && read_buf(ldata, eol) == __DISABLED_CHAR) { 2088 - n--; 2089 - eof_push = !n && ldata->read_tail != ldata->line_start; 2086 + if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) { 2087 + c = min(*nr, c); 2088 + n = c; 2090 2089 } 2091 2090 2092 2091 n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu size:%zu more:%zu\n", ··· 2115 2116 ldata->push = 0; 2116 2117 tty_audit_push(tty); 2117 2118 } 2118 - return eof_push ? -EAGAIN : 0; 2119 + return 0; 2119 2120 } 2120 2121 2121 2122 extern ssize_t redirected_tty_write(struct file *, const char __user *, ··· 2272 2273 2273 2274 if (ldata->icanon && !L_EXTPROC(tty)) { 2274 2275 retval = canon_copy_from_read_buf(tty, &b, &nr); 2275 - if (retval == -EAGAIN) { 2276 - retval = 0; 2277 - continue; 2278 - } else if (retval) 2276 + if (retval) 2279 2277 break; 2280 2278 } else { 2281 2279 int uncopied;
+6 -2
drivers/tty/serial/8250/8250_uniphier.c
··· 115 115 */ 116 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 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 130 static int uniphier_of_serial_setup(struct device *dev, struct uart_port *port,
+2
drivers/tty/serial/earlycon.c
··· 115 115 if (buf && !parse_options(&early_console_dev, buf)) 116 116 buf = NULL; 117 117 118 + spin_lock_init(&port->lock); 118 119 port->uartclk = BASE_BAUD * 16; 119 120 if (port->mapbase) 120 121 port->membase = earlycon_map(port->mapbase, 64); ··· 203 202 int err; 204 203 struct uart_port *port = &early_console_dev.port; 205 204 205 + spin_lock_init(&port->lock); 206 206 port->iotype = UPIO_MEM; 207 207 port->mapbase = addr; 208 208 port->uartclk = BASE_BAUD * 16;
+1 -1
drivers/tty/serial/sh-sci.c
··· 1437 1437 sg_init_table(sg, 1); 1438 1438 s->rx_buf[i] = buf; 1439 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 1442 buf += s->buf_len_rx; 1443 1443 dma += s->buf_len_rx;
+1 -1
drivers/tty/tty_buffer.c
··· 450 450 count = disc->ops->receive_buf2(tty, p, f, count); 451 451 else { 452 452 count = min_t(int, count, tty->receive_room); 453 - if (count) 453 + if (count && disc->ops->receive_buf) 454 454 disc->ops->receive_buf(tty, p, f, count); 455 455 } 456 456 return count;