aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mct_u232.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-10-13 05:39:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:41 -0400
commit4a90f09b20f4622dcbff1f0e1e6bae1704f8ad8c (patch)
tree9b275f88f2705cb10121d5982741aef3a088a7c8 /drivers/usb/serial/mct_u232.c
parent95f9bfc6b76e862265a2d70ae061eec18fe14140 (diff)
tty: usb-serial krefs
Use kref in the USB serial drivers so that we don't free tty structures from under the URB receive handlers as has historically been the case if you were unlucky. This also gives us a framework for general tty drivers to use tty_port objects and refcount. Contains two err->dev_err changes merged together to fix clashes in the -next tree. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/serial/mct_u232.c')
-rw-r--r--drivers/usb/serial/mct_u232.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 0ded8bd6ec85..9b2cef81cde0 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -563,10 +563,11 @@ static void mct_u232_read_int_callback(struct urb *urb)
563 * Work-a-round: handle the 'usual' bulk-in pipe here 563 * Work-a-round: handle the 'usual' bulk-in pipe here
564 */ 564 */
565 if (urb->transfer_buffer_length > 2) { 565 if (urb->transfer_buffer_length > 2) {
566 tty = port->port.tty; 566 tty = tty_port_tty_get(&port->port);
567 if (urb->actual_length) { 567 if (urb->actual_length) {
568 tty_insert_flip_string(tty, data, urb->actual_length); 568 tty_insert_flip_string(tty, data, urb->actual_length);
569 tty_flip_buffer_push(tty); 569 tty_flip_buffer_push(tty);
570 tty_kref_put(tty);
570 } 571 }
571 goto exit; 572 goto exit;
572 } 573 }
@@ -591,7 +592,7 @@ static void mct_u232_read_int_callback(struct urb *urb)
591 * to look in to this before committing any code. 592 * to look in to this before committing any code.
592 */ 593 */
593 if (priv->last_lsr & MCT_U232_LSR_ERR) { 594 if (priv->last_lsr & MCT_U232_LSR_ERR) {
594 tty = port->port.tty; 595 tty = tty_port_tty_get(&port->port);
595 /* Overrun Error */ 596 /* Overrun Error */
596 if (priv->last_lsr & MCT_U232_LSR_OE) { 597 if (priv->last_lsr & MCT_U232_LSR_OE) {
597 } 598 }
@@ -604,6 +605,7 @@ static void mct_u232_read_int_callback(struct urb *urb)
604 /* Break Indicator */ 605 /* Break Indicator */
605 if (priv->last_lsr & MCT_U232_LSR_BI) { 606 if (priv->last_lsr & MCT_U232_LSR_BI) {
606 } 607 }
608 tty_kref_put(tty);
607 } 609 }
608#endif 610#endif
609 spin_unlock_irqrestore(&priv->lock, flags); 611 spin_unlock_irqrestore(&priv->lock, flags);