aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/digi_acceleport.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/digi_acceleport.c')
-rw-r--r--drivers/usb/serial/digi_acceleport.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index d67d397b1b88..976f54ec26e6 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -1324,19 +1324,21 @@ static void digi_write_bulk_callback( struct urb *urb )
1324 struct digi_port *priv; 1324 struct digi_port *priv;
1325 struct digi_serial *serial_priv; 1325 struct digi_serial *serial_priv;
1326 int ret = 0; 1326 int ret = 0;
1327 int status = urb->status;
1327 1328
1328 1329
1329dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status ); 1330 dbg("digi_write_bulk_callback: TOP, urb status=%d", status);
1330 1331
1331 /* port and serial sanity check */ 1332 /* port and serial sanity check */
1332 if( port == NULL || (priv=usb_get_serial_port_data(port)) == NULL ) { 1333 if( port == NULL || (priv=usb_get_serial_port_data(port)) == NULL ) {
1333 err("%s: port or port->private is NULL, status=%d", __FUNCTION__, 1334 err("%s: port or port->private is NULL, status=%d",
1334 urb->status ); 1335 __FUNCTION__, status);
1335 return; 1336 return;
1336 } 1337 }
1337 serial = port->serial; 1338 serial = port->serial;
1338 if( serial == NULL || (serial_priv=usb_get_serial_data(serial)) == NULL ) { 1339 if( serial == NULL || (serial_priv=usb_get_serial_data(serial)) == NULL ) {
1339 err("%s: serial or serial->private is NULL, status=%d", __FUNCTION__, urb->status ); 1340 err("%s: serial or serial->private is NULL, status=%d",
1341 __FUNCTION__, status);
1340 return; 1342 return;
1341 } 1343 }
1342 1344
@@ -1740,25 +1742,28 @@ static void digi_read_bulk_callback( struct urb *urb )
1740 struct digi_port *priv; 1742 struct digi_port *priv;
1741 struct digi_serial *serial_priv; 1743 struct digi_serial *serial_priv;
1742 int ret; 1744 int ret;
1745 int status = urb->status;
1743 1746
1744 1747
1745dbg( "digi_read_bulk_callback: TOP" ); 1748dbg( "digi_read_bulk_callback: TOP" );
1746 1749
1747 /* port sanity check, do not resubmit if port is not valid */ 1750 /* port sanity check, do not resubmit if port is not valid */
1748 if( port == NULL || (priv=usb_get_serial_port_data(port)) == NULL ) { 1751 if( port == NULL || (priv=usb_get_serial_port_data(port)) == NULL ) {
1749 err("%s: port or port->private is NULL, status=%d", __FUNCTION__, 1752 err("%s: port or port->private is NULL, status=%d",
1750 urb->status ); 1753 __FUNCTION__, status);
1751 return; 1754 return;
1752 } 1755 }
1753 if( port->serial == NULL 1756 if( port->serial == NULL
1754 || (serial_priv=usb_get_serial_data(port->serial)) == NULL ) { 1757 || (serial_priv=usb_get_serial_data(port->serial)) == NULL ) {
1755 err("%s: serial is bad or serial->private is NULL, status=%d", __FUNCTION__, urb->status ); 1758 err("%s: serial is bad or serial->private is NULL, status=%d",
1759 __FUNCTION__, status);
1756 return; 1760 return;
1757 } 1761 }
1758 1762
1759 /* do not resubmit urb if it has any status error */ 1763 /* do not resubmit urb if it has any status error */
1760 if( urb->status ) { 1764 if (status) {
1761 err("%s: nonzero read bulk status: status=%d, port=%d", __FUNCTION__, urb->status, priv->dp_port_num ); 1765 err("%s: nonzero read bulk status: status=%d, port=%d",
1766 __FUNCTION__, status, priv->dp_port_num);
1762 return; 1767 return;
1763 } 1768 }
1764 1769
@@ -1799,10 +1804,11 @@ static int digi_read_inb_callback( struct urb *urb )
1799 struct digi_port *priv = usb_get_serial_port_data(port); 1804 struct digi_port *priv = usb_get_serial_port_data(port);
1800 int opcode = ((unsigned char *)urb->transfer_buffer)[0]; 1805 int opcode = ((unsigned char *)urb->transfer_buffer)[0];
1801 int len = ((unsigned char *)urb->transfer_buffer)[1]; 1806 int len = ((unsigned char *)urb->transfer_buffer)[1];
1802 int status = ((unsigned char *)urb->transfer_buffer)[2]; 1807 int port_status = ((unsigned char *)urb->transfer_buffer)[2];
1803 unsigned char *data = ((unsigned char *)urb->transfer_buffer)+3; 1808 unsigned char *data = ((unsigned char *)urb->transfer_buffer)+3;
1804 int flag,throttled; 1809 int flag,throttled;
1805 int i; 1810 int i;
1811 int status = urb->status;
1806 1812
1807 /* do not process callbacks on closed ports */ 1813 /* do not process callbacks on closed ports */
1808 /* but do continue the read chain */ 1814 /* but do continue the read chain */
@@ -1811,7 +1817,10 @@ static int digi_read_inb_callback( struct urb *urb )
1811 1817
1812 /* short/multiple packet check */ 1818 /* short/multiple packet check */
1813 if( urb->actual_length != len + 2 ) { 1819 if( urb->actual_length != len + 2 ) {
1814 err("%s: INCOMPLETE OR MULTIPLE PACKET, urb->status=%d, port=%d, opcode=%d, len=%d, actual_length=%d, status=%d", __FUNCTION__, urb->status, priv->dp_port_num, opcode, len, urb->actual_length, status ); 1820 err("%s: INCOMPLETE OR MULTIPLE PACKET, urb status=%d, "
1821 "port=%d, opcode=%d, len=%d, actual_length=%d, "
1822 "port_status=%d", __FUNCTION__, status, priv->dp_port_num,
1823 opcode, len, urb->actual_length, port_status);
1815 return( -1 ); 1824 return( -1 );
1816 } 1825 }
1817 1826
@@ -1826,25 +1835,25 @@ static int digi_read_inb_callback( struct urb *urb )
1826 /* receive data */ 1835 /* receive data */
1827 if( opcode == DIGI_CMD_RECEIVE_DATA ) { 1836 if( opcode == DIGI_CMD_RECEIVE_DATA ) {
1828 1837
1829 /* get flag from status */ 1838 /* get flag from port_status */
1830 flag = 0; 1839 flag = 0;
1831 1840
1832 /* overrun is special, not associated with a char */ 1841 /* overrun is special, not associated with a char */
1833 if( status & DIGI_OVERRUN_ERROR ) { 1842 if (port_status & DIGI_OVERRUN_ERROR) {
1834 tty_insert_flip_char( tty, 0, TTY_OVERRUN ); 1843 tty_insert_flip_char( tty, 0, TTY_OVERRUN );
1835 } 1844 }
1836 1845
1837 /* break takes precedence over parity, */ 1846 /* break takes precedence over parity, */
1838 /* which takes precedence over framing errors */ 1847 /* which takes precedence over framing errors */
1839 if( status & DIGI_BREAK_ERROR ) { 1848 if (port_status & DIGI_BREAK_ERROR) {
1840 flag = TTY_BREAK; 1849 flag = TTY_BREAK;
1841 } else if( status & DIGI_PARITY_ERROR ) { 1850 } else if (port_status & DIGI_PARITY_ERROR) {
1842 flag = TTY_PARITY; 1851 flag = TTY_PARITY;
1843 } else if( status & DIGI_FRAMING_ERROR ) { 1852 } else if (port_status & DIGI_FRAMING_ERROR) {
1844 flag = TTY_FRAME; 1853 flag = TTY_FRAME;
1845 } 1854 }
1846 1855
1847 /* data length is len-1 (one byte of len is status) */ 1856 /* data length is len-1 (one byte of len is port_status) */
1848 --len; 1857 --len;
1849 1858
1850 len = tty_buffer_request_room(tty, len); 1859 len = tty_buffer_request_room(tty, len);