From: Johan Hovold Date: Thu, 2 Jan 2014 21:49:35 +0000 (+0100) Subject: USB: oti6858: switch to generic TIOCMIWAIT implementation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bd6383c81d5f33e01688a87c50a8d3a878aa43d5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git USB: oti6858: switch to generic TIOCMIWAIT implementation Switch to the generic TIOCMIWAIT implementation. Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 9ea15e0a22d8..95a79b487515 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -135,7 +135,6 @@ static int oti6858_chars_in_buffer(struct tty_struct *tty); static int oti6858_tiocmget(struct tty_struct *tty); static int oti6858_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear); -static int oti6858_tiocmiwait(struct tty_struct *tty, unsigned long arg); static int oti6858_port_probe(struct usb_serial_port *port); static int oti6858_port_remove(struct usb_serial_port *port); @@ -154,7 +153,7 @@ static struct usb_serial_driver oti6858_device = { .init_termios = oti6858_init_termios, .tiocmget = oti6858_tiocmget, .tiocmset = oti6858_tiocmset, - .tiocmiwait = oti6858_tiocmiwait, + .tiocmiwait = usb_serial_generic_tiocmiwait, .read_bulk_callback = oti6858_read_bulk_callback, .read_int_callback = oti6858_read_int_callback, .write_bulk_callback = oti6858_write_bulk_callback, @@ -643,46 +642,6 @@ static int oti6858_tiocmget(struct tty_struct *tty) return result; } -static int oti6858_tiocmiwait(struct tty_struct *tty, unsigned long arg) -{ - struct usb_serial_port *port = tty->driver_data; - struct oti6858_private *priv = usb_get_serial_port_data(port); - unsigned long flags; - unsigned int prev, status; - unsigned int changed; - - spin_lock_irqsave(&priv->lock, flags); - prev = priv->status.pin_state; - spin_unlock_irqrestore(&priv->lock, flags); - - while (1) { - wait_event_interruptible(port->port.delta_msr_wait, - port->serial->disconnected || - priv->status.pin_state != prev); - if (signal_pending(current)) - return -ERESTARTSYS; - - if (port->serial->disconnected) - return -EIO; - - spin_lock_irqsave(&priv->lock, flags); - status = priv->status.pin_state & PIN_MASK; - spin_unlock_irqrestore(&priv->lock, flags); - - changed = prev ^ status; - /* FIXME: check if this is correct (active high/low) */ - if (((arg & TIOCM_RNG) && (changed & PIN_RI)) || - ((arg & TIOCM_DSR) && (changed & PIN_DSR)) || - ((arg & TIOCM_CD) && (changed & PIN_DCD)) || - ((arg & TIOCM_CTS) && (changed & PIN_CTS))) - return 0; - prev = status; - } - - /* NOTREACHED */ - return 0; -} - static void oti6858_read_int_callback(struct urb *urb) { struct usb_serial_port *port = urb->context; @@ -742,8 +701,18 @@ static void oti6858_read_int_callback(struct urb *urb) if (!priv->transient) { u8 delta = xs->pin_state ^ priv->status.pin_state; - if (delta & PIN_MSR_MASK) + if (delta & PIN_MSR_MASK) { + if (delta & PIN_CTS) + port->icount.cts++; + if (delta & PIN_DSR) + port->icount.dsr++; + if (delta & PIN_RI) + port->icount.rng++; + if (delta & PIN_DCD) + port->icount.dcd++; + wake_up_interruptible(&port->port.delta_msr_wait); + } memcpy(&priv->status, xs, OTI6858_CTRL_PKT_SIZE); }