aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/io_edgeport.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/io_edgeport.c')
-rw-r--r--drivers/usb/serial/io_edgeport.c45
1 files changed, 7 insertions, 38 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)