aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-21 07:37:07 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 16:50:53 -0400
commitd36a7712497b547a21bf46c3be517cb06ccb93ee (patch)
tree428c3d53e13db0d53e2d5e80ffb0f808295815d3
parent3018bb51583e8b9f9e76574c71d45e43d8299ebc (diff)
USB: io_edgeport: switch to generic get_icount implementation
Switch to the generic get_icount implementation. Note that the interrupt counters will no longer be reset at open which is in accordance with which how the other drivers work. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/io_edgeport.c45
-rw-r--r--drivers/usb/serial/io_tables.h8
2 files changed, 11 insertions, 42 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index efd8b978128c..16ef8f3714d9 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -111,7 +111,6 @@ struct edgeport_port {
111 wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ 111 wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */
112 wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */ 112 wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */
113 113
114 struct async_icount icount;
115 struct usb_serial_port *port; /* loop back to the owner of this object */ 114 struct usb_serial_port *port; /* loop back to the owner of this object */
116}; 115};
117 116
@@ -215,8 +214,6 @@ static void edge_break(struct tty_struct *tty, int break_state);
215static int edge_tiocmget(struct tty_struct *tty); 214static int edge_tiocmget(struct tty_struct *tty);
216static int edge_tiocmset(struct tty_struct *tty, 215static int edge_tiocmset(struct tty_struct *tty,
217 unsigned int set, unsigned int clear); 216 unsigned int set, unsigned int clear);
218static int edge_get_icount(struct tty_struct *tty,
219 struct serial_icounter_struct *icount);
220static int edge_startup(struct usb_serial *serial); 217static int edge_startup(struct usb_serial *serial);
221static void edge_disconnect(struct usb_serial *serial); 218static void edge_disconnect(struct usb_serial *serial);
222static void edge_release(struct usb_serial *serial); 219static void edge_release(struct usb_serial *serial);
@@ -885,9 +882,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
885 init_waitqueue_head(&edge_port->wait_chase); 882 init_waitqueue_head(&edge_port->wait_chase);
886 init_waitqueue_head(&edge_port->wait_command); 883 init_waitqueue_head(&edge_port->wait_command);
887 884
888 /* initialize our icount structure */
889 memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount));
890
891 /* initialize our port settings */ 885 /* initialize our port settings */
892 edge_port->txCredits = 0; /* Can't send any data yet */ 886 edge_port->txCredits = 0; /* Can't send any data yet */
893 /* Must always set this bit to enable ints! */ 887 /* Must always set this bit to enable ints! */
@@ -1314,7 +1308,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial,
1314 1308
1315 /* decrement the number of credits we have by the number we just sent */ 1309 /* decrement the number of credits we have by the number we just sent */
1316 edge_port->txCredits -= count; 1310 edge_port->txCredits -= count;
1317 edge_port->icount.tx += count; 1311 edge_port->port->icount.tx += count;
1318 1312
1319 status = usb_submit_urb(urb, GFP_ATOMIC); 1313 status = usb_submit_urb(urb, GFP_ATOMIC);
1320 if (status) { 1314 if (status) {
@@ -1326,7 +1320,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial,
1326 1320
1327 /* revert the credits as something bad happened. */ 1321 /* revert the credits as something bad happened. */
1328 edge_port->txCredits += count; 1322 edge_port->txCredits += count;
1329 edge_port->icount.tx -= count; 1323 edge_port->port->icount.tx -= count;
1330 } 1324 }
1331 dev_dbg(dev, "%s wrote %d byte(s) TxCredit %d, Fifo %d\n", 1325 dev_dbg(dev, "%s wrote %d byte(s) TxCredit %d, Fifo %d\n",
1332 __func__, count, edge_port->txCredits, fifo->count); 1326 __func__, count, edge_port->txCredits, fifo->count);
@@ -1588,31 +1582,6 @@ static int edge_tiocmget(struct tty_struct *tty)
1588 return result; 1582 return result;
1589} 1583}
1590 1584
1591static int edge_get_icount(struct tty_struct *tty,
1592 struct serial_icounter_struct *icount)
1593{
1594 struct usb_serial_port *port = tty->driver_data;
1595 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
1596 struct async_icount cnow;
1597 cnow = edge_port->icount;
1598
1599 icount->cts = cnow.cts;
1600 icount->dsr = cnow.dsr;
1601 icount->rng = cnow.rng;
1602 icount->dcd = cnow.dcd;
1603 icount->rx = cnow.rx;
1604 icount->tx = cnow.tx;
1605 icount->frame = cnow.frame;
1606 icount->overrun = cnow.overrun;
1607 icount->parity = cnow.parity;
1608 icount->brk = cnow.brk;
1609 icount->buf_overrun = cnow.buf_overrun;
1610
1611 dev_dbg(&port->dev, "%s (%d) TIOCGICOUNT RX=%d, TX=%d\n", __func__,
1612 port->number, icount->rx, icount->tx);
1613 return 0;
1614}
1615
1616static int get_serial_info(struct edgeport_port *edge_port, 1585static int get_serial_info(struct edgeport_port *edge_port,
1617 struct serial_struct __user *retinfo) 1586 struct serial_struct __user *retinfo)
1618{ 1587{
@@ -1665,7 +1634,7 @@ static int edge_ioctl(struct tty_struct *tty,
1665 1634
1666 case TIOCMIWAIT: 1635 case TIOCMIWAIT:
1667 dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number); 1636 dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number);
1668 cprev = edge_port->icount; 1637 cprev = port->icount;
1669 while (1) { 1638 while (1) {
1670 prepare_to_wait(&port->delta_msr_wait, 1639 prepare_to_wait(&port->delta_msr_wait,
1671 &wait, TASK_INTERRUPTIBLE); 1640 &wait, TASK_INTERRUPTIBLE);
@@ -1678,7 +1647,7 @@ static int edge_ioctl(struct tty_struct *tty,
1678 if (port->serial->disconnected) 1647 if (port->serial->disconnected)
1679 return -EIO; 1648 return -EIO;
1680 1649
1681 cnow = edge_port->icount; 1650 cnow = port->icount;
1682 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && 1651 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
1683 cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) 1652 cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
1684 return -EIO; /* no change => error */ 1653 return -EIO; /* no change => error */
@@ -1866,7 +1835,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
1866 edge_serial->rxPort); 1835 edge_serial->rxPort);
1867 edge_tty_recv(edge_port->port, buffer, 1836 edge_tty_recv(edge_port->port, buffer,
1868 rxLen); 1837 rxLen);
1869 edge_port->icount.rx += rxLen; 1838 edge_port->port->icount.rx += rxLen;
1870 } 1839 }
1871 buffer += rxLen; 1840 buffer += rxLen;
1872 } 1841 }
@@ -2042,7 +2011,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr)
2042 2011
2043 if (newMsr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR | 2012 if (newMsr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR |
2044 EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) { 2013 EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) {
2045 icount = &edge_port->icount; 2014 icount = &edge_port->port->icount;
2046 2015
2047 /* update input line counters */ 2016 /* update input line counters */
2048 if (newMsr & EDGEPORT_MSR_DELTA_CTS) 2017 if (newMsr & EDGEPORT_MSR_DELTA_CTS)
@@ -2088,7 +2057,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
2088 edge_tty_recv(edge_port->port, &data, 1); 2057 edge_tty_recv(edge_port->port, &data, 1);
2089 2058
2090 /* update input line counters */ 2059 /* update input line counters */
2091 icount = &edge_port->icount; 2060 icount = &edge_port->port->icount;
2092 if (newLsr & LSR_BREAK) 2061 if (newLsr & LSR_BREAK)
2093 icount->brk++; 2062 icount->brk++;
2094 if (newLsr & LSR_OVER_ERR) 2063 if (newLsr & LSR_OVER_ERR)
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
index 1511dd0ad324..35fe9ad7d3da 100644
--- a/drivers/usb/serial/io_tables.h
+++ b/drivers/usb/serial/io_tables.h
@@ -116,7 +116,7 @@ static struct usb_serial_driver edgeport_2port_device = {
116 .set_termios = edge_set_termios, 116 .set_termios = edge_set_termios,
117 .tiocmget = edge_tiocmget, 117 .tiocmget = edge_tiocmget,
118 .tiocmset = edge_tiocmset, 118 .tiocmset = edge_tiocmset,
119 .get_icount = edge_get_icount, 119 .get_icount = usb_serial_generic_get_icount,
120 .write = edge_write, 120 .write = edge_write,
121 .write_room = edge_write_room, 121 .write_room = edge_write_room,
122 .chars_in_buffer = edge_chars_in_buffer, 122 .chars_in_buffer = edge_chars_in_buffer,
@@ -147,7 +147,7 @@ static struct usb_serial_driver edgeport_4port_device = {
147 .set_termios = edge_set_termios, 147 .set_termios = edge_set_termios,
148 .tiocmget = edge_tiocmget, 148 .tiocmget = edge_tiocmget,
149 .tiocmset = edge_tiocmset, 149 .tiocmset = edge_tiocmset,
150 .get_icount = edge_get_icount, 150 .get_icount = usb_serial_generic_get_icount,
151 .write = edge_write, 151 .write = edge_write,
152 .write_room = edge_write_room, 152 .write_room = edge_write_room,
153 .chars_in_buffer = edge_chars_in_buffer, 153 .chars_in_buffer = edge_chars_in_buffer,
@@ -178,7 +178,7 @@ static struct usb_serial_driver edgeport_8port_device = {
178 .set_termios = edge_set_termios, 178 .set_termios = edge_set_termios,
179 .tiocmget = edge_tiocmget, 179 .tiocmget = edge_tiocmget,
180 .tiocmset = edge_tiocmset, 180 .tiocmset = edge_tiocmset,
181 .get_icount = edge_get_icount, 181 .get_icount = usb_serial_generic_get_icount,
182 .write = edge_write, 182 .write = edge_write,
183 .write_room = edge_write_room, 183 .write_room = edge_write_room,
184 .chars_in_buffer = edge_chars_in_buffer, 184 .chars_in_buffer = edge_chars_in_buffer,
@@ -209,7 +209,7 @@ static struct usb_serial_driver epic_device = {
209 .set_termios = edge_set_termios, 209 .set_termios = edge_set_termios,
210 .tiocmget = edge_tiocmget, 210 .tiocmget = edge_tiocmget,
211 .tiocmset = edge_tiocmset, 211 .tiocmset = edge_tiocmset,
212 .get_icount = edge_get_icount, 212 .get_icount = usb_serial_generic_get_icount,
213 .write = edge_write, 213 .write = edge_write,
214 .write_room = edge_write_room, 214 .write_room = edge_write_room,
215 .chars_in_buffer = edge_chars_in_buffer, 215 .chars_in_buffer = edge_chars_in_buffer,