diff options
author | Alan Cox <alan@linux.intel.com> | 2010-09-16 13:21:40 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:20:04 -0400 |
commit | 0bca1b913affbd7e2fdaffee62a499659a466eb5 (patch) | |
tree | a7e1c20146790345c0cdcadb31b4ff908d1632c2 /drivers/usb/serial/io_edgeport.c | |
parent | d281da7ff6f70efca0553c288bb883e8605b3862 (diff) |
tty: Convert the USB drivers to the new icount interface
Simple pasting job using the new ops function. Also fix a couple of devices
directly returning the internal struct (which happens at this point to match
for the fields that matter but isn't correct or futureproof)
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/io_edgeport.c')
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 76e6fb3aab7a..a0ab78ada25e 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -222,6 +222,8 @@ static void edge_break(struct tty_struct *tty, int break_state); | |||
222 | static int edge_tiocmget(struct tty_struct *tty, struct file *file); | 222 | static int edge_tiocmget(struct tty_struct *tty, struct file *file); |
223 | static int edge_tiocmset(struct tty_struct *tty, struct file *file, | 223 | static int edge_tiocmset(struct tty_struct *tty, struct file *file, |
224 | unsigned int set, unsigned int clear); | 224 | unsigned int set, unsigned int clear); |
225 | static int edge_get_icount(struct tty_struct *tty, | ||
226 | struct serial_icounter_struct *icount); | ||
225 | static int edge_startup(struct usb_serial *serial); | 227 | static int edge_startup(struct usb_serial *serial); |
226 | static void edge_disconnect(struct usb_serial *serial); | 228 | static void edge_disconnect(struct usb_serial *serial); |
227 | static void edge_release(struct usb_serial *serial); | 229 | static void edge_release(struct usb_serial *serial); |
@@ -1624,6 +1626,31 @@ static int edge_tiocmget(struct tty_struct *tty, struct file *file) | |||
1624 | return result; | 1626 | return result; |
1625 | } | 1627 | } |
1626 | 1628 | ||
1629 | static int edge_get_icount(struct tty_struct *tty, | ||
1630 | struct serial_icounter_struct *icount) | ||
1631 | { | ||
1632 | struct usb_serial_port *port = tty->driver_data; | ||
1633 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | ||
1634 | struct async_icount cnow; | ||
1635 | cnow = edge_port->icount; | ||
1636 | |||
1637 | icount->cts = cnow.cts; | ||
1638 | icount->dsr = cnow.dsr; | ||
1639 | icount->rng = cnow.rng; | ||
1640 | icount->dcd = cnow.dcd; | ||
1641 | icount->rx = cnow.rx; | ||
1642 | icount->tx = cnow.tx; | ||
1643 | icount->frame = cnow.frame; | ||
1644 | icount->overrun = cnow.overrun; | ||
1645 | icount->parity = cnow.parity; | ||
1646 | icount->brk = cnow.brk; | ||
1647 | icount->buf_overrun = cnow.buf_overrun; | ||
1648 | |||
1649 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", | ||
1650 | __func__, port->number, icount->rx, icount->tx); | ||
1651 | return 0; | ||
1652 | } | ||
1653 | |||
1627 | static int get_serial_info(struct edgeport_port *edge_port, | 1654 | static int get_serial_info(struct edgeport_port *edge_port, |
1628 | struct serial_struct __user *retinfo) | 1655 | struct serial_struct __user *retinfo) |
1629 | { | 1656 | { |
@@ -1650,7 +1677,6 @@ static int get_serial_info(struct edgeport_port *edge_port, | |||
1650 | } | 1677 | } |
1651 | 1678 | ||
1652 | 1679 | ||
1653 | |||
1654 | /***************************************************************************** | 1680 | /***************************************************************************** |
1655 | * SerialIoctl | 1681 | * SerialIoctl |
1656 | * this function handles any ioctl calls to the driver | 1682 | * this function handles any ioctl calls to the driver |
@@ -1663,7 +1689,6 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file, | |||
1663 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 1689 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
1664 | struct async_icount cnow; | 1690 | struct async_icount cnow; |
1665 | struct async_icount cprev; | 1691 | struct async_icount cprev; |
1666 | struct serial_icounter_struct icount; | ||
1667 | 1692 | ||
1668 | dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); | 1693 | dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); |
1669 | 1694 | ||
@@ -1702,26 +1727,6 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file, | |||
1702 | /* NOTREACHED */ | 1727 | /* NOTREACHED */ |
1703 | break; | 1728 | break; |
1704 | 1729 | ||
1705 | case TIOCGICOUNT: | ||
1706 | cnow = edge_port->icount; | ||
1707 | memset(&icount, 0, sizeof(icount)); | ||
1708 | icount.cts = cnow.cts; | ||
1709 | icount.dsr = cnow.dsr; | ||
1710 | icount.rng = cnow.rng; | ||
1711 | icount.dcd = cnow.dcd; | ||
1712 | icount.rx = cnow.rx; | ||
1713 | icount.tx = cnow.tx; | ||
1714 | icount.frame = cnow.frame; | ||
1715 | icount.overrun = cnow.overrun; | ||
1716 | icount.parity = cnow.parity; | ||
1717 | icount.brk = cnow.brk; | ||
1718 | icount.buf_overrun = cnow.buf_overrun; | ||
1719 | |||
1720 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", | ||
1721 | __func__, port->number, icount.rx, icount.tx); | ||
1722 | if (copy_to_user((void __user *)arg, &icount, sizeof(icount))) | ||
1723 | return -EFAULT; | ||
1724 | return 0; | ||
1725 | } | 1730 | } |
1726 | return -ENOIOCTLCMD; | 1731 | return -ENOIOCTLCMD; |
1727 | } | 1732 | } |