aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-12-21 14:06:07 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-12-21 14:06:07 -0500
commit462a1196a578fc6f52c26427070a75e044bbf9b1 (patch)
treeb24eca93de7e557d35b2da873efb2603ef79ce03 /drivers/tty
parent58362d5be35216f196b4a4d16aa2c6ef938087f0 (diff)
parent4ef7675344d687a0ef5b0d7c0cee12da005870c0 (diff)
Merge 4.4-rc6 into tty-next
We want the serial/tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/n_tty.c22
-rw-r--r--drivers/tty/serial/8250/8250_uniphier.c8
-rw-r--r--drivers/tty/serial/earlycon.c2
-rw-r--r--drivers/tty/serial/sh-sci.c2
-rw-r--r--drivers/tty/tty_buffer.c2
5 files changed, 19 insertions, 17 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index f2f64252814f..d9a5fc28fef4 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2062,13 +2062,13 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
2062 size_t eol; 2062 size_t eol;
2063 size_t tail; 2063 size_t tail;
2064 int ret, found = 0; 2064 int ret, found = 0;
2065 bool eof_push = 0;
2066 2065
2067 /* N.B. avoid overrun if nr == 0 */ 2066 /* N.B. avoid overrun if nr == 0 */
2068 n = min(*nr, smp_load_acquire(&ldata->canon_head) - ldata->read_tail); 2067 if (!*nr)
2069 if (!n)
2070 return 0; 2068 return 0;
2071 2069
2070 n = min(*nr + 1, smp_load_acquire(&ldata->canon_head) - ldata->read_tail);
2071
2072 tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); 2072 tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1);
2073 size = min_t(size_t, tail + n, N_TTY_BUF_SIZE); 2073 size = min_t(size_t, tail + n, N_TTY_BUF_SIZE);
2074 2074
@@ -2087,12 +2087,11 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
2087 n = eol - tail; 2087 n = eol - tail;
2088 if (n > N_TTY_BUF_SIZE) 2088 if (n > N_TTY_BUF_SIZE)
2089 n += N_TTY_BUF_SIZE; 2089 n += N_TTY_BUF_SIZE;
2090 n += found; 2090 c = n + found;
2091 c = n;
2092 2091
2093 if (found && !ldata->push && read_buf(ldata, eol) == __DISABLED_CHAR) { 2092 if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) {
2094 n--; 2093 c = min(*nr, c);
2095 eof_push = !n && ldata->read_tail != ldata->line_start; 2094 n = c;
2096 } 2095 }
2097 2096
2098 n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu tail:%zu more:%zu\n", 2097 n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu tail:%zu more:%zu\n",
@@ -2115,7 +2114,7 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
2115 ldata->push = 0; 2114 ldata->push = 0;
2116 tty_audit_push(tty); 2115 tty_audit_push(tty);
2117 } 2116 }
2118 return eof_push ? -EAGAIN : 0; 2117 return 0;
2119} 2118}
2120 2119
2121extern ssize_t redirected_tty_write(struct file *, const char __user *, 2120extern ssize_t redirected_tty_write(struct file *, const char __user *,
@@ -2272,10 +2271,7 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
2272 2271
2273 if (ldata->icanon && !L_EXTPROC(tty)) { 2272 if (ldata->icanon && !L_EXTPROC(tty)) {
2274 retval = canon_copy_from_read_buf(tty, &b, &nr); 2273 retval = canon_copy_from_read_buf(tty, &b, &nr);
2275 if (retval == -EAGAIN) { 2274 if (retval)
2276 retval = 0;
2277 continue;
2278 } else if (retval)
2279 break; 2275 break;
2280 } else { 2276 } else {
2281 int uncopied; 2277 int uncopied;
diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c
index 1e2237a9c489..bab6b3ae2540 100644
--- a/drivers/tty/serial/8250/8250_uniphier.c
+++ b/drivers/tty/serial/8250/8250_uniphier.c
@@ -139,12 +139,16 @@ static void uniphier_serial_out(struct uart_port *p, int offset, int value)
139 */ 139 */
140static int uniphier_serial_dl_read(struct uart_8250_port *up) 140static int uniphier_serial_dl_read(struct uart_8250_port *up)
141{ 141{
142 return readl(up->port.membase + UNIPHIER_UART_DLR); 142 int offset = UNIPHIER_UART_DLR << up->port.regshift;
143
144 return readl(up->port.membase + offset);
143} 145}
144 146
145static void uniphier_serial_dl_write(struct uart_8250_port *up, int value) 147static void uniphier_serial_dl_write(struct uart_8250_port *up, int value)
146{ 148{
147 writel(value, up->port.membase + UNIPHIER_UART_DLR); 149 int offset = UNIPHIER_UART_DLR << up->port.regshift;
150
151 writel(value, up->port.membase + offset);
148} 152}
149 153
150static int uniphier_of_serial_setup(struct device *dev, struct uart_port *port, 154static int uniphier_of_serial_setup(struct device *dev, struct uart_port *port,
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 07f7393210db..3f2423690d01 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -122,6 +122,7 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match)
122 if (buf && !parse_options(&early_console_dev, buf)) 122 if (buf && !parse_options(&early_console_dev, buf))
123 buf = NULL; 123 buf = NULL;
124 124
125 spin_lock_init(&port->lock);
125 port->uartclk = BASE_BAUD * 16; 126 port->uartclk = BASE_BAUD * 16;
126 if (port->mapbase) 127 if (port->mapbase)
127 port->membase = earlycon_map(port->mapbase, 64); 128 port->membase = earlycon_map(port->mapbase, 64);
@@ -209,6 +210,7 @@ int __init of_setup_earlycon(unsigned long addr,
209 int err; 210 int err;
210 struct uart_port *port = &early_console_dev.port; 211 struct uart_port *port = &early_console_dev.port;
211 212
213 spin_lock_init(&port->lock);
212 port->iotype = UPIO_MEM; 214 port->iotype = UPIO_MEM;
213 port->mapbase = addr; 215 port->mapbase = addr;
214 port->uartclk = BASE_BAUD * 16; 216 port->uartclk = BASE_BAUD * 16;
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_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;