Skip to content

Commit e255aee

Browse files
committed
Merge tag 'tty-4.20-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial fixes from Greg KH: "Here are some small tty fixes for 4.20-rc2 One of these missed the original 4.19-final release, I missed that I hadn't done a pull request for it as it was in linux-next and my branch for a long time, that's my fault. The others are small, fixing some reported issues and finally fixing the termios mess for alpha so that glibc has a chance to implement some missing functionality that has been pending for many years now. All of these have been in linux-next with no reported issues" * tag 'tty-4.20-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: serial: sh-sci: Fix could not remove dev_attr_rx_fifo_timeout arch/alpha, termios: implement BOTHER, IBSHIFT and termios2 termios, tty/tty_baudrate.c: fix buffer overrun vt: fix broken display when running aptitude serial: sh-sci: Fix receive on SCIFA/SCIFB variants with DMA
2 parents 20ef6d0 + 641a41d commit e255aee

File tree

6 files changed

+36
-8
lines changed

6 files changed

+36
-8
lines changed

arch/alpha/include/asm/termios.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,15 @@
7373
})
7474

7575
#define user_termios_to_kernel_termios(k, u) \
76-
copy_from_user(k, u, sizeof(struct termios))
76+
copy_from_user(k, u, sizeof(struct termios2))
7777

7878
#define kernel_termios_to_user_termios(u, k) \
79+
copy_to_user(u, k, sizeof(struct termios2))
80+
81+
#define user_termios_to_kernel_termios_1(k, u) \
82+
copy_from_user(k, u, sizeof(struct termios))
83+
84+
#define kernel_termios_to_user_termios_1(u, k) \
7985
copy_to_user(u, k, sizeof(struct termios))
8086

8187
#endif /* _ALPHA_TERMIOS_H */

arch/alpha/include/uapi/asm/ioctls.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
#define TCXONC _IO('t', 30)
3333
#define TCFLSH _IO('t', 31)
3434

35+
#define TCGETS2 _IOR('T', 42, struct termios2)
36+
#define TCSETS2 _IOW('T', 43, struct termios2)
37+
#define TCSETSW2 _IOW('T', 44, struct termios2)
38+
#define TCSETSF2 _IOW('T', 45, struct termios2)
39+
3540
#define TIOCSWINSZ _IOW('t', 103, struct winsize)
3641
#define TIOCGWINSZ _IOR('t', 104, struct winsize)
3742
#define TIOCSTART _IO('t', 110) /* start output, like ^Q */

arch/alpha/include/uapi/asm/termbits.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ struct termios {
2626
speed_t c_ospeed; /* output speed */
2727
};
2828

29+
/* Alpha has identical termios and termios2 */
30+
31+
struct termios2 {
32+
tcflag_t c_iflag; /* input mode flags */
33+
tcflag_t c_oflag; /* output mode flags */
34+
tcflag_t c_cflag; /* control mode flags */
35+
tcflag_t c_lflag; /* local mode flags */
36+
cc_t c_cc[NCCS]; /* control characters */
37+
cc_t c_line; /* line discipline (== c_cc[19]) */
38+
speed_t c_ispeed; /* input speed */
39+
speed_t c_ospeed; /* output speed */
40+
};
41+
2942
/* Alpha has matching termios and ktermios */
3043

3144
struct ktermios {
@@ -152,6 +165,7 @@ struct ktermios {
152165
#define B3000000 00034
153166
#define B3500000 00035
154167
#define B4000000 00036
168+
#define BOTHER 00037
155169

156170
#define CSIZE 00001400
157171
#define CS5 00000000
@@ -169,6 +183,9 @@ struct ktermios {
169183
#define CMSPAR 010000000000 /* mark or space (stick) parity */
170184
#define CRTSCTS 020000000000 /* flow control */
171185

186+
#define CIBAUD 07600000
187+
#define IBSHIFT 16
188+
172189
/* c_lflag bits */
173190
#define ISIG 0x00000080
174191
#define ICANON 0x00000100

drivers/tty/serial/sh-sci.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,10 +1614,10 @@ static void sci_request_dma(struct uart_port *port)
16141614
hrtimer_init(&s->rx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
16151615
s->rx_timer.function = rx_timer_fn;
16161616

1617+
s->chan_rx_saved = s->chan_rx = chan;
1618+
16171619
if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
16181620
sci_submit_rx(s);
1619-
1620-
s->chan_rx_saved = s->chan_rx = chan;
16211621
}
16221622
}
16231623

@@ -3102,6 +3102,7 @@ static struct uart_driver sci_uart_driver = {
31023102
static int sci_remove(struct platform_device *dev)
31033103
{
31043104
struct sci_port *port = platform_get_drvdata(dev);
3105+
unsigned int type = port->port.type; /* uart_remove_... clears it */
31053106

31063107
sci_ports_in_use &= ~BIT(port->port.line);
31073108
uart_remove_one_port(&sci_uart_driver, &port->port);
@@ -3112,8 +3113,7 @@ static int sci_remove(struct platform_device *dev)
31123113
sysfs_remove_file(&dev->dev.kobj,
31133114
&dev_attr_rx_fifo_trigger.attr);
31143115
}
3115-
if (port->port.type == PORT_SCIFA || port->port.type == PORT_SCIFB ||
3116-
port->port.type == PORT_HSCIF) {
3116+
if (type == PORT_SCIFA || type == PORT_SCIFB || type == PORT_HSCIF) {
31173117
sysfs_remove_file(&dev->dev.kobj,
31183118
&dev_attr_rx_fifo_timeout.attr);
31193119
}

drivers/tty/tty_baudrate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ speed_t tty_termios_baud_rate(struct ktermios *termios)
7777
else
7878
cbaud += 15;
7979
}
80-
return baud_table[cbaud];
80+
return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
8181
}
8282
EXPORT_SYMBOL(tty_termios_baud_rate);
8383

@@ -113,7 +113,7 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios)
113113
else
114114
cbaud += 15;
115115
}
116-
return baud_table[cbaud];
116+
return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
117117
#else /* IBSHIFT */
118118
return tty_termios_baud_rate(termios);
119119
#endif /* IBSHIFT */

drivers/tty/vt/vt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ static void csi_K(struct vc_data *vc, int vpar)
15481548
scr_memsetw(start + offset, vc->vc_video_erase_char, 2 * count);
15491549
vc->vc_need_wrap = 0;
15501550
if (con_should_update(vc))
1551-
do_update_region(vc, (unsigned long) start, count);
1551+
do_update_region(vc, (unsigned long)(start + offset), count);
15521552
}
15531553

15541554
static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar positions */

0 commit comments

Comments
 (0)