summaryrefslogtreecommitdiffstats
path: root/drivers/tty/cyclades.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-06-06 06:54:38 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-06-13 05:49:58 -0400
commitd1b8bc3bc27c2ce7b359ebf084065b2b9468c04d (patch)
treec80a05292c811111d7f1f29b39327d8c4239c1c2 /drivers/tty/cyclades.c
parent6086380a5576239bd5bfaa175364550b38223ba6 (diff)
tty: cyclades: drop broken alt-speed support
Setting an alt_speed using the ASYNC_SPD flags has been deprecated since v2.1.69, and has been broken since v3.10 and commit 6865ff222cca ("TTY: do not warn about setting speed via SPD_*") without anyone noticing. Drop the broken alt-speed handling altogether, and add a ratelimited warning about using TIOCCSERIAL to to change speed as being deprecated. Note that using ASYNC_SPD_CUST is still supported. Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/cyclades.c')
-rw-r--r--drivers/tty/cyclades.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index 104f09c58163..d272bc4e7fb5 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -1975,18 +1975,6 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
1975 cflag = tty->termios.c_cflag; 1975 cflag = tty->termios.c_cflag;
1976 iflag = tty->termios.c_iflag; 1976 iflag = tty->termios.c_iflag;
1977 1977
1978 /*
1979 * Set up the tty->alt_speed kludge
1980 */
1981 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
1982 tty->alt_speed = 57600;
1983 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
1984 tty->alt_speed = 115200;
1985 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
1986 tty->alt_speed = 230400;
1987 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
1988 tty->alt_speed = 460800;
1989
1990 card = info->card; 1978 card = info->card;
1991 channel = info->line - card->first_line; 1979 channel = info->line - card->first_line;
1992 1980
@@ -2295,12 +2283,16 @@ cy_set_serial_info(struct cyclades_port *info, struct tty_struct *tty,
2295 struct serial_struct __user *new_info) 2283 struct serial_struct __user *new_info)
2296{ 2284{
2297 struct serial_struct new_serial; 2285 struct serial_struct new_serial;
2286 int old_flags;
2298 int ret; 2287 int ret;
2299 2288
2300 if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) 2289 if (copy_from_user(&new_serial, new_info, sizeof(new_serial)))
2301 return -EFAULT; 2290 return -EFAULT;
2302 2291
2303 mutex_lock(&info->port.mutex); 2292 mutex_lock(&info->port.mutex);
2293
2294 old_flags = info->port.flags;
2295
2304 if (!capable(CAP_SYS_ADMIN)) { 2296 if (!capable(CAP_SYS_ADMIN)) {
2305 if (new_serial.close_delay != info->port.close_delay || 2297 if (new_serial.close_delay != info->port.close_delay ||
2306 new_serial.baud_base != info->baud || 2298 new_serial.baud_base != info->baud ||
@@ -2332,6 +2324,11 @@ cy_set_serial_info(struct cyclades_port *info, struct tty_struct *tty,
2332 2324
2333check_and_exit: 2325check_and_exit:
2334 if (tty_port_initialized(&info->port)) { 2326 if (tty_port_initialized(&info->port)) {
2327 if ((new_serial.flags ^ old_flags) & ASYNC_SPD_MASK) {
2328 /* warn about deprecation unless clearing */
2329 if (new_serial.flags & ASYNC_SPD_MASK)
2330 dev_warn_ratelimited(tty->dev, "use of SPD flags is deprecated\n");
2331 }
2335 cy_set_line_char(info, tty); 2332 cy_set_line_char(info, tty);
2336 ret = 0; 2333 ret = 0;
2337 } else { 2334 } else {