Commit e255aee5 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 20ef6d06 641a41db
...@@ -73,9 +73,15 @@ ...@@ -73,9 +73,15 @@
}) })
#define user_termios_to_kernel_termios(k, u) \ #define user_termios_to_kernel_termios(k, u) \
copy_from_user(k, u, sizeof(struct termios)) copy_from_user(k, u, sizeof(struct termios2))
#define kernel_termios_to_user_termios(u, k) \ #define kernel_termios_to_user_termios(u, k) \
copy_to_user(u, k, sizeof(struct termios2))
#define user_termios_to_kernel_termios_1(k, u) \
copy_from_user(k, u, sizeof(struct termios))
#define kernel_termios_to_user_termios_1(u, k) \
copy_to_user(u, k, sizeof(struct termios)) copy_to_user(u, k, sizeof(struct termios))
#endif /* _ALPHA_TERMIOS_H */ #endif /* _ALPHA_TERMIOS_H */
...@@ -32,6 +32,11 @@ ...@@ -32,6 +32,11 @@
#define TCXONC _IO('t', 30) #define TCXONC _IO('t', 30)
#define TCFLSH _IO('t', 31) #define TCFLSH _IO('t', 31)
#define TCGETS2 _IOR('T', 42, struct termios2)
#define TCSETS2 _IOW('T', 43, struct termios2)
#define TCSETSW2 _IOW('T', 44, struct termios2)
#define TCSETSF2 _IOW('T', 45, struct termios2)
#define TIOCSWINSZ _IOW('t', 103, struct winsize) #define TIOCSWINSZ _IOW('t', 103, struct winsize)
#define TIOCGWINSZ _IOR('t', 104, struct winsize) #define TIOCGWINSZ _IOR('t', 104, struct winsize)
#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ #define TIOCSTART _IO('t', 110) /* start output, like ^Q */
......
...@@ -26,6 +26,19 @@ struct termios { ...@@ -26,6 +26,19 @@ struct termios {
speed_t c_ospeed; /* output speed */ speed_t c_ospeed; /* output speed */
}; };
/* Alpha has identical termios and termios2 */
struct termios2 {
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_cc[NCCS]; /* control characters */
cc_t c_line; /* line discipline (== c_cc[19]) */
speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */
};
/* Alpha has matching termios and ktermios */ /* Alpha has matching termios and ktermios */
struct ktermios { struct ktermios {
...@@ -152,6 +165,7 @@ struct ktermios { ...@@ -152,6 +165,7 @@ struct ktermios {
#define B3000000 00034 #define B3000000 00034
#define B3500000 00035 #define B3500000 00035
#define B4000000 00036 #define B4000000 00036
#define BOTHER 00037
#define CSIZE 00001400 #define CSIZE 00001400
#define CS5 00000000 #define CS5 00000000
...@@ -169,6 +183,9 @@ struct ktermios { ...@@ -169,6 +183,9 @@ struct ktermios {
#define CMSPAR 010000000000 /* mark or space (stick) parity */ #define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */ #define CRTSCTS 020000000000 /* flow control */
#define CIBAUD 07600000
#define IBSHIFT 16
/* c_lflag bits */ /* c_lflag bits */
#define ISIG 0x00000080 #define ISIG 0x00000080
#define ICANON 0x00000100 #define ICANON 0x00000100
......
...@@ -1614,10 +1614,10 @@ static void sci_request_dma(struct uart_port *port) ...@@ -1614,10 +1614,10 @@ static void sci_request_dma(struct uart_port *port)
hrtimer_init(&s->rx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&s->rx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
s->rx_timer.function = rx_timer_fn; s->rx_timer.function = rx_timer_fn;
s->chan_rx_saved = s->chan_rx = chan;
if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
sci_submit_rx(s); sci_submit_rx(s);
s->chan_rx_saved = s->chan_rx = chan;
} }
} }
...@@ -3102,6 +3102,7 @@ static struct uart_driver sci_uart_driver = { ...@@ -3102,6 +3102,7 @@ static struct uart_driver sci_uart_driver = {
static int sci_remove(struct platform_device *dev) static int sci_remove(struct platform_device *dev)
{ {
struct sci_port *port = platform_get_drvdata(dev); struct sci_port *port = platform_get_drvdata(dev);
unsigned int type = port->port.type; /* uart_remove_... clears it */
sci_ports_in_use &= ~BIT(port->port.line); sci_ports_in_use &= ~BIT(port->port.line);
uart_remove_one_port(&sci_uart_driver, &port->port); uart_remove_one_port(&sci_uart_driver, &port->port);
...@@ -3112,8 +3113,7 @@ static int sci_remove(struct platform_device *dev) ...@@ -3112,8 +3113,7 @@ static int sci_remove(struct platform_device *dev)
sysfs_remove_file(&dev->dev.kobj, sysfs_remove_file(&dev->dev.kobj,
&dev_attr_rx_fifo_trigger.attr); &dev_attr_rx_fifo_trigger.attr);
} }
if (port->port.type == PORT_SCIFA || port->port.type == PORT_SCIFB || if (type == PORT_SCIFA || type == PORT_SCIFB || type == PORT_HSCIF) {
port->port.type == PORT_HSCIF) {
sysfs_remove_file(&dev->dev.kobj, sysfs_remove_file(&dev->dev.kobj,
&dev_attr_rx_fifo_timeout.attr); &dev_attr_rx_fifo_timeout.attr);
} }
......
...@@ -77,7 +77,7 @@ speed_t tty_termios_baud_rate(struct ktermios *termios) ...@@ -77,7 +77,7 @@ speed_t tty_termios_baud_rate(struct ktermios *termios)
else else
cbaud += 15; cbaud += 15;
} }
return baud_table[cbaud]; return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
} }
EXPORT_SYMBOL(tty_termios_baud_rate); EXPORT_SYMBOL(tty_termios_baud_rate);
...@@ -113,7 +113,7 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios) ...@@ -113,7 +113,7 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios)
else else
cbaud += 15; cbaud += 15;
} }
return baud_table[cbaud]; return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
#else /* IBSHIFT */ #else /* IBSHIFT */
return tty_termios_baud_rate(termios); return tty_termios_baud_rate(termios);
#endif /* IBSHIFT */ #endif /* IBSHIFT */
......
...@@ -1548,7 +1548,7 @@ static void csi_K(struct vc_data *vc, int vpar) ...@@ -1548,7 +1548,7 @@ static void csi_K(struct vc_data *vc, int vpar)
scr_memsetw(start + offset, vc->vc_video_erase_char, 2 * count); scr_memsetw(start + offset, vc->vc_video_erase_char, 2 * count);
vc->vc_need_wrap = 0; vc->vc_need_wrap = 0;
if (con_should_update(vc)) if (con_should_update(vc))
do_update_region(vc, (unsigned long) start, count); do_update_region(vc, (unsigned long)(start + offset), count);
} }
static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar positions */ static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar positions */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment