OSDN Git Service

mos7720: bury dead TIOCM... in ->ioctl()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 12 Sep 2018 04:13:10 +0000 (00:13 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 14 Sep 2018 15:12:37 +0000 (11:12 -0400)
These ioctls never reach driver's ->ioctl() - tty_ioctl() handles
them on its own.  ->tiocm[gs]et() is what actually gets called,
and mos7720 provides those, with results equivalent to what the
unreachable code would be doing when called.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/usb/serial/mos7720.c

index 2710952..4c06357 100644 (file)
@@ -1786,51 +1786,6 @@ static int mos7720_tiocmset(struct tty_struct *tty,
        return 0;
 }
 
-static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd,
-                         unsigned int __user *value)
-{
-       unsigned int mcr;
-       unsigned int arg;
-
-       struct usb_serial_port *port;
-
-       if (mos7720_port == NULL)
-               return -1;
-
-       port = (struct usb_serial_port *)mos7720_port->port;
-       mcr = mos7720_port->shadowMCR;
-
-       if (copy_from_user(&arg, value, sizeof(int)))
-               return -EFAULT;
-
-       switch (cmd) {
-       case TIOCMBIS:
-               if (arg & TIOCM_RTS)
-                       mcr |= UART_MCR_RTS;
-               if (arg & TIOCM_DTR)
-                       mcr |= UART_MCR_RTS;
-               if (arg & TIOCM_LOOP)
-                       mcr |= UART_MCR_LOOP;
-               break;
-
-       case TIOCMBIC:
-               if (arg & TIOCM_RTS)
-                       mcr &= ~UART_MCR_RTS;
-               if (arg & TIOCM_DTR)
-                       mcr &= ~UART_MCR_RTS;
-               if (arg & TIOCM_LOOP)
-                       mcr &= ~UART_MCR_LOOP;
-               break;
-
-       }
-
-       mos7720_port->shadowMCR = mcr;
-       write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
-                     mos7720_port->shadowMCR);
-
-       return 0;
-}
-
 static int get_serial_info(struct moschip_port *mos7720_port,
                           struct serial_struct __user *retinfo)
 {
@@ -1868,13 +1823,6 @@ static int mos7720_ioctl(struct tty_struct *tty,
                return get_lsr_info(tty, mos7720_port,
                                        (unsigned int __user *)arg);
 
-       /* FIXME: These should be using the mode methods */
-       case TIOCMBIS:
-       case TIOCMBIC:
-               dev_dbg(&port->dev, "%s TIOCMSET/TIOCMBIC/TIOCMSET\n", __func__);
-               return set_modem_info(mos7720_port, cmd,
-                                     (unsigned int __user *)arg);
-
        case TIOCGSERIAL:
                dev_dbg(&port->dev, "%s TIOCGSERIAL\n", __func__);
                return get_serial_info(mos7720_port,