aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-07-25 23:05:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-25 23:05:07 -0400
commit82b35f376c71fbd60f5ea0ce27b3c835fa50ed6d (patch)
tree903ad77762684699b9135d6b82ef959951d95806
parentb0de415aa7469606ddf618caf3e2fdc94fa28733 (diff)
parent61e86cc90af49cecef9c54ccea1f572fbcb695ac (diff)
Merge tag 'tty-4.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial driver fixes from Greg KH: "Here are a number of small serial and tty fixes for reported issues. All have been in linux-next successfully" * tag 'tty-4.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: tty: vt: Fix !TASK_RUNNING diagnostic warning from paste_selection() serial: core: Fix crashes while echoing when closing m32r: Add ioreadXX/iowriteXX big-endian mmio accessors Revert "serial: imx: initialized DMA w/o HW flow enabled" sc16is7xx: fix FIFO address of secondary UART sc16is7xx: fix Kconfig dependencies serial: etraxfs-uart: Fix release etraxfs_uart_ports tty/vt: Fix the memory leak in visual_init serial: amba-pl011: Fix devm_ioremap_resource return value check n_tty: signal and flush atomically
-rw-r--r--arch/m32r/include/asm/io.h5
-rw-r--r--drivers/tty/n_tty.c16
-rw-r--r--drivers/tty/serial/Kconfig2
-rw-r--r--drivers/tty/serial/amba-pl011.c4
-rw-r--r--drivers/tty/serial/etraxfs-uart.c2
-rw-r--r--drivers/tty/serial/imx.c15
-rw-r--r--drivers/tty/serial/sc16is7xx.c30
-rw-r--r--drivers/tty/serial/serial_core.c3
-rw-r--r--drivers/tty/vt/selection.c1
-rw-r--r--drivers/tty/vt/vt.c2
10 files changed, 57 insertions, 23 deletions
diff --git a/arch/m32r/include/asm/io.h b/arch/m32r/include/asm/io.h
index 0c3f25ee3381..f8de767ce2bc 100644
--- a/arch/m32r/include/asm/io.h
+++ b/arch/m32r/include/asm/io.h
@@ -174,6 +174,11 @@ static inline void _writel(unsigned long l, unsigned long addr)
174#define iowrite16 writew 174#define iowrite16 writew
175#define iowrite32 writel 175#define iowrite32 writel
176 176
177#define ioread16be(addr) be16_to_cpu(readw(addr))
178#define ioread32be(addr) be32_to_cpu(readl(addr))
179#define iowrite16be(v, addr) writew(cpu_to_be16(v), (addr))
180#define iowrite32be(v, addr) writel(cpu_to_be32(v), (addr))
181
177#define mmiowb() 182#define mmiowb()
178 183
179#define flush_write_buffers() do { } while (0) /* M32R_FIXME */ 184#define flush_write_buffers() do { } while (0) /* M32R_FIXME */
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index c9c27f69e101..ee8bfacf2071 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1108,19 +1108,29 @@ static void eraser(unsigned char c, struct tty_struct *tty)
1108 * Locking: ctrl_lock 1108 * Locking: ctrl_lock
1109 */ 1109 */
1110 1110
1111static void isig(int sig, struct tty_struct *tty) 1111static void __isig(int sig, struct tty_struct *tty)
1112{ 1112{
1113 struct n_tty_data *ldata = tty->disc_data;
1114 struct pid *tty_pgrp = tty_get_pgrp(tty); 1113 struct pid *tty_pgrp = tty_get_pgrp(tty);
1115 if (tty_pgrp) { 1114 if (tty_pgrp) {
1116 kill_pgrp(tty_pgrp, sig, 1); 1115 kill_pgrp(tty_pgrp, sig, 1);
1117 put_pid(tty_pgrp); 1116 put_pid(tty_pgrp);
1118 } 1117 }
1118}
1119 1119
1120 if (!L_NOFLSH(tty)) { 1120static void isig(int sig, struct tty_struct *tty)
1121{
1122 struct n_tty_data *ldata = tty->disc_data;
1123
1124 if (L_NOFLSH(tty)) {
1125 /* signal only */
1126 __isig(sig, tty);
1127
1128 } else { /* signal and flush */
1121 up_read(&tty->termios_rwsem); 1129 up_read(&tty->termios_rwsem);
1122 down_write(&tty->termios_rwsem); 1130 down_write(&tty->termios_rwsem);
1123 1131
1132 __isig(sig, tty);
1133
1124 /* clear echo buffer */ 1134 /* clear echo buffer */
1125 mutex_lock(&ldata->output_lock); 1135 mutex_lock(&ldata->output_lock);
1126 ldata->echo_head = ldata->echo_tail = 0; 1136 ldata->echo_head = ldata->echo_tail = 0;
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 76e65b714471..15b4079a335e 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1185,7 +1185,7 @@ config SERIAL_SC16IS7XX_CORE
1185config SERIAL_SC16IS7XX 1185config SERIAL_SC16IS7XX
1186 tristate "SC16IS7xx serial support" 1186 tristate "SC16IS7xx serial support"
1187 select SERIAL_CORE 1187 select SERIAL_CORE
1188 depends on I2C || SPI_MASTER 1188 depends on (SPI_MASTER && !I2C) || I2C
1189 help 1189 help
1190 This selects support for SC16IS7xx serial ports. 1190 This selects support for SC16IS7xx serial ports.
1191 Supported ICs are SC16IS740, SC16IS741, SC16IS750, SC16IS752, 1191 Supported ICs are SC16IS740, SC16IS741, SC16IS750, SC16IS752,
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 50cf5b10ceed..fd27e986b1dd 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2310,8 +2310,8 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
2310 void __iomem *base; 2310 void __iomem *base;
2311 2311
2312 base = devm_ioremap_resource(dev, mmiobase); 2312 base = devm_ioremap_resource(dev, mmiobase);
2313 if (!base) 2313 if (IS_ERR(base))
2314 return -ENOMEM; 2314 return PTR_ERR(base);
2315 2315
2316 index = pl011_probe_dt_alias(index, dev); 2316 index = pl011_probe_dt_alias(index, dev);
2317 2317
diff --git a/drivers/tty/serial/etraxfs-uart.c b/drivers/tty/serial/etraxfs-uart.c
index a57301a6fe42..679709f51fd4 100644
--- a/drivers/tty/serial/etraxfs-uart.c
+++ b/drivers/tty/serial/etraxfs-uart.c
@@ -950,7 +950,7 @@ static int etraxfs_uart_remove(struct platform_device *pdev)
950 950
951 port = platform_get_drvdata(pdev); 951 port = platform_get_drvdata(pdev);
952 uart_remove_one_port(&etraxfs_uart_driver, port); 952 uart_remove_one_port(&etraxfs_uart_driver, port);
953 etraxfs_uart_ports[pdev->id] = NULL; 953 etraxfs_uart_ports[port->line] = NULL;
954 954
955 return 0; 955 return 0;
956} 956}
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 2c90dc31bfaa..54fdc7866ea1 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1121,11 +1121,6 @@ static int imx_startup(struct uart_port *port)
1121 1121
1122 writel(temp & ~UCR4_DREN, sport->port.membase + UCR4); 1122 writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
1123 1123
1124 /* Can we enable the DMA support? */
1125 if (is_imx6q_uart(sport) && !uart_console(port) &&
1126 !sport->dma_is_inited)
1127 imx_uart_dma_init(sport);
1128
1129 spin_lock_irqsave(&sport->port.lock, flags); 1124 spin_lock_irqsave(&sport->port.lock, flags);
1130 /* Reset fifo's and state machines */ 1125 /* Reset fifo's and state machines */
1131 i = 100; 1126 i = 100;
@@ -1143,9 +1138,6 @@ static int imx_startup(struct uart_port *port)
1143 writel(USR1_RTSD, sport->port.membase + USR1); 1138 writel(USR1_RTSD, sport->port.membase + USR1);
1144 writel(USR2_ORE, sport->port.membase + USR2); 1139 writel(USR2_ORE, sport->port.membase + USR2);
1145 1140
1146 if (sport->dma_is_inited && !sport->dma_is_enabled)
1147 imx_enable_dma(sport);
1148
1149 temp = readl(sport->port.membase + UCR1); 1141 temp = readl(sport->port.membase + UCR1);
1150 temp |= UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN; 1142 temp |= UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN;
1151 1143
@@ -1316,6 +1308,11 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
1316 } else { 1308 } else {
1317 ucr2 |= UCR2_CTSC; 1309 ucr2 |= UCR2_CTSC;
1318 } 1310 }
1311
1312 /* Can we enable the DMA support? */
1313 if (is_imx6q_uart(sport) && !uart_console(port)
1314 && !sport->dma_is_inited)
1315 imx_uart_dma_init(sport);
1319 } else { 1316 } else {
1320 termios->c_cflag &= ~CRTSCTS; 1317 termios->c_cflag &= ~CRTSCTS;
1321 } 1318 }
@@ -1432,6 +1429,8 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
1432 if (UART_ENABLE_MS(&sport->port, termios->c_cflag)) 1429 if (UART_ENABLE_MS(&sport->port, termios->c_cflag))
1433 imx_enable_ms(&sport->port); 1430 imx_enable_ms(&sport->port);
1434 1431
1432 if (sport->dma_is_inited && !sport->dma_is_enabled)
1433 imx_enable_dma(sport);
1435 spin_unlock_irqrestore(&sport->port.lock, flags); 1434 spin_unlock_irqrestore(&sport->port.lock, flags);
1436} 1435}
1437 1436
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 9e6576004a42..5ccc698cbbfa 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -354,6 +354,26 @@ static void sc16is7xx_port_write(struct uart_port *port, u8 reg, u8 val)
354 (reg << SC16IS7XX_REG_SHIFT) | port->line, val); 354 (reg << SC16IS7XX_REG_SHIFT) | port->line, val);
355} 355}
356 356
357static void sc16is7xx_fifo_read(struct uart_port *port, unsigned int rxlen)
358{
359 struct sc16is7xx_port *s = dev_get_drvdata(port->dev);
360 u8 addr = (SC16IS7XX_RHR_REG << SC16IS7XX_REG_SHIFT) | port->line;
361
362 regcache_cache_bypass(s->regmap, true);
363 regmap_raw_read(s->regmap, addr, s->buf, rxlen);
364 regcache_cache_bypass(s->regmap, false);
365}
366
367static void sc16is7xx_fifo_write(struct uart_port *port, u8 to_send)
368{
369 struct sc16is7xx_port *s = dev_get_drvdata(port->dev);
370 u8 addr = (SC16IS7XX_THR_REG << SC16IS7XX_REG_SHIFT) | port->line;
371
372 regcache_cache_bypass(s->regmap, true);
373 regmap_raw_write(s->regmap, addr, s->buf, to_send);
374 regcache_cache_bypass(s->regmap, false);
375}
376
357static void sc16is7xx_port_update(struct uart_port *port, u8 reg, 377static void sc16is7xx_port_update(struct uart_port *port, u8 reg,
358 u8 mask, u8 val) 378 u8 mask, u8 val)
359{ 379{
@@ -508,10 +528,7 @@ static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen,
508 s->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG); 528 s->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG);
509 bytes_read = 1; 529 bytes_read = 1;
510 } else { 530 } else {
511 regcache_cache_bypass(s->regmap, true); 531 sc16is7xx_fifo_read(port, rxlen);
512 regmap_raw_read(s->regmap, SC16IS7XX_RHR_REG,
513 s->buf, rxlen);
514 regcache_cache_bypass(s->regmap, false);
515 bytes_read = rxlen; 532 bytes_read = rxlen;
516 } 533 }
517 534
@@ -591,9 +608,8 @@ static void sc16is7xx_handle_tx(struct uart_port *port)
591 s->buf[i] = xmit->buf[xmit->tail]; 608 s->buf[i] = xmit->buf[xmit->tail];
592 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); 609 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
593 } 610 }
594 regcache_cache_bypass(s->regmap, true); 611
595 regmap_raw_write(s->regmap, SC16IS7XX_THR_REG, s->buf, to_send); 612 sc16is7xx_fifo_write(port, to_send);
596 regcache_cache_bypass(s->regmap, false);
597 } 613 }
598 614
599 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 615 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 7ae1592f7ec9..f36852067f20 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1418,7 +1418,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1418 mutex_lock(&port->mutex); 1418 mutex_lock(&port->mutex);
1419 uart_shutdown(tty, state); 1419 uart_shutdown(tty, state);
1420 tty_port_tty_set(port, NULL); 1420 tty_port_tty_set(port, NULL);
1421 tty->closing = 0; 1421
1422 spin_lock_irqsave(&port->lock, flags); 1422 spin_lock_irqsave(&port->lock, flags);
1423 1423
1424 if (port->blocked_open) { 1424 if (port->blocked_open) {
@@ -1444,6 +1444,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1444 mutex_unlock(&port->mutex); 1444 mutex_unlock(&port->mutex);
1445 1445
1446 tty_ldisc_flush(tty); 1446 tty_ldisc_flush(tty);
1447 tty->closing = 0;
1447} 1448}
1448 1449
1449static void uart_wait_until_sent(struct tty_struct *tty, int timeout) 1450static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index ea27804d87af..381a2b13682c 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -356,6 +356,7 @@ int paste_selection(struct tty_struct *tty)
356 schedule(); 356 schedule();
357 continue; 357 continue;
358 } 358 }
359 __set_current_state(TASK_RUNNING);
359 count = sel_buffer_lth - pasted; 360 count = sel_buffer_lth - pasted;
360 count = tty_ldisc_receive_buf(ld, sel_buffer + pasted, NULL, 361 count = tty_ldisc_receive_buf(ld, sel_buffer + pasted, NULL,
361 count); 362 count);
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 8fe52989b380..4462d167900c 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -742,6 +742,8 @@ static void visual_init(struct vc_data *vc, int num, int init)
742 __module_get(vc->vc_sw->owner); 742 __module_get(vc->vc_sw->owner);
743 vc->vc_num = num; 743 vc->vc_num = num;
744 vc->vc_display_fg = &master_display_fg; 744 vc->vc_display_fg = &master_display_fg;
745 if (vc->vc_uni_pagedir_loc)
746 con_free_unimap(vc);
745 vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir; 747 vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir;
746 vc->vc_uni_pagedir = NULL; 748 vc->vc_uni_pagedir = NULL;
747 vc->vc_hi_font_mask = 0; 749 vc->vc_hi_font_mask = 0;