aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mos7720.c
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-09-16 13:21:40 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:20:04 -0400
commit0bca1b913affbd7e2fdaffee62a499659a466eb5 (patch)
treea7e1c20146790345c0cdcadb31b4ff908d1632c2 /drivers/usb/serial/mos7720.c
parentd281da7ff6f70efca0553c288bb883e8605b3862 (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/mos7720.c')
-rw-r--r--drivers/usb/serial/mos7720.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index aa665817a272..fd0b6414f459 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1896,10 +1896,37 @@ static int mos7720_tiocmset(struct tty_struct *tty, struct file *file,
1896 return 0; 1896 return 0;
1897} 1897}
1898 1898
1899static int mos7720_get_icount(struct tty_struct *tty,
1900 struct serial_icounter_struct *icount)
1901{
1902 struct usb_serial_port *port = tty->driver_data;
1903 struct moschip_port *mos7720_port;
1904 struct async_icount cnow;
1905
1906 mos7720_port = usb_get_serial_port_data(port);
1907 cnow = mos7720_port->icount;
1908
1909 icount->cts = cnow.cts;
1910 icount->dsr = cnow.dsr;
1911 icount->rng = cnow.rng;
1912 icount->dcd = cnow.dcd;
1913 icount->rx = cnow.rx;
1914 icount->tx = cnow.tx;
1915 icount->frame = cnow.frame;
1916 icount->overrun = cnow.overrun;
1917 icount->parity = cnow.parity;
1918 icount->brk = cnow.brk;
1919 icount->buf_overrun = cnow.buf_overrun;
1920
1921 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
1922 port->number, icount->rx, icount->tx);
1923 return 0;
1924}
1925
1899static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd, 1926static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd,
1900 unsigned int __user *value) 1927 unsigned int __user *value)
1901{ 1928{
1902 unsigned int mcr ; 1929 unsigned int mcr;
1903 unsigned int arg; 1930 unsigned int arg;
1904 1931
1905 struct usb_serial_port *port; 1932 struct usb_serial_port *port;
@@ -1973,7 +2000,6 @@ static int mos7720_ioctl(struct tty_struct *tty, struct file *file,
1973 struct moschip_port *mos7720_port; 2000 struct moschip_port *mos7720_port;
1974 struct async_icount cnow; 2001 struct async_icount cnow;
1975 struct async_icount cprev; 2002 struct async_icount cprev;
1976 struct serial_icounter_struct icount;
1977 2003
1978 mos7720_port = usb_get_serial_port_data(port); 2004 mos7720_port = usb_get_serial_port_data(port);
1979 if (mos7720_port == NULL) 2005 if (mos7720_port == NULL)
@@ -2021,29 +2047,6 @@ static int mos7720_ioctl(struct tty_struct *tty, struct file *file,
2021 } 2047 }
2022 /* NOTREACHED */ 2048 /* NOTREACHED */
2023 break; 2049 break;
2024
2025 case TIOCGICOUNT:
2026 cnow = mos7720_port->icount;
2027
2028 memset(&icount, 0, sizeof(struct serial_icounter_struct));
2029
2030 icount.cts = cnow.cts;
2031 icount.dsr = cnow.dsr;
2032 icount.rng = cnow.rng;
2033 icount.dcd = cnow.dcd;
2034 icount.rx = cnow.rx;
2035 icount.tx = cnow.tx;
2036 icount.frame = cnow.frame;
2037 icount.overrun = cnow.overrun;
2038 icount.parity = cnow.parity;
2039 icount.brk = cnow.brk;
2040 icount.buf_overrun = cnow.buf_overrun;
2041
2042 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
2043 port->number, icount.rx, icount.tx);
2044 if (copy_to_user((void __user *)arg, &icount, sizeof(icount)))
2045 return -EFAULT;
2046 return 0;
2047 } 2050 }
2048 2051
2049 return -ENOIOCTLCMD; 2052 return -ENOIOCTLCMD;
@@ -2212,6 +2215,7 @@ static struct usb_serial_driver moschip7720_2port_driver = {
2212 .ioctl = mos7720_ioctl, 2215 .ioctl = mos7720_ioctl,
2213 .tiocmget = mos7720_tiocmget, 2216 .tiocmget = mos7720_tiocmget,
2214 .tiocmset = mos7720_tiocmset, 2217 .tiocmset = mos7720_tiocmset,
2218 .get_icount = mos7720_get_icount,
2215 .set_termios = mos7720_set_termios, 2219 .set_termios = mos7720_set_termios,
2216 .write = mos7720_write, 2220 .write = mos7720_write,
2217 .write_room = mos7720_write_room, 2221 .write_room = mos7720_write_room,