mos7840.c (fa251f89903d73989e2f63e13d0eaed1e07ce0da) mos7840.c (0bca1b913affbd7e2fdaffee62a499659a466eb5)
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of

--- 2195 unchanged lines hidden (view full) ---

2204 tmp.close_delay = 5 * HZ;
2205 tmp.closing_wait = 30 * HZ;
2206
2207 if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
2208 return -EFAULT;
2209 return 0;
2210}
2211
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of

--- 2195 unchanged lines hidden (view full) ---

2204 tmp.close_delay = 5 * HZ;
2205 tmp.closing_wait = 30 * HZ;
2206
2207 if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
2208 return -EFAULT;
2209 return 0;
2210}
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/*****************************************************************************
2213 * SerialIoctl
2214 * this function handles any ioctl calls to the driver
2215 *****************************************************************************/
2216
2217static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
2218 unsigned int cmd, unsigned long arg)
2219{
2220 struct usb_serial_port *port = tty->driver_data;
2221 void __user *argp = (void __user *)arg;
2222 struct moschip_port *mos7840_port;
2223
2224 struct async_icount cnow;
2225 struct async_icount cprev;
2240/*****************************************************************************
2241 * SerialIoctl
2242 * this function handles any ioctl calls to the driver
2243 *****************************************************************************/
2244
2245static int mos7840_ioctl(struct tty_struct *tty, struct file *file,
2246 unsigned int cmd, unsigned long arg)
2247{
2248 struct usb_serial_port *port = tty->driver_data;
2249 void __user *argp = (void __user *)arg;
2250 struct moschip_port *mos7840_port;
2251
2252 struct async_icount cnow;
2253 struct async_icount cprev;
2226 struct serial_icounter_struct icount;
2227
2228 if (mos7840_port_paranoia_check(port, __func__)) {
2229 dbg("%s", "Invalid port");
2230 return -1;
2231 }
2232
2233 mos7840_port = mos7840_get_port_private(port);
2234

--- 42 unchanged lines hidden (view full) ---

2277 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
2278 return 0;
2279 }
2280 cprev = cnow;
2281 }
2282 /* NOTREACHED */
2283 break;
2284
2254
2255 if (mos7840_port_paranoia_check(port, __func__)) {
2256 dbg("%s", "Invalid port");
2257 return -1;
2258 }
2259
2260 mos7840_port = mos7840_get_port_private(port);
2261

--- 42 unchanged lines hidden (view full) ---

2304 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
2305 return 0;
2306 }
2307 cprev = cnow;
2308 }
2309 /* NOTREACHED */
2310 break;
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:
2309 break;
2310 }
2311 return -ENOIOCTLCMD;
2312}
2313
2314static int mos7840_calc_num_ports(struct usb_serial *serial)
2315{

--- 353 unchanged lines hidden (view full) ---

2669#ifdef MCSSerialProbe
2670 .probe = mos7840_serial_probe,
2671#endif
2672 .ioctl = mos7840_ioctl,
2673 .set_termios = mos7840_set_termios,
2674 .break_ctl = mos7840_break,
2675 .tiocmget = mos7840_tiocmget,
2676 .tiocmset = mos7840_tiocmset,
2312 default:
2313 break;
2314 }
2315 return -ENOIOCTLCMD;
2316}
2317
2318static int mos7840_calc_num_ports(struct usb_serial *serial)
2319{

--- 353 unchanged lines hidden (view full) ---

2673#ifdef MCSSerialProbe
2674 .probe = mos7840_serial_probe,
2675#endif
2676 .ioctl = mos7840_ioctl,
2677 .set_termios = mos7840_set_termios,
2678 .break_ctl = mos7840_break,
2679 .tiocmget = mos7840_tiocmget,
2680 .tiocmset = mos7840_tiocmset,
2681 .get_icount = mos7840_get_icount,
2677 .attach = mos7840_startup,
2678 .disconnect = mos7840_disconnect,
2679 .release = mos7840_release,
2680 .read_bulk_callback = mos7840_bulk_in_callback,
2681 .read_int_callback = mos7840_interrupt_callback,
2682};
2683
2684/****************************************************************************

--- 55 unchanged lines hidden ---
2682 .attach = mos7840_startup,
2683 .disconnect = mos7840_disconnect,
2684 .release = mos7840_release,
2685 .read_bulk_callback = mos7840_bulk_in_callback,
2686 .read_int_callback = mos7840_interrupt_callback,
2687};
2688
2689/****************************************************************************

--- 55 unchanged lines hidden ---