From 0bca1b913affbd7e2fdaffee62a499659a466eb5 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 16 Sep 2010 18:21:40 +0100 Subject: tty: Convert the USB drivers to the new icount interface Simple pasting job using the new ops function. Also fix a couple of devices directly returning the internal struct (which happens at this point to match for the fields that matter but isn't correct or futureproof) Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ark3116.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'drivers/usb/serial/ark3116.c') diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 4e41a2a39422..8f1d4fb19d24 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -411,6 +411,26 @@ err_out: return result; } +static int ark3116_get_icount(struct tty_struct *tty, + struct serial_icounter_struct *icount) +{ + struct usb_serial_port *port = tty->driver_data; + struct ark3116_private *priv = usb_get_serial_port_data(port); + struct async_icount cnow = priv->icount; + icount->cts = cnow.cts; + icount->dsr = cnow.dsr; + icount->rng = cnow.rng; + icount->dcd = cnow.dcd; + icount->rx = cnow.rx; + icount->tx = cnow.tx; + icount->frame = cnow.frame; + icount->overrun = cnow.overrun; + icount->parity = cnow.parity; + icount->brk = cnow.brk; + icount->buf_overrun = cnow.buf_overrun; + return 0; +} + static int ark3116_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { @@ -460,25 +480,6 @@ static int ark3116_ioctl(struct tty_struct *tty, struct file *file, return 0; } break; - case TIOCGICOUNT: { - struct serial_icounter_struct icount; - struct async_icount cnow = priv->icount; - memset(&icount, 0, sizeof(icount)); - icount.cts = cnow.cts; - icount.dsr = cnow.dsr; - icount.rng = cnow.rng; - icount.dcd = cnow.dcd; - icount.rx = cnow.rx; - icount.tx = cnow.tx; - icount.frame = cnow.frame; - icount.overrun = cnow.overrun; - icount.parity = cnow.parity; - icount.brk = cnow.brk; - icount.buf_overrun = cnow.buf_overrun; - if (copy_to_user(user_arg, &icount, sizeof(icount))) - return -EFAULT; - return 0; - } } return -ENOIOCTLCMD; @@ -736,6 +737,7 @@ static struct usb_serial_driver ark3116_device = { .ioctl = ark3116_ioctl, .tiocmget = ark3116_tiocmget, .tiocmset = ark3116_tiocmset, + .get_icount = ark3116_get_icount, .open = ark3116_open, .close = ark3116_close, .break_ctl = ark3116_break_ctl, -- cgit v1.2.3