summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Ferrell <mferrell@uplogix.com>2012-07-24 14:15:13 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-26 15:00:44 -0700
commit4893ce51af5c2ccdfabf8f7d34dd28cf84a8a06e (patch)
treef6ff1894d17decf57b3fbf8486990cd540e6f42c
parentd3d31e57513f7f66fe66accd88837e021a1b96b2 (diff)
downloadlinux-3.10-4893ce51af5c2ccdfabf8f7d34dd28cf84a8a06e.tar.gz
linux-3.10-4893ce51af5c2ccdfabf8f7d34dd28cf84a8a06e.tar.bz2
linux-3.10-4893ce51af5c2ccdfabf8f7d34dd28cf84a8a06e.zip
usb: serial: mos7840: Fixup mos7840_chars_in_buffer()
commit 5c263b92f828af6a8cf54041db45ceae5af8f2ab upstream. * Use the buffer content length as opposed to the total buffer size. This can be a real problem when using the mos7840 as a usb serial-console as all kernel output is truncated during boot. Signed-off-by: Mark Ferrell <mferrell@uplogix.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/mos7840.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 62739ff58c7..c1505c3c557 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1189,9 +1189,12 @@ static int mos7840_chars_in_buffer(struct tty_struct *tty)
}
spin_lock_irqsave(&mos7840_port->pool_lock, flags);
- for (i = 0; i < NUM_URBS; ++i)
- if (mos7840_port->busy[i])
- chars += URB_TRANSFER_BUFFER_SIZE;
+ for (i = 0; i < NUM_URBS; ++i) {
+ if (mos7840_port->busy[i]) {
+ struct urb *urb = mos7840_port->write_urb_pool[i];
+ chars += urb->transfer_buffer_length;
+ }
+ }
spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
dbg("%s - returns %d", __func__, chars);
return chars;