aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mos7840.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2007-07-09 15:03:10 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-12 19:34:41 -0400
commit31473aae5afb11f0c5217dafdbc9df8a470071aa (patch)
tree13d533cf73884c41ea7258b6d4a213d4d2aef2c2 /drivers/usb/serial/mos7840.c
parent70f458f668aa09cc45384728dec434f2975a3947 (diff)
USB: mos7840.c: turn this into a serial driver
The MOS driver is "interesting", in a bad kind of 'how the hell did this get merged' kind of way - Remove the bogus termios change check - Remove the duplicate code for half the ioctls - Remove the supporting code to duplicate the ioctl code Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r--drivers/usb/serial/mos7840.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index a6678826452f..37f41f576d3d 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2189,16 +2189,6 @@ static void mos7840_set_termios(struct usb_serial_port *port,
2189 return; 2189 return;
2190 } 2190 }
2191 2191
2192 /* check that they really want us to change something */
2193 if (old_termios) {
2194 if ((cflag == old_termios->c_cflag) &&
2195 (RELEVANT_IFLAG(tty->termios->c_iflag) ==
2196 RELEVANT_IFLAG(old_termios->c_iflag))) {
2197 dbg("%s\n", "Nothing to change");
2198 return;
2199 }
2200 }
2201
2202 dbg("%s - clfag %08x iflag %08x", __FUNCTION__, 2192 dbg("%s - clfag %08x iflag %08x", __FUNCTION__,
2203 tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); 2193 tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag));
2204 2194
@@ -2258,30 +2248,6 @@ static int mos7840_get_lsr_info(struct moschip_port *mos7840_port,
2258} 2248}
2259 2249
2260/***************************************************************************** 2250/*****************************************************************************
2261 * mos7840_get_bytes_avail - get number of bytes available
2262 *
2263 * Purpose: Let user call ioctl to get the count of number of bytes available.
2264 *****************************************************************************/
2265
2266static int mos7840_get_bytes_avail(struct moschip_port *mos7840_port,
2267 unsigned int __user *value)
2268{
2269 unsigned int result = 0;
2270 struct tty_struct *tty = mos7840_port->port->tty;
2271
2272 if (!tty)
2273 return -ENOIOCTLCMD;
2274
2275 result = tty->read_cnt;
2276
2277 dbg("%s(%d) = %d", __FUNCTION__, mos7840_port->port->number, result);
2278 if (copy_to_user(value, &result, sizeof(int)))
2279 return -EFAULT;
2280
2281 return -ENOIOCTLCMD;
2282}
2283
2284/*****************************************************************************
2285 * mos7840_set_modem_info 2251 * mos7840_set_modem_info
2286 * function to set modem info 2252 * function to set modem info
2287 *****************************************************************************/ 2253 *****************************************************************************/
@@ -2429,8 +2395,6 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file,
2429 struct async_icount cprev; 2395 struct async_icount cprev;
2430 struct serial_icounter_struct icount; 2396 struct serial_icounter_struct icount;
2431 int mosret = 0; 2397 int mosret = 0;
2432 int retval;
2433 struct tty_ldisc *ld;
2434 2398
2435 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 2399 if (mos7840_port_paranoia_check(port, __FUNCTION__)) {
2436 dbg("%s", "Invalid port \n"); 2400 dbg("%s", "Invalid port \n");
@@ -2449,42 +2413,6 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file,
2449 switch (cmd) { 2413 switch (cmd) {
2450 /* return number of bytes available */ 2414 /* return number of bytes available */
2451 2415
2452 case TIOCINQ:
2453 dbg("%s (%d) TIOCINQ", __FUNCTION__, port->number);
2454 return mos7840_get_bytes_avail(mos7840_port, argp);
2455
2456 case TIOCOUTQ:
2457 dbg("%s (%d) TIOCOUTQ", __FUNCTION__, port->number);
2458 return put_user(tty->driver->chars_in_buffer ?
2459 tty->driver->chars_in_buffer(tty) : 0,
2460 (int __user *)arg);
2461
2462 case TCFLSH:
2463 retval = tty_check_change(tty);
2464 if (retval)
2465 return retval;
2466
2467 ld = tty_ldisc_ref(tty);
2468 switch (arg) {
2469 case TCIFLUSH:
2470 if (ld && ld->flush_buffer)
2471 ld->flush_buffer(tty);
2472 break;
2473 case TCIOFLUSH:
2474 if (ld && ld->flush_buffer)
2475 ld->flush_buffer(tty);
2476 /* fall through */
2477 case TCOFLUSH:
2478 if (tty->driver->flush_buffer)
2479 tty->driver->flush_buffer(tty);
2480 break;
2481 default:
2482 tty_ldisc_deref(ld);
2483 return -EINVAL;
2484 }
2485 tty_ldisc_deref(ld);
2486 return 0;
2487
2488 case TIOCSERGETLSR: 2416 case TIOCSERGETLSR:
2489 dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number); 2417 dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number);
2490 return mos7840_get_lsr_info(mos7840_port, argp); 2418 return mos7840_get_lsr_info(mos7840_port, argp);