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

USB: ark3116: 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 6f86fec9
...@@ -62,7 +62,6 @@ static int is_irda(struct usb_serial *serial) ...@@ -62,7 +62,6 @@ static int is_irda(struct usb_serial *serial)
} }
struct ark3116_private { struct ark3116_private {
struct async_icount icount;
int irda; /* 1 for irda device */ int irda; /* 1 for irda device */
/* protects hw register updates */ /* protects hw register updates */
...@@ -402,31 +401,10 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -402,31 +401,10 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
return result; 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, static int ark3116_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct ark3116_private *priv = usb_get_serial_port_data(port);
struct serial_struct serstruct; struct serial_struct serstruct;
void __user *user_arg = (void __user *)arg; void __user *user_arg = (void __user *)arg;
...@@ -450,7 +428,7 @@ static int ark3116_ioctl(struct tty_struct *tty, ...@@ -450,7 +428,7 @@ static int ark3116_ioctl(struct tty_struct *tty,
return 0; return 0;
case TIOCMIWAIT: case TIOCMIWAIT:
for (;;) { for (;;) {
struct async_icount prev = priv->icount; struct async_icount prev = port->icount;
interruptible_sleep_on(&port->delta_msr_wait); interruptible_sleep_on(&port->delta_msr_wait);
/* see if a signal did it */ /* see if a signal did it */
if (signal_pending(current)) if (signal_pending(current))
...@@ -459,19 +437,19 @@ static int ark3116_ioctl(struct tty_struct *tty, ...@@ -459,19 +437,19 @@ static int ark3116_ioctl(struct tty_struct *tty,
if (port->serial->disconnected) if (port->serial->disconnected)
return -EIO; return -EIO;
if ((prev.rng == priv->icount.rng) && if ((prev.rng == port->icount.rng) &&
(prev.dsr == priv->icount.dsr) && (prev.dsr == port->icount.dsr) &&
(prev.dcd == priv->icount.dcd) && (prev.dcd == port->icount.dcd) &&
(prev.cts == priv->icount.cts)) (prev.cts == port->icount.cts))
return -EIO; return -EIO;
if ((arg & TIOCM_RNG && if ((arg & TIOCM_RNG &&
(prev.rng != priv->icount.rng)) || (prev.rng != port->icount.rng)) ||
(arg & TIOCM_DSR && (arg & TIOCM_DSR &&
(prev.dsr != priv->icount.dsr)) || (prev.dsr != port->icount.dsr)) ||
(arg & TIOCM_CD && (arg & TIOCM_CD &&
(prev.dcd != priv->icount.dcd)) || (prev.dcd != port->icount.dcd)) ||
(arg & TIOCM_CTS && (arg & TIOCM_CTS &&
(prev.cts != priv->icount.cts))) (prev.cts != port->icount.cts)))
return 0; return 0;
} }
break; break;
...@@ -572,13 +550,13 @@ static void ark3116_update_msr(struct usb_serial_port *port, __u8 msr) ...@@ -572,13 +550,13 @@ static void ark3116_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);
} }
} }
...@@ -595,13 +573,13 @@ static void ark3116_update_lsr(struct usb_serial_port *port, __u8 lsr) ...@@ -595,13 +573,13 @@ static void ark3116_update_lsr(struct usb_serial_port *port, __u8 lsr)
if (lsr&UART_LSR_BRK_ERROR_BITS) { if (lsr&UART_LSR_BRK_ERROR_BITS) {
if (lsr & UART_LSR_BI) if (lsr & UART_LSR_BI)
priv->icount.brk++; port->icount.brk++;
if (lsr & UART_LSR_FE) if (lsr & UART_LSR_FE)
priv->icount.frame++; port->icount.frame++;
if (lsr & UART_LSR_PE) if (lsr & UART_LSR_PE)
priv->icount.parity++; port->icount.parity++;
if (lsr & UART_LSR_OE) if (lsr & UART_LSR_OE)
priv->icount.overrun++; port->icount.overrun++;
} }
} }
...@@ -719,7 +697,7 @@ static struct usb_serial_driver ark3116_device = { ...@@ -719,7 +697,7 @@ static struct usb_serial_driver ark3116_device = {
.ioctl = ark3116_ioctl, .ioctl = ark3116_ioctl,
.tiocmget = ark3116_tiocmget, .tiocmget = ark3116_tiocmget,
.tiocmset = ark3116_tiocmset, .tiocmset = ark3116_tiocmset,
.get_icount = ark3116_get_icount, .get_icount = usb_serial_generic_get_icount,
.open = ark3116_open, .open = ark3116_open,
.close = ark3116_close, .close = ark3116_close,
.break_ctl = ark3116_break_ctl, .break_ctl = ark3116_break_ctl,
......
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