diff options
author | Alan Cox <alan@redhat.com> | 2008-10-13 05:39:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:41 -0400 |
commit | 4a90f09b20f4622dcbff1f0e1e6bae1704f8ad8c (patch) | |
tree | 9b275f88f2705cb10121d5982741aef3a088a7c8 /drivers/usb/serial/whiteheat.c | |
parent | 95f9bfc6b76e862265a2d70ae061eec18fe14140 (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/whiteheat.c')
-rw-r--r-- | drivers/usb/serial/whiteheat.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 3a9d14384a43..11c8b97a5177 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -1481,7 +1481,7 @@ static void rx_data_softint(struct work_struct *work) | |||
1481 | struct whiteheat_private *info = | 1481 | struct whiteheat_private *info = |
1482 | container_of(work, struct whiteheat_private, rx_work); | 1482 | container_of(work, struct whiteheat_private, rx_work); |
1483 | struct usb_serial_port *port = info->port; | 1483 | struct usb_serial_port *port = info->port; |
1484 | struct tty_struct *tty = port->port.tty; | 1484 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
1485 | struct whiteheat_urb_wrap *wrap; | 1485 | struct whiteheat_urb_wrap *wrap; |
1486 | struct urb *urb; | 1486 | struct urb *urb; |
1487 | unsigned long flags; | 1487 | unsigned long flags; |
@@ -1493,7 +1493,7 @@ static void rx_data_softint(struct work_struct *work) | |||
1493 | spin_lock_irqsave(&info->lock, flags); | 1493 | spin_lock_irqsave(&info->lock, flags); |
1494 | if (info->flags & THROTTLED) { | 1494 | if (info->flags & THROTTLED) { |
1495 | spin_unlock_irqrestore(&info->lock, flags); | 1495 | spin_unlock_irqrestore(&info->lock, flags); |
1496 | return; | 1496 | goto out; |
1497 | } | 1497 | } |
1498 | 1498 | ||
1499 | list_for_each_safe(tmp, tmp2, &info->rx_urb_q) { | 1499 | list_for_each_safe(tmp, tmp2, &info->rx_urb_q) { |
@@ -1513,7 +1513,7 @@ static void rx_data_softint(struct work_struct *work) | |||
1513 | spin_unlock_irqrestore(&info->lock, flags); | 1513 | spin_unlock_irqrestore(&info->lock, flags); |
1514 | tty_flip_buffer_push(tty); | 1514 | tty_flip_buffer_push(tty); |
1515 | schedule_work(&info->rx_work); | 1515 | schedule_work(&info->rx_work); |
1516 | return; | 1516 | goto out; |
1517 | } | 1517 | } |
1518 | tty_insert_flip_string(tty, urb->transfer_buffer, len); | 1518 | tty_insert_flip_string(tty, urb->transfer_buffer, len); |
1519 | sent += len; | 1519 | sent += len; |
@@ -1536,6 +1536,8 @@ static void rx_data_softint(struct work_struct *work) | |||
1536 | 1536 | ||
1537 | if (sent) | 1537 | if (sent) |
1538 | tty_flip_buffer_push(tty); | 1538 | tty_flip_buffer_push(tty); |
1539 | out: | ||
1540 | tty_kref_put(tty); | ||
1539 | } | 1541 | } |
1540 | 1542 | ||
1541 | 1543 | ||