Commit 31ecdb6b authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: ssu100: switch to generic get_icount implementation

Switch to the generic get_icount implementation.
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e1ed212d
...@@ -61,7 +61,6 @@ struct ssu100_port_private { ...@@ -61,7 +61,6 @@ struct ssu100_port_private {
spinlock_t status_lock; spinlock_t status_lock;
u8 shadowLSR; u8 shadowLSR;
u8 shadowMSR; u8 shadowMSR;
struct async_icount icount;
}; };
static inline int ssu100_control_msg(struct usb_device *dev, static inline int ssu100_control_msg(struct usb_device *dev,
...@@ -345,16 +344,16 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) ...@@ -345,16 +344,16 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&priv->status_lock, flags); spin_lock_irqsave(&priv->status_lock, flags);
prev = priv->icount; prev = port->icount;
spin_unlock_irqrestore(&priv->status_lock, flags); spin_unlock_irqrestore(&priv->status_lock, flags);
while (1) { while (1) {
wait_event_interruptible(port->delta_msr_wait, wait_event_interruptible(port->delta_msr_wait,
(port->serial->disconnected || (port->serial->disconnected ||
(priv->icount.rng != prev.rng) || (port->icount.rng != prev.rng) ||
(priv->icount.dsr != prev.dsr) || (port->icount.dsr != prev.dsr) ||
(priv->icount.dcd != prev.dcd) || (port->icount.dcd != prev.dcd) ||
(priv->icount.cts != prev.cts))); (port->icount.cts != prev.cts)));
if (signal_pending(current)) if (signal_pending(current))
return -ERESTARTSYS; return -ERESTARTSYS;
...@@ -363,7 +362,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) ...@@ -363,7 +362,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
return -EIO; return -EIO;
spin_lock_irqsave(&priv->status_lock, flags); spin_lock_irqsave(&priv->status_lock, flags);
cur = priv->icount; cur = port->icount;
spin_unlock_irqrestore(&priv->status_lock, flags); spin_unlock_irqrestore(&priv->status_lock, flags);
if ((prev.rng == cur.rng) && if ((prev.rng == cur.rng) &&
...@@ -381,30 +380,6 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) ...@@ -381,30 +380,6 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
return 0; return 0;
} }
static int ssu100_get_icount(struct tty_struct *tty,
struct serial_icounter_struct *icount)
{
struct usb_serial_port *port = tty->driver_data;
struct ssu100_port_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 ssu100_ioctl(struct tty_struct *tty, static int ssu100_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
...@@ -527,13 +502,13 @@ static void ssu100_update_msr(struct usb_serial_port *port, u8 msr) ...@@ -527,13 +502,13 @@ static void ssu100_update_msr(struct usb_serial_port *port, u8 msr)
if (msr & UART_MSR_ANY_DELTA) { if (msr & UART_MSR_ANY_DELTA) {
/* update input line counters */ /* update input line counters */
if (msr & UART_MSR_DCTS) if (msr & UART_MSR_DCTS)
priv->icount.cts++; port->icount.cts++;
if (msr & UART_MSR_DDSR) if (msr & UART_MSR_DDSR)
priv->icount.dsr++; port->icount.dsr++;
if (msr & UART_MSR_DDCD) if (msr & UART_MSR_DDCD)
priv->icount.dcd++; port->icount.dcd++;
if (msr & UART_MSR_TERI) if (msr & UART_MSR_TERI)
priv->icount.rng++; port->icount.rng++;
wake_up_interruptible(&port->delta_msr_wait); wake_up_interruptible(&port->delta_msr_wait);
} }
} }
...@@ -553,22 +528,22 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr, ...@@ -553,22 +528,22 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr,
/* we always want to update icount, but we only want to /* we always want to update icount, but we only want to
* update tty_flag for one case */ * update tty_flag for one case */
if (lsr & UART_LSR_BI) { if (lsr & UART_LSR_BI) {
priv->icount.brk++; port->icount.brk++;
*tty_flag = TTY_BREAK; *tty_flag = TTY_BREAK;
usb_serial_handle_break(port); usb_serial_handle_break(port);
} }
if (lsr & UART_LSR_PE) { if (lsr & UART_LSR_PE) {
priv->icount.parity++; port->icount.parity++;
if (*tty_flag == TTY_NORMAL) if (*tty_flag == TTY_NORMAL)
*tty_flag = TTY_PARITY; *tty_flag = TTY_PARITY;
} }
if (lsr & UART_LSR_FE) { if (lsr & UART_LSR_FE) {
priv->icount.frame++; port->icount.frame++;
if (*tty_flag == TTY_NORMAL) if (*tty_flag == TTY_NORMAL)
*tty_flag = TTY_FRAME; *tty_flag = TTY_FRAME;
} }
if (lsr & UART_LSR_OE){ if (lsr & UART_LSR_OE){
priv->icount.overrun++; port->icount.overrun++;
if (*tty_flag == TTY_NORMAL) if (*tty_flag == TTY_NORMAL)
*tty_flag = TTY_OVERRUN; *tty_flag = TTY_OVERRUN;
} }
...@@ -632,7 +607,7 @@ static struct usb_serial_driver ssu100_device = { ...@@ -632,7 +607,7 @@ static struct usb_serial_driver ssu100_device = {
.process_read_urb = ssu100_process_read_urb, .process_read_urb = ssu100_process_read_urb,
.tiocmget = ssu100_tiocmget, .tiocmget = ssu100_tiocmget,
.tiocmset = ssu100_tiocmset, .tiocmset = ssu100_tiocmset,
.get_icount = ssu100_get_icount, .get_icount = usb_serial_generic_get_icount,
.ioctl = ssu100_ioctl, .ioctl = ssu100_ioctl,
.set_termios = ssu100_set_termios, .set_termios = ssu100_set_termios,
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment