diff options
Diffstat (limited to 'drivers/usb/serial/digi_acceleport.c')
-rw-r--r-- | drivers/usb/serial/digi_acceleport.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 240aad1acaab..5756ac6d6c92 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -604,7 +604,9 @@ static void digi_wakeup_write_lock(struct work_struct *work) | |||
604 | 604 | ||
605 | static void digi_wakeup_write(struct usb_serial_port *port) | 605 | static void digi_wakeup_write(struct usb_serial_port *port) |
606 | { | 606 | { |
607 | tty_wakeup(port->port.tty); | 607 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
608 | tty_wakeup(tty); | ||
609 | tty_kref_put(tty); | ||
608 | } | 610 | } |
609 | 611 | ||
610 | 612 | ||
@@ -1668,7 +1670,7 @@ static int digi_read_inb_callback(struct urb *urb) | |||
1668 | { | 1670 | { |
1669 | 1671 | ||
1670 | struct usb_serial_port *port = urb->context; | 1672 | struct usb_serial_port *port = urb->context; |
1671 | struct tty_struct *tty = port->port.tty; | 1673 | struct tty_struct *tty; |
1672 | struct digi_port *priv = usb_get_serial_port_data(port); | 1674 | struct digi_port *priv = usb_get_serial_port_data(port); |
1673 | int opcode = ((unsigned char *)urb->transfer_buffer)[0]; | 1675 | int opcode = ((unsigned char *)urb->transfer_buffer)[0]; |
1674 | int len = ((unsigned char *)urb->transfer_buffer)[1]; | 1676 | int len = ((unsigned char *)urb->transfer_buffer)[1]; |
@@ -1692,6 +1694,7 @@ static int digi_read_inb_callback(struct urb *urb) | |||
1692 | return -1; | 1694 | return -1; |
1693 | } | 1695 | } |
1694 | 1696 | ||
1697 | tty = tty_port_tty_get(&port->port); | ||
1695 | spin_lock(&priv->dp_port_lock); | 1698 | spin_lock(&priv->dp_port_lock); |
1696 | 1699 | ||
1697 | /* check for throttle; if set, do not resubmit read urb */ | 1700 | /* check for throttle; if set, do not resubmit read urb */ |
@@ -1735,6 +1738,7 @@ static int digi_read_inb_callback(struct urb *urb) | |||
1735 | } | 1738 | } |
1736 | } | 1739 | } |
1737 | spin_unlock(&priv->dp_port_lock); | 1740 | spin_unlock(&priv->dp_port_lock); |
1741 | tty_kref_put(tty); | ||
1738 | 1742 | ||
1739 | if (opcode == DIGI_CMD_RECEIVE_DISABLE) | 1743 | if (opcode == DIGI_CMD_RECEIVE_DISABLE) |
1740 | dbg("%s: got RECEIVE_DISABLE", __func__); | 1744 | dbg("%s: got RECEIVE_DISABLE", __func__); |
@@ -1760,6 +1764,7 @@ static int digi_read_oob_callback(struct urb *urb) | |||
1760 | 1764 | ||
1761 | struct usb_serial_port *port = urb->context; | 1765 | struct usb_serial_port *port = urb->context; |
1762 | struct usb_serial *serial = port->serial; | 1766 | struct usb_serial *serial = port->serial; |
1767 | struct tty_struct *tty; | ||
1763 | struct digi_port *priv = usb_get_serial_port_data(port); | 1768 | struct digi_port *priv = usb_get_serial_port_data(port); |
1764 | int opcode, line, status, val; | 1769 | int opcode, line, status, val; |
1765 | int i; | 1770 | int i; |
@@ -1787,10 +1792,11 @@ static int digi_read_oob_callback(struct urb *urb) | |||
1787 | if (priv == NULL) | 1792 | if (priv == NULL) |
1788 | return -1; | 1793 | return -1; |
1789 | 1794 | ||
1795 | tty = tty_port_tty_get(&port->port); | ||
1790 | rts = 0; | 1796 | rts = 0; |
1791 | if (port->port.count) | 1797 | if (port->port.count) |
1792 | rts = port->port.tty->termios->c_cflag & CRTSCTS; | 1798 | rts = tty->termios->c_cflag & CRTSCTS; |
1793 | 1799 | ||
1794 | if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) { | 1800 | if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) { |
1795 | spin_lock(&priv->dp_port_lock); | 1801 | spin_lock(&priv->dp_port_lock); |
1796 | /* convert from digi flags to termiox flags */ | 1802 | /* convert from digi flags to termiox flags */ |
@@ -1798,14 +1804,14 @@ static int digi_read_oob_callback(struct urb *urb) | |||
1798 | priv->dp_modem_signals |= TIOCM_CTS; | 1804 | priv->dp_modem_signals |= TIOCM_CTS; |
1799 | /* port must be open to use tty struct */ | 1805 | /* port must be open to use tty struct */ |
1800 | if (rts) { | 1806 | if (rts) { |
1801 | port->port.tty->hw_stopped = 0; | 1807 | tty->hw_stopped = 0; |
1802 | digi_wakeup_write(port); | 1808 | digi_wakeup_write(port); |
1803 | } | 1809 | } |
1804 | } else { | 1810 | } else { |
1805 | priv->dp_modem_signals &= ~TIOCM_CTS; | 1811 | priv->dp_modem_signals &= ~TIOCM_CTS; |
1806 | /* port must be open to use tty struct */ | 1812 | /* port must be open to use tty struct */ |
1807 | if (rts) | 1813 | if (rts) |
1808 | port->port.tty->hw_stopped = 1; | 1814 | tty->hw_stopped = 1; |
1809 | } | 1815 | } |
1810 | if (val & DIGI_READ_INPUT_SIGNALS_DSR) | 1816 | if (val & DIGI_READ_INPUT_SIGNALS_DSR) |
1811 | priv->dp_modem_signals |= TIOCM_DSR; | 1817 | priv->dp_modem_signals |= TIOCM_DSR; |
@@ -1830,6 +1836,7 @@ static int digi_read_oob_callback(struct urb *urb) | |||
1830 | } else if (opcode == DIGI_CMD_IFLUSH_FIFO) { | 1836 | } else if (opcode == DIGI_CMD_IFLUSH_FIFO) { |
1831 | wake_up_interruptible(&priv->dp_flush_wait); | 1837 | wake_up_interruptible(&priv->dp_flush_wait); |
1832 | } | 1838 | } |
1839 | tty_kref_put(tty); | ||
1833 | } | 1840 | } |
1834 | return 0; | 1841 | return 0; |
1835 | 1842 | ||