mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* tty: usb-serial krefs - ti_usb returns EIO when reopening the device
@ 2009-04-14  1:14 Christoph Mair
  0 siblings, 0 replies; only message in thread
From: Christoph Mair @ 2009-04-14  1:14 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel

Hello,

commit 4a90f09b20f4622dcbff1f0e1e6bae1704f8ad8c

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@xxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

----

introduced a problem to the TI USB to serial converter code, which is needed 
for the debug interface device MSP-FET430UIF from Texas Instruments.
The driver works as expected until you close the device and try to reopen it. 
All you get from now on, is an I/O error. It seems that something
isn't released correctly, because the refcount of the usbserial module does 
not drop to zero, even when unloading all dependend drivers.

A "it works for me now" patch is attached. I've tested it with a vanilla 
2.6.29.

Christoph


diff --git a/drivers/usb/serial/ti_usb_3410_5052.c 
b/drivers/usb/serial/ti_usb_3410_5052.c
index 2620bf6..f11d8ac 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -1229,8 +1229,8 @@ static void ti_bulk_in_callback(struct urb *urb)
                spin_lock(&tport->tp_lock);
                tport->tp_icount.rx += urb->actual_length;
                spin_unlock(&tport->tp_lock);
-               tty_kref_put(tty);
        }
+       tty_kref_put(tty);

 exit:
        /* continue to read unless stopping */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-14  1:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-14  1:14 tty: usb-serial krefs - ti_usb returns EIO when reopening the device Christoph Mair

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®