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/omninet.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/omninet.c')
-rw-r--r-- | drivers/usb/serial/omninet.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index ae8e227f3db2..c4d70b0f1e48 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -172,7 +172,7 @@ static int omninet_open(struct tty_struct *tty, | |||
172 | dbg("%s - port %d", __func__, port->number); | 172 | dbg("%s - port %d", __func__, port->number); |
173 | 173 | ||
174 | wport = serial->port[1]; | 174 | wport = serial->port[1]; |
175 | wport->port.tty = tty; /* FIXME */ | 175 | tty_port_tty_set(&wport->port, tty); |
176 | 176 | ||
177 | /* Start reading from the device */ | 177 | /* Start reading from the device */ |
178 | usb_fill_bulk_urb(port->read_urb, serial->dev, | 178 | usb_fill_bulk_urb(port->read_urb, serial->dev, |
@@ -229,9 +229,11 @@ static void omninet_read_bulk_callback(struct urb *urb) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | if (urb->actual_length && header->oh_len) { | 231 | if (urb->actual_length && header->oh_len) { |
232 | tty_insert_flip_string(port->port.tty, | 232 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
233 | data + OMNINET_DATAOFFSET, header->oh_len); | 233 | tty_insert_flip_string(tty, data + OMNINET_DATAOFFSET, |
234 | tty_flip_buffer_push(port->port.tty); | 234 | header->oh_len); |
235 | tty_flip_buffer_push(tty); | ||
236 | tty_kref_put(tty); | ||
235 | } | 237 | } |
236 | 238 | ||
237 | /* Continue trying to always read */ | 239 | /* Continue trying to always read */ |