aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mos7840.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r--drivers/usb/serial/mos7840.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 1a42bc213799..93dad5853cd5 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2209,6 +2209,34 @@ static int mos7840_get_serial_info(struct moschip_port *mos7840_port,
2209 return 0; 2209 return 0;
2210} 2210}
2211 2211
2212static int mos7840_get_icount(struct tty_struct *tty,
2213 struct serial_icounter_struct *icount)
2214{
2215 struct usb_serial_port *port = tty->driver_data;
2216 struct moschip_port *mos7840_port;
2217 struct async_icount cnow;
2218
2219 mos7840_port = mos7840_get_port_private(port);
2220 cnow = mos7840_port->icount;
2221
2222 smp_rmb();
2223 icount->cts = cnow.cts;
2224 icount->dsr = cnow.dsr;
2225 icount->rng = cnow.rng;
2226 icount->dcd = cnow.dcd;
2227 icount->rx = cnow.rx;
2228 icount->tx = cnow.tx;
2229 icount->frame = cnow.frame;
2230 icount->overrun = cnow.overrun;
2231 icount->parity = cnow.parity;
2232 icount->brk = cnow.brk;
2233 icount->buf_overrun = cnow.buf_overrun;
2234
2235 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
2236 port->number, icount->rx, icount->tx);
2237 return 0;
2238}
2239
2212/***************************************************************************** 2240/*****************************************************************************
2213 * SerialIoctl 2241 * SerialIoctl
2214 * this function handles any ioctl calls to the driver 2242 * this function handles any ioctl calls to the driver
@@ -2223,7 +2251,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
2223 2251
2224 struct async_icount cnow; 2252 struct async_icount cnow;
2225 struct async_icount cprev; 2253 struct async_icount cprev;
2226 struct serial_icounter_struct icount;
2227 2254
2228 if (mos7840_port_paranoia_check(port, __func__)) { 2255 if (mos7840_port_paranoia_check(port, __func__)) {
2229 dbg("%s", "Invalid port"); 2256 dbg("%s", "Invalid port");
@@ -2282,29 +2309,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
2282 /* NOTREACHED */ 2309 /* NOTREACHED */
2283 break; 2310 break;
2284 2311
2285 case TIOCGICOUNT:
2286 cnow = mos7840_port->icount;
2287 smp_rmb();
2288
2289 memset(&icount, 0, sizeof(struct serial_icounter_struct));
2290
2291 icount.cts = cnow.cts;
2292 icount.dsr = cnow.dsr;
2293 icount.rng = cnow.rng;
2294 icount.dcd = cnow.dcd;
2295 icount.rx = cnow.rx;
2296 icount.tx = cnow.tx;
2297 icount.frame = cnow.frame;
2298 icount.overrun = cnow.overrun;
2299 icount.parity = cnow.parity;
2300 icount.brk = cnow.brk;
2301 icount.buf_overrun = cnow.buf_overrun;
2302
2303 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
2304 port->number, icount.rx, icount.tx);
2305 if (copy_to_user(argp, &icount, sizeof(icount)))
2306 return -EFAULT;
2307 return 0;
2308 default: 2312 default:
2309 break; 2313 break;
2310 } 2314 }
@@ -2674,6 +2678,7 @@ static struct usb_serial_driver moschip7840_4port_device = {
2674 .break_ctl = mos7840_break, 2678 .break_ctl = mos7840_break,
2675 .tiocmget = mos7840_tiocmget, 2679 .tiocmget = mos7840_tiocmget,
2676 .tiocmset = mos7840_tiocmset, 2680 .tiocmset = mos7840_tiocmset,
2681 .get_icount = mos7840_get_icount,
2677 .attach = mos7840_startup, 2682 .attach = mos7840_startup,
2678 .disconnect = mos7840_disconnect, 2683 .disconnect = mos7840_disconnect,
2679 .release = mos7840_release, 2684 .release = mos7840_release,