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
Unified · Split
| @@ -174,6 +174,11 @@ static inline void _writel(unsigned long l, unsigned long addr) · 173 unmodified lines | ||
| 174 | 174 | #define iowrite16 writew |
| 175 | 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 | 182 | #define mmiowb() |
| 178 | 183 | |
| 179 | 184 | #define flush_write_buffers() do { } while (0) /* M32R_FIXME */ |
| @@ -1108,19 +1108,29 @@ static void eraser(unsigned char c, struct tty_struct *tty) · 1107 unmodified lines | ||
| 1108 | 1108 | * Locking: ctrl_lock |
| 1109 | 1109 | */ |
| 1110 | 1110 | |
| 1111 | −static void isig(int sig, struct tty_struct *tty) | |
| 1111 | +static void __isig(int sig, struct tty_struct *tty) | |
| 1112 | 1112 | { |
| 1113 | − struct n_tty_data *ldata = tty->disc_data; | |
| 1114 | 1113 | struct pid *tty_pgrp = tty_get_pgrp(tty); |
| 1115 | 1114 | if (tty_pgrp) { |
| 1116 | 1115 | kill_pgrp(tty_pgrp, sig, 1); |
| 1117 | 1116 | put_pid(tty_pgrp); |
| 1118 | 1117 | } |
| 1118 | +} | |
| 1119 | 1119 | |
| 1120 | − if (!L_NOFLSH(tty)) { | |
| 1120 | +static 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 | 1129 | up_read(&tty->termios_rwsem); |
| 1122 | 1130 | down_write(&tty->termios_rwsem); |
| 1123 | 1131 | |
| 1132 | + __isig(sig, tty); | |
| 1133 | + | |
| 1124 | 1134 | /* clear echo buffer */ |
| 1125 | 1135 | mutex_lock(&ldata->output_lock); |
| 1126 | 1136 | ldata->echo_head = ldata->echo_tail = 0; |
| @@ -1185,7 +1185,7 @@ config SERIAL_SC16IS7XX_CORE · 1184 unmodified lines | ||
| 1185 | 1185 | config SERIAL_SC16IS7XX |
| 1186 | 1186 | tristate "SC16IS7xx serial support" |
| 1187 | 1187 | select SERIAL_CORE |
| 1188 | − depends on I2C || SPI_MASTER | |
| 1188 | + depends on (SPI_MASTER && !I2C) || I2C | |
| 1189 | 1189 | help |
| 1190 | 1190 | This selects support for SC16IS7xx serial ports. |
| 1191 | 1191 | Supported ICs are SC16IS740, SC16IS741, SC16IS750, SC16IS752, |
| @@ -2310,8 +2310,8 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, · 2309 unmodified lines | ||
| 2310 | 2310 | void __iomem *base; |
| 2311 | 2311 | |
| 2312 | 2312 | base = devm_ioremap_resource(dev, mmiobase); |
| 2313 | − if (!base) | |
| 2314 | − return -ENOMEM; | |
| 2313 | + if (IS_ERR(base)) | |
| 2314 | + return PTR_ERR(base); | |
| 2315 | 2315 | |
| 2316 | 2316 | index = pl011_probe_dt_alias(index, dev); |
| 2317 | 2317 | |
| @@ -950,7 +950,7 @@ static int etraxfs_uart_remove(struct platform_device *pdev) · 949 unmodified lines | ||
| 950 | 950 | |
| 951 | 951 | port = platform_get_drvdata(pdev); |
| 952 | 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 | 955 | return 0; |
| 956 | 956 | } |
| @@ -1121,11 +1121,6 @@ static int imx_startup(struct uart_port *port) · 1120 unmodified lines | ||
| 1121 | 1121 | |
| 1122 | 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 | 1124 | spin_lock_irqsave(&sport->port.lock, flags); |
| 1130 | 1125 | /* Reset fifo's and state machines */ |
| 1131 | 1126 | i = 100; |
| @@ -1143,9 +1138,6 @@ static int imx_startup(struct uart_port *port) · 11 unmodified lines | ||
| 1143 | 1138 | writel(USR1_RTSD, sport->port.membase + USR1); |
| 1144 | 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 | 1141 | temp = readl(sport->port.membase + UCR1); |
| 1150 | 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 | 1308 | } else { |
| 1317 | 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 | 1316 | } else { |
| 1320 | 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 | 1429 | if (UART_ENABLE_MS(&sport->port, termios->c_cflag)) |
| 1433 | 1430 | imx_enable_ms(&sport->port); |
| 1434 | 1431 | |
| 1432 | + if (sport->dma_is_inited && !sport->dma_is_enabled) | |
| 1433 | + imx_enable_dma(sport); | |
| 1435 | 1434 | spin_unlock_irqrestore(&sport->port.lock, flags); |
| 1436 | 1435 | } |
| 1437 | 1436 | |
| @@ -354,6 +354,26 @@ static void sc16is7xx_port_write(struct uart_port *port, u8 reg, u8 val) · 353 unmodified lines | ||
| 354 | 354 | (reg << SC16IS7XX_REG_SHIFT) | port->line, val); |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | +static 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 | + | |
| 367 | +static 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 | + | |
| 357 | 377 | static void sc16is7xx_port_update(struct uart_port *port, u8 reg, |
| 358 | 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 | 528 | s->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG); |
| 509 | 529 | bytes_read = 1; |
| 510 | 530 | } else { |
| 511 | − regcache_cache_bypass(s->regmap, true); | |
| 512 | − regmap_raw_read(s->regmap, SC16IS7XX_RHR_REG, | |
| 513 | − s->buf, rxlen); | |
| 514 | − regcache_cache_bypass(s->regmap, false); | |
| 531 | + sc16is7xx_fifo_read(port, rxlen); | |
| 515 | 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 | 608 | s->buf[i] = xmit->buf[xmit->tail]; |
| 592 | 609 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
| 593 | 610 | } |
| 594 | − regcache_cache_bypass(s->regmap, true); | |
| 595 | − regmap_raw_write(s->regmap, SC16IS7XX_THR_REG, s->buf, to_send); | |
| 596 | − regcache_cache_bypass(s->regmap, false); | |
| 611 | + | |
| 612 | + sc16is7xx_fifo_write(port, to_send); | |
| 597 | 613 | } |
| 598 | 614 | |
| 599 | 615 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
| @@ -1418,7 +1418,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) · 1417 unmodified lines | ||
| 1418 | 1418 | mutex_lock(&port->mutex); |
| 1419 | 1419 | uart_shutdown(tty, state); |
| 1420 | 1420 | tty_port_tty_set(port, NULL); |
| 1421 | − tty->closing = 0; | |
| 1421 | + | |
| 1422 | 1422 | spin_lock_irqsave(&port->lock, flags); |
| 1423 | 1423 | |
| 1424 | 1424 | if (port->blocked_open) { |
| @@ -1444,6 +1444,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) · 19 unmodified lines | ||
| 1444 | 1444 | mutex_unlock(&port->mutex); |
| 1445 | 1445 | |
| 1446 | 1446 | tty_ldisc_flush(tty); |
| 1447 | + tty->closing = 0; | |
| 1447 | 1448 | } |
| 1448 | 1449 | |
| 1449 | 1450 | static void uart_wait_until_sent(struct tty_struct *tty, int timeout) |
| @@ -356,6 +356,7 @@ int paste_selection(struct tty_struct *tty) · 355 unmodified lines | ||
| 356 | 356 | schedule(); |
| 357 | 357 | continue; |
| 358 | 358 | } |
| 359 | + __set_current_state(TASK_RUNNING); | |
| 359 | 360 | count = sel_buffer_lth - pasted; |
| 360 | 361 | count = tty_ldisc_receive_buf(ld, sel_buffer + pasted, NULL, |
| 361 | 362 | count); |
| @@ -742,6 +742,8 @@ static void visual_init(struct vc_data *vc, int num, int init) · 741 unmodified lines | ||
| 742 | 742 | __module_get(vc->vc_sw->owner); |
| 743 | 743 | vc->vc_num = num; |
| 744 | 744 | vc->vc_display_fg = &master_display_fg; |
| 745 | + if (vc->vc_uni_pagedir_loc) | |
| 746 | + con_free_unimap(vc); | |
| 745 | 747 | vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir; |
| 746 | 748 | vc->vc_uni_pagedir = NULL; |
| 747 | 749 | vc->vc_hi_font_mask = 0; |