aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-21 07:37:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 16:50:53 -0400
commit468c740ee5372b74e9d9bd4d7ec2d81d44e67f2d (patch)
tree2d5dca978432ef03f90f839e697b4bc8cad47e68
parent09b0e3957549e7036a66e4597a7167e43861cfd6 (diff)
USB: mct_u232: switch to generic get_icount implementation
Switch to the generic get_icount implementation. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/mct_u232.c40
1 files changed, 4 insertions, 36 deletions
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 06d5a60be2c4..6f4303cef0d8 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -59,8 +59,6 @@ static int mct_u232_tiocmset(struct tty_struct *tty,
59 unsigned int set, unsigned int clear); 59 unsigned int set, unsigned int clear);
60static int mct_u232_ioctl(struct tty_struct *tty, 60static int mct_u232_ioctl(struct tty_struct *tty,
61 unsigned int cmd, unsigned long arg); 61 unsigned int cmd, unsigned long arg);
62static int mct_u232_get_icount(struct tty_struct *tty,
63 struct serial_icounter_struct *icount);
64static void mct_u232_throttle(struct tty_struct *tty); 62static void mct_u232_throttle(struct tty_struct *tty);
65static void mct_u232_unthrottle(struct tty_struct *tty); 63static void mct_u232_unthrottle(struct tty_struct *tty);
66 64
@@ -99,7 +97,7 @@ static struct usb_serial_driver mct_u232_device = {
99 .port_probe = mct_u232_port_probe, 97 .port_probe = mct_u232_port_probe,
100 .port_remove = mct_u232_port_remove, 98 .port_remove = mct_u232_port_remove,
101 .ioctl = mct_u232_ioctl, 99 .ioctl = mct_u232_ioctl,
102 .get_icount = mct_u232_get_icount, 100 .get_icount = usb_serial_generic_get_icount,
103}; 101};
104 102
105static struct usb_serial_driver * const serial_drivers[] = { 103static struct usb_serial_driver * const serial_drivers[] = {
@@ -113,7 +111,6 @@ struct mct_u232_private {
113 unsigned char last_lsr; /* Line Status Register */ 111 unsigned char last_lsr; /* Line Status Register */
114 unsigned char last_msr; /* Modem Status Register */ 112 unsigned char last_msr; /* Modem Status Register */
115 unsigned int rx_flags; /* Throttling flags */ 113 unsigned int rx_flags; /* Throttling flags */
116 struct async_icount icount;
117}; 114};
118 115
119#define THROTTLED 0x01 116#define THROTTLED 0x01
@@ -570,7 +567,7 @@ static void mct_u232_read_int_callback(struct urb *urb)
570 /* Record Control Line states */ 567 /* Record Control Line states */
571 mct_u232_msr_to_state(port, &priv->control_state, priv->last_msr); 568 mct_u232_msr_to_state(port, &priv->control_state, priv->last_msr);
572 569
573 mct_u232_msr_to_icount(&priv->icount, priv->last_msr); 570 mct_u232_msr_to_icount(&port->icount, priv->last_msr);
574 571
575#if 0 572#if 0
576 /* Not yet handled. See belkin_sa.c for further information */ 573 /* Not yet handled. See belkin_sa.c for further information */
@@ -804,7 +801,7 @@ static int mct_u232_ioctl(struct tty_struct *tty,
804 dev_dbg(&port->dev, "%s TIOCMIWAIT", __func__); 801 dev_dbg(&port->dev, "%s TIOCMIWAIT", __func__);
805 802
806 spin_lock_irqsave(&mct_u232_port->lock, flags); 803 spin_lock_irqsave(&mct_u232_port->lock, flags);
807 cprev = mct_u232_port->icount; 804 cprev = port->icount;
808 spin_unlock_irqrestore(&mct_u232_port->lock, flags); 805 spin_unlock_irqrestore(&mct_u232_port->lock, flags);
809 for ( ; ; ) { 806 for ( ; ; ) {
810 prepare_to_wait(&port->delta_msr_wait, 807 prepare_to_wait(&port->delta_msr_wait,
@@ -819,7 +816,7 @@ static int mct_u232_ioctl(struct tty_struct *tty,
819 return -EIO; 816 return -EIO;
820 817
821 spin_lock_irqsave(&mct_u232_port->lock, flags); 818 spin_lock_irqsave(&mct_u232_port->lock, flags);
822 cnow = mct_u232_port->icount; 819 cnow = port->icount;
823 spin_unlock_irqrestore(&mct_u232_port->lock, flags); 820 spin_unlock_irqrestore(&mct_u232_port->lock, flags);
824 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && 821 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
825 cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) 822 cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
@@ -837,35 +834,6 @@ static int mct_u232_ioctl(struct tty_struct *tty,
837 return -ENOIOCTLCMD; 834 return -ENOIOCTLCMD;
838} 835}
839 836
840static int mct_u232_get_icount(struct tty_struct *tty,
841 struct serial_icounter_struct *icount)
842{
843 struct usb_serial_port *port = tty->driver_data;
844 struct mct_u232_private *mct_u232_port = usb_get_serial_port_data(port);
845 struct async_icount *ic = &mct_u232_port->icount;
846 unsigned long flags;
847
848 spin_lock_irqsave(&mct_u232_port->lock, flags);
849
850 icount->cts = ic->cts;
851 icount->dsr = ic->dsr;
852 icount->rng = ic->rng;
853 icount->dcd = ic->dcd;
854 icount->rx = ic->rx;
855 icount->tx = ic->tx;
856 icount->frame = ic->frame;
857 icount->overrun = ic->overrun;
858 icount->parity = ic->parity;
859 icount->brk = ic->brk;
860 icount->buf_overrun = ic->buf_overrun;
861
862 spin_unlock_irqrestore(&mct_u232_port->lock, flags);
863
864 dev_dbg(&port->dev, "%s TIOCGICOUNT RX=%d, TX=%d\n",
865 __func__, icount->rx, icount->tx);
866 return 0;
867}
868
869module_usb_serial_driver(serial_drivers, id_table); 837module_usb_serial_driver(serial_drivers, id_table);
870 838
871MODULE_AUTHOR(DRIVER_AUTHOR); 839MODULE_AUTHOR(DRIVER_AUTHOR);