Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
d1b8bc3b 6086380a

+9 -12
+9 -12
drivers/tty/cyclades.c
··· 1975 1975 cflag = tty->termios.c_cflag; 1976 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 1978 card = info->card; 1991 1979 channel = info->line - card->first_line; 1992 1980 ··· 2283 2295 struct serial_struct __user *new_info) 2284 2296 { 2285 2297 struct serial_struct new_serial; 2298 + int old_flags; 2286 2299 int ret; 2287 2300 2288 2301 if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) 2289 2302 return -EFAULT; 2290 2303 2291 2304 mutex_lock(&info->port.mutex); 2305 + 2306 + old_flags = info->port.flags; 2307 + 2292 2308 if (!capable(CAP_SYS_ADMIN)) { 2293 2309 if (new_serial.close_delay != info->port.close_delay || 2294 2310 new_serial.baud_base != info->baud || ··· 2324 2332 2325 2333 check_and_exit: 2326 2334 if (tty_port_initialized(&info->port)) { 2335 + if ((new_serial.flags ^ old_flags) & ASYNC_SPD_MASK) { 2336 + /* warn about deprecation unless clearing */ 2337 + if (new_serial.flags & ASYNC_SPD_MASK) 2338 + dev_warn_ratelimited(tty->dev, "use of SPD flags is deprecated\n"); 2339 + } 2327 2340 cy_set_line_char(info, tty); 2328 2341 ret = 0; 2329 2342 } else {