diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2018-09-12 07:34:34 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2018-10-13 00:50:42 -0400 |
commit | fc6cc979e42264efbff6c01a8c6af144cc3e43e4 (patch) | |
tree | 0bc0721f4d2ffffb72c819438457cccb626445d3 /drivers/usb/serial | |
parent | 57e5723611bb1598bb1cb11a5ec8a4d257f69bb3 (diff) |
whiteheat: switch to ->get_serial()
... and fix the return value - on success it used to have ioctl(2)
fill the user-supplied struct serial_struct and return -ENOTTY.
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/whiteheat.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 1c7b46a8620c..aefd84f88b59 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -83,8 +83,8 @@ static int whiteheat_port_remove(struct usb_serial_port *port); static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port); static void whiteheat_close(struct usb_serial_port *port); -static int whiteheat_ioctl(struct tty_struct *tty, - unsigned int cmd, unsigned long arg); +static int whiteheat_get_serial(struct tty_struct *tty, + struct serial_struct *ss); static void whiteheat_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); static int whiteheat_tiocmget(struct tty_struct *tty); @@ -120,7 +120,7 @@ static struct usb_serial_driver whiteheat_device = { .port_remove = whiteheat_port_remove, .open = whiteheat_open, .close = whiteheat_close, - .ioctl = whiteheat_ioctl, + .get_serial = whiteheat_get_serial, .set_termios = whiteheat_set_termios, .break_ctl = whiteheat_break_ctl, .tiocmget = whiteheat_tiocmget, @@ -442,33 +442,21 @@ static int whiteheat_tiocmset(struct tty_struct *tty, } -static int whiteheat_ioctl(struct tty_struct *tty, - unsigned int cmd, unsigned long arg) +static int whiteheat_get_serial(struct tty_struct *tty, + struct serial_struct *ss) { struct usb_serial_port *port = tty->driver_data; - struct serial_struct serstruct; - void __user *user_arg = (void __user *)arg; - - switch (cmd) { - case TIOCGSERIAL: - memset(&serstruct, 0, sizeof(serstruct)); - serstruct.type = PORT_16654; - serstruct.line = port->minor; - serstruct.port = port->port_number; - serstruct.xmit_fifo_size = kfifo_size(&port->write_fifo); - serstruct.custom_divisor = 0; - serstruct.baud_base = 460800; - serstruct.close_delay = CLOSING_DELAY; - serstruct.closing_wait = CLOSING_DELAY; - - if (copy_to_user(user_arg, &serstruct, sizeof(serstruct))) - return -EFAULT; - break; - default: - break; - } - return -ENOIOCTLCMD; + ss->type = PORT_16654; + ss->line = port->minor; + ss->port = port->port_number; + ss->xmit_fifo_size = kfifo_size(&port->write_fifo); + ss->custom_divisor = 0; + ss->baud_base = 460800; + ss->close_delay = CLOSING_DELAY; + ss->closing_wait = CLOSING_DELAY; + + return 0; } |