History

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

Linus Torvalds committed 11 years ago

Commit 82b35f32 parents b0de415 61e86cc10 files · +57 −23Browse files

Unified · Split

10 files
  1. arch/m32r/include/asm/io.h +5 −0
  2. drivers/tty/n_tty.c +13 −3
  3. drivers/tty/serial/Kconfig +1 −1
  4. drivers/tty/serial/amba-pl011.c +2 −2
  5. drivers/tty/serial/etraxfs-uart.c +1 −1
  6. drivers/tty/serial/imx.c +7 −8
  7. drivers/tty/serial/sc16is7xx.c +23 −7
  8. drivers/tty/serial/serial_core.c +2 −1
  9. drivers/tty/vt/selection.c +1 −0
  10. drivers/tty/vt/vt.c +2 −0
arch/m32r/include/asm/io.h+5−0
@@ -174,6 +174,11 @@ static inline void _writel(unsigned long l, unsigned long addr) · 173 unmodified lines
174#define iowrite16 writew174#define iowrite16 writew
175#define iowrite32 writel175#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 */
drivers/tty/n_tty.c+13−3
@@ -1108,19 +1108,29 @@ static void eraser(unsigned char c, struct tty_struct *tty) · 1107 unmodified lines
1108 * Locking: ctrl_lock1108 * 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;
drivers/tty/serial/Kconfig+1−1
@@ -1185,7 +1185,7 @@ config SERIAL_SC16IS7XX_CORE · 1184 unmodified lines
1185config SERIAL_SC16IS7XX1185config SERIAL_SC16IS7XX
1186 tristate "SC16IS7xx serial support"1186 tristate "SC16IS7xx serial support"
1187 select SERIAL_CORE1187 select SERIAL_CORE
1188 depends on I2C || SPI_MASTER1188 depends on (SPI_MASTER && !I2C) || I2C
1189 help1189 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,
drivers/tty/serial/amba-pl011.c+2−2
@@ -2310,8 +2310,8 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, · 2309 unmodified lines
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
drivers/tty/serial/etraxfs-uart.c+1−1
@@ -950,7 +950,7 @@ static int etraxfs_uart_remove(struct platform_device *pdev) · 949 unmodified lines
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}
drivers/tty/serial/imx.c+7−8
@@ -1121,11 +1121,6 @@ static int imx_startup(struct uart_port *port) · 1120 unmodified lines
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) · 11 unmodified lines
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, · 164 unmodified lines
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, · 110 unmodified lines
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
drivers/tty/serial/sc16is7xx.c+23−7
@@ -354,6 +354,26 @@ static void sc16is7xx_port_write(struct uart_port *port, u8 reg, u8 val) · 353 unmodified lines
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, · 148 unmodified lines
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) · 73 unmodified lines
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)
drivers/tty/serial/serial_core.c+2−1
@@ -1418,7 +1418,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) · 1417 unmodified lines
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) · 19 unmodified lines
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)
drivers/tty/vt/selection.c+1−0
@@ -356,6 +356,7 @@ int paste_selection(struct tty_struct *tty) · 355 unmodified lines
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);
drivers/tty/vt/vt.c+2−0
@@ -742,6 +742,8 @@ static void visual_init(struct vc_data *vc, int num, int init) · 741 unmodified lines
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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t