Skip to content

Commit 82b35f3

Browse files
committed
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
2 parents b0de415 + 61e86cc commit 82b35f3

File tree

10 files changed

+57
-23
lines changed

10 files changed

+57
-23
lines changed

arch/m32r/include/asm/io.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ static inline void _writel(unsigned long l, unsigned long addr)
174174
#define iowrite16 writew
175175
#define iowrite32 writel
176176

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+
177182
#define mmiowb()
178183

179184
#define flush_write_buffers() do { } while (0) /* M32R_FIXME */

drivers/tty/n_tty.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,19 +1108,29 @@ static void eraser(unsigned char c, struct tty_struct *tty)
11081108
* Locking: ctrl_lock
11091109
*/
11101110

1111-
static void isig(int sig, struct tty_struct *tty)
1111+
static void __isig(int sig, struct tty_struct *tty)
11121112
{
1113-
struct n_tty_data *ldata = tty->disc_data;
11141113
struct pid *tty_pgrp = tty_get_pgrp(tty);
11151114
if (tty_pgrp) {
11161115
kill_pgrp(tty_pgrp, sig, 1);
11171116
put_pid(tty_pgrp);
11181117
}
1118+
}
11191119

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 */
11211129
up_read(&tty->termios_rwsem);
11221130
down_write(&tty->termios_rwsem);
11231131

1132+
__isig(sig, tty);
1133+
11241134
/* clear echo buffer */
11251135
mutex_lock(&ldata->output_lock);
11261136
ldata->echo_head = ldata->echo_tail = 0;

drivers/tty/serial/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ config SERIAL_SC16IS7XX_CORE
11851185
config SERIAL_SC16IS7XX
11861186
tristate "SC16IS7xx serial support"
11871187
select SERIAL_CORE
1188-
depends on I2C || SPI_MASTER
1188+
depends on (SPI_MASTER && !I2C) || I2C
11891189
help
11901190
This selects support for SC16IS7xx serial ports.
11911191
Supported ICs are SC16IS740, SC16IS741, SC16IS750, SC16IS752,

drivers/tty/serial/amba-pl011.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,8 +2310,8 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
23102310
void __iomem *base;
23112311

23122312
base = devm_ioremap_resource(dev, mmiobase);
2313-
if (!base)
2314-
return -ENOMEM;
2313+
if (IS_ERR(base))
2314+
return PTR_ERR(base);
23152315

23162316
index = pl011_probe_dt_alias(index, dev);
23172317

drivers/tty/serial/etraxfs-uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ static int etraxfs_uart_remove(struct platform_device *pdev)
950950

951951
port = platform_get_drvdata(pdev);
952952
uart_remove_one_port(&etraxfs_uart_driver, port);
953-
etraxfs_uart_ports[pdev->id] = NULL;
953+
etraxfs_uart_ports[port->line] = NULL;
954954

955955
return 0;
956956
}

drivers/tty/serial/imx.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,11 +1121,6 @@ static int imx_startup(struct uart_port *port)
11211121

11221122
writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
11231123

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-
11291124
spin_lock_irqsave(&sport->port.lock, flags);
11301125
/* Reset fifo's and state machines */
11311126
i = 100;
@@ -1143,9 +1138,6 @@ static int imx_startup(struct uart_port *port)
11431138
writel(USR1_RTSD, sport->port.membase + USR1);
11441139
writel(USR2_ORE, sport->port.membase + USR2);
11451140

1146-
if (sport->dma_is_inited && !sport->dma_is_enabled)
1147-
imx_enable_dma(sport);
1148-
11491141
temp = readl(sport->port.membase + UCR1);
11501142
temp |= UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN;
11511143

@@ -1316,6 +1308,11 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
13161308
} else {
13171309
ucr2 |= UCR2_CTSC;
13181310
}
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);
13191316
} else {
13201317
termios->c_cflag &= ~CRTSCTS;
13211318
}
@@ -1432,6 +1429,8 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
14321429
if (UART_ENABLE_MS(&sport->port, termios->c_cflag))
14331430
imx_enable_ms(&sport->port);
14341431

1432+
if (sport->dma_is_inited && !sport->dma_is_enabled)
1433+
imx_enable_dma(sport);
14351434
spin_unlock_irqrestore(&sport->port.lock, flags);
14361435
}
14371436

drivers/tty/serial/sc16is7xx.c

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,26 @@ static void sc16is7xx_port_write(struct uart_port *port, u8 reg, u8 val)
354354
(reg << SC16IS7XX_REG_SHIFT) | port->line, val);
355355
}
356356

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+
357377
static void sc16is7xx_port_update(struct uart_port *port, u8 reg,
358378
u8 mask, u8 val)
359379
{
@@ -508,10 +528,7 @@ static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen,
508528
s->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG);
509529
bytes_read = 1;
510530
} 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);
515532
bytes_read = rxlen;
516533
}
517534

@@ -591,9 +608,8 @@ static void sc16is7xx_handle_tx(struct uart_port *port)
591608
s->buf[i] = xmit->buf[xmit->tail];
592609
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
593610
}
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);
597613
}
598614

599615
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)

drivers/tty/serial/serial_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
14181418
mutex_lock(&port->mutex);
14191419
uart_shutdown(tty, state);
14201420
tty_port_tty_set(port, NULL);
1421-
tty->closing = 0;
1421+
14221422
spin_lock_irqsave(&port->lock, flags);
14231423

14241424
if (port->blocked_open) {
@@ -1444,6 +1444,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
14441444
mutex_unlock(&port->mutex);
14451445

14461446
tty_ldisc_flush(tty);
1447+
tty->closing = 0;
14471448
}
14481449

14491450
static void uart_wait_until_sent(struct tty_struct *tty, int timeout)

drivers/tty/vt/selection.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ int paste_selection(struct tty_struct *tty)
356356
schedule();
357357
continue;
358358
}
359+
__set_current_state(TASK_RUNNING);
359360
count = sel_buffer_lth - pasted;
360361
count = tty_ldisc_receive_buf(ld, sel_buffer + pasted, NULL,
361362
count);

drivers/tty/vt/vt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static void visual_init(struct vc_data *vc, int num, int init)
742742
__module_get(vc->vc_sw->owner);
743743
vc->vc_num = num;
744744
vc->vc_display_fg = &master_display_fg;
745+
if (vc->vc_uni_pagedir_loc)
746+
con_free_unimap(vc);
745747
vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir;
746748
vc->vc_uni_pagedir = NULL;
747749
vc->vc_hi_font_mask = 0;

0 commit comments

Comments
 (0)