USB: mos7720: remove broken get_icount and TIOCMIWAIT
authorJohan Hovold <jhovold@gmail.com>
Thu, 21 Mar 2013 11:37:14 +0000 (12:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Mar 2013 20:52:24 +0000 (13:52 -0700)
Remove broken get_icount and TIOCMIWAIT support.

The driver has an icount structure but it is never been updated which
makes get_icount rather pointless and causes TIOCMIWAIT to always return
-EIO.

Note that the TIOCMIWAIT implementation has always been broken and would
not work even if icount support was added as it does not wait for the
modem status to change (does not use a work queue at all).

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/mos7720.c

index e0ebec3b5d6ae077aa4ac0347e8a33470f8dc6c3..d1e2bf30bff809ba4ac8a1eeef3f06d207b349f6 100644 (file)
@@ -62,7 +62,6 @@ struct moschip_port {
        __u8    shadowMCR;              /* last MCR value received */
        __u8    shadowMSR;              /* last MSR value received */
        char                    open;
-       struct async_icount     icount;
        struct usb_serial_port  *port;  /* loop back to the owner */
        struct urb              *write_urb_pool[NUM_URBS];
 };
@@ -1075,9 +1074,6 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port)
                dev_err(&port->dev, "%s - Error %d submitting read urb\n",
                                                        __func__, response);
 
-       /* initialize our icount structure */
-       memset(&(mos7720_port->icount), 0x00, sizeof(mos7720_port->icount));
-
        /* initialize our port settings */
        mos7720_port->shadowMCR = UART_MCR_OUT2; /* Must set to enable ints! */
 
@@ -1803,33 +1799,6 @@ static int mos7720_tiocmset(struct tty_struct *tty,
        return 0;
 }
 
-static int mos7720_get_icount(struct tty_struct *tty,
-                               struct serial_icounter_struct *icount)
-{
-       struct usb_serial_port *port = tty->driver_data;
-       struct moschip_port *mos7720_port;
-       struct async_icount cnow;
-
-       mos7720_port = usb_get_serial_port_data(port);
-       cnow = mos7720_port->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;
-
-       dev_dbg(&port->dev, "%s TIOCGICOUNT RX=%d, TX=%d\n", __func__,
-               icount->rx, icount->tx);
-       return 0;
-}
-
 static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd,
                          unsigned int __user *value)
 {
@@ -1905,8 +1874,6 @@ static int mos7720_ioctl(struct tty_struct *tty,
 {
        struct usb_serial_port *port = tty->driver_data;
        struct moschip_port *mos7720_port;
-       struct async_icount cnow;
-       struct async_icount cprev;
 
        mos7720_port = usb_get_serial_port_data(port);
        if (mos7720_port == NULL)
@@ -1931,27 +1898,6 @@ static int mos7720_ioctl(struct tty_struct *tty,
                dev_dbg(&port->dev, "%s TIOCGSERIAL\n", __func__);
                return get_serial_info(mos7720_port,
                                       (struct serial_struct __user *)arg);
-
-       case TIOCMIWAIT:
-               dev_dbg(&port->dev, "%s TIOCMIWAIT\n", __func__);
-               cprev = mos7720_port->icount;
-               while (1) {
-                       if (signal_pending(current))
-                               return -ERESTARTSYS;
-                       cnow = mos7720_port->icount;
-                       if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
-                           cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
-                               return -EIO; /* no change => error */
-                       if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
-                           ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
-                           ((arg & TIOCM_CD)  && (cnow.dcd != cprev.dcd)) ||
-                           ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
-                               return 0;
-                       }
-                       cprev = cnow;
-               }
-               /* NOTREACHED */
-               break;
        }
 
        return -ENOIOCTLCMD;
@@ -2107,7 +2053,6 @@ static struct usb_serial_driver moschip7720_2port_driver = {
        .ioctl                  = mos7720_ioctl,
        .tiocmget               = mos7720_tiocmget,
        .tiocmset               = mos7720_tiocmset,
-       .get_icount             = mos7720_get_icount,
        .set_termios            = mos7720_set_termios,
        .write                  = mos7720_write,
        .write_room             = mos7720_write_room,