io_ti: switch to ->get_serial()

Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2018-09-12 00:17:54 -04:00
parent e27235eda5
commit 2a5357e563
1 changed files with 14 additions and 33 deletions

View File

@ -2437,47 +2437,28 @@ static int edge_tiocmget(struct tty_struct *tty)
return result; return result;
} }
static int get_serial_info(struct edgeport_port *edge_port, static int get_serial_info(struct tty_struct *tty,
struct serial_struct __user *retinfo) struct serial_struct *ss)
{ {
struct serial_struct tmp; struct usb_serial_port *port = tty->driver_data;
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
unsigned cwait; unsigned cwait;
cwait = edge_port->port->port.closing_wait; cwait = edge_port->port->port.closing_wait;
if (cwait != ASYNC_CLOSING_WAIT_NONE) if (cwait != ASYNC_CLOSING_WAIT_NONE)
cwait = jiffies_to_msecs(cwait) / 10; cwait = jiffies_to_msecs(cwait) / 10;
memset(&tmp, 0, sizeof(tmp)); ss->type = PORT_16550A;
ss->line = edge_port->port->minor;
tmp.type = PORT_16550A; ss->port = edge_port->port->port_number;
tmp.line = edge_port->port->minor; ss->irq = 0;
tmp.port = edge_port->port->port_number; ss->xmit_fifo_size = edge_port->port->bulk_out_size;
tmp.irq = 0; ss->baud_base = 9600;
tmp.xmit_fifo_size = edge_port->port->bulk_out_size; ss->close_delay = 5*HZ;
tmp.baud_base = 9600; ss->closing_wait = cwait;
tmp.close_delay = 5*HZ;
tmp.closing_wait = cwait;
if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
return -EFAULT;
return 0; return 0;
} }
static int edge_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg)
{
struct usb_serial_port *port = tty->driver_data;
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
switch (cmd) {
case TIOCGSERIAL:
dev_dbg(&port->dev, "%s - TIOCGSERIAL\n", __func__);
return get_serial_info(edge_port,
(struct serial_struct __user *) arg);
}
return -ENOIOCTLCMD;
}
static void edge_break(struct tty_struct *tty, int break_state) static void edge_break(struct tty_struct *tty, int break_state)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
@ -2738,7 +2719,7 @@ static struct usb_serial_driver edgeport_1port_device = {
.release = edge_release, .release = edge_release,
.port_probe = edge_port_probe, .port_probe = edge_port_probe,
.port_remove = edge_port_remove, .port_remove = edge_port_remove,
.ioctl = edge_ioctl, .get_serial = get_serial_info,
.set_termios = edge_set_termios, .set_termios = edge_set_termios,
.tiocmget = edge_tiocmget, .tiocmget = edge_tiocmget,
.tiocmset = edge_tiocmset, .tiocmset = edge_tiocmset,
@ -2777,7 +2758,7 @@ static struct usb_serial_driver edgeport_2port_device = {
.release = edge_release, .release = edge_release,
.port_probe = edge_port_probe, .port_probe = edge_port_probe,
.port_remove = edge_port_remove, .port_remove = edge_port_remove,
.ioctl = edge_ioctl, .get_serial = get_serial_info,
.set_termios = edge_set_termios, .set_termios = edge_set_termios,
.tiocmget = edge_tiocmget, .tiocmget = edge_tiocmget,
.tiocmset = edge_tiocmset, .tiocmset = edge_tiocmset,