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

ti_usb_3410_5052: switch to ->[sg]et_serial()

Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 57e57236 ee08cefb

+24 -50
+24 -50
drivers/usb/serial/ti_usb_3410_5052.c
··· 313 313 static bool ti_tx_empty(struct usb_serial_port *port); 314 314 static void ti_throttle(struct tty_struct *tty); 315 315 static void ti_unthrottle(struct tty_struct *tty); 316 - static int ti_ioctl(struct tty_struct *tty, 317 - unsigned int cmd, unsigned long arg); 318 316 static void ti_set_termios(struct tty_struct *tty, 319 317 struct usb_serial_port *port, struct ktermios *old_termios); 320 318 static int ti_tiocmget(struct tty_struct *tty); ··· 328 330 static void ti_send(struct ti_port *tport); 329 331 static int ti_set_mcr(struct ti_port *tport, unsigned int mcr); 330 332 static int ti_get_lsr(struct ti_port *tport, u8 *lsr); 331 - static int ti_get_serial_info(struct ti_port *tport, 332 - struct serial_struct __user *ret_arg); 333 - static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport, 334 - struct serial_struct __user *new_arg); 333 + static int ti_get_serial_info(struct tty_struct *tty, 334 + struct serial_struct *ss); 335 + static int ti_set_serial_info(struct tty_struct *tty, 336 + struct serial_struct *ss); 335 337 static void ti_handle_new_msr(struct ti_port *tport, u8 msr); 336 338 337 339 static void ti_stop_read(struct ti_port *tport, struct tty_struct *tty); ··· 434 436 .tx_empty = ti_tx_empty, 435 437 .throttle = ti_throttle, 436 438 .unthrottle = ti_unthrottle, 437 - .ioctl = ti_ioctl, 439 + .get_serial = ti_get_serial_info, 440 + .set_serial = ti_set_serial_info, 438 441 .set_termios = ti_set_termios, 439 442 .tiocmget = ti_tiocmget, 440 443 .tiocmset = ti_tiocmset, ··· 468 469 .tx_empty = ti_tx_empty, 469 470 .throttle = ti_throttle, 470 471 .unthrottle = ti_unthrottle, 471 - .ioctl = ti_ioctl, 472 + .get_serial = ti_get_serial_info, 473 + .set_serial = ti_set_serial_info, 472 474 .set_termios = ti_set_termios, 473 475 .tiocmget = ti_tiocmget, 474 476 .tiocmset = ti_tiocmset, ··· 901 901 __func__, status); 902 902 } 903 903 } 904 - 905 - static int ti_ioctl(struct tty_struct *tty, 906 - unsigned int cmd, unsigned long arg) 907 - { 908 - struct usb_serial_port *port = tty->driver_data; 909 - struct ti_port *tport = usb_get_serial_port_data(port); 910 - 911 - switch (cmd) { 912 - case TIOCGSERIAL: 913 - return ti_get_serial_info(tport, 914 - (struct serial_struct __user *)arg); 915 - case TIOCSSERIAL: 916 - return ti_set_serial_info(tty, tport, 917 - (struct serial_struct __user *)arg); 918 - } 919 - return -ENOIOCTLCMD; 920 - } 921 - 922 904 923 905 static void ti_set_termios(struct tty_struct *tty, 924 906 struct usb_serial_port *port, struct ktermios *old_termios) ··· 1399 1417 } 1400 1418 1401 1419 1402 - static int ti_get_serial_info(struct ti_port *tport, 1403 - struct serial_struct __user *ret_arg) 1420 + static int ti_get_serial_info(struct tty_struct *tty, 1421 + struct serial_struct *ss) 1404 1422 { 1405 - struct usb_serial_port *port = tport->tp_port; 1406 - struct serial_struct ret_serial; 1423 + struct usb_serial_port *port = tty->driver_data; 1424 + struct ti_port *tport = usb_get_serial_port_data(port); 1407 1425 unsigned cwait; 1408 1426 1409 1427 cwait = port->port.closing_wait; 1410 1428 if (cwait != ASYNC_CLOSING_WAIT_NONE) 1411 1429 cwait = jiffies_to_msecs(cwait) / 10; 1412 1430 1413 - memset(&ret_serial, 0, sizeof(ret_serial)); 1414 - 1415 - ret_serial.type = PORT_16550A; 1416 - ret_serial.line = port->minor; 1417 - ret_serial.port = port->port_number; 1418 - ret_serial.xmit_fifo_size = kfifo_size(&port->write_fifo); 1419 - ret_serial.baud_base = tport->tp_tdev->td_is_3410 ? 921600 : 460800; 1420 - ret_serial.closing_wait = cwait; 1421 - 1422 - if (copy_to_user(ret_arg, &ret_serial, sizeof(*ret_arg))) 1423 - return -EFAULT; 1424 - 1431 + ss->type = PORT_16550A; 1432 + ss->line = port->minor; 1433 + ss->port = port->port_number; 1434 + ss->xmit_fifo_size = kfifo_size(&port->write_fifo); 1435 + ss->baud_base = tport->tp_tdev->td_is_3410 ? 921600 : 460800; 1436 + ss->closing_wait = cwait; 1425 1437 return 0; 1426 1438 } 1427 1439 1428 1440 1429 - static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport, 1430 - struct serial_struct __user *new_arg) 1441 + static int ti_set_serial_info(struct tty_struct *tty, 1442 + struct serial_struct *ss) 1431 1443 { 1432 - struct serial_struct new_serial; 1444 + struct usb_serial_port *port = tty->driver_data; 1445 + struct ti_port *tport = usb_get_serial_port_data(port); 1433 1446 unsigned cwait; 1434 1447 1435 - if (copy_from_user(&new_serial, new_arg, sizeof(new_serial))) 1436 - return -EFAULT; 1437 - 1438 - cwait = new_serial.closing_wait; 1448 + cwait = ss->closing_wait; 1439 1449 if (cwait != ASYNC_CLOSING_WAIT_NONE) 1440 - cwait = msecs_to_jiffies(10 * new_serial.closing_wait); 1450 + cwait = msecs_to_jiffies(10 * ss->closing_wait); 1441 1451 1442 1452 tport->tp_port->port.closing_wait = cwait; 1443 1453