On Fri, Aug 10, 2012 at 02:38:58PM +0400, Stas Sergeev wrote: > Hello, > > The TIOCOUTQ ioctl calls chars_in_buffer(), and > some apps depend on a correct behaviour of that. > mos7840 implements it wrongly: if you write just > one char, TIOCOUTQ will return 32. > The attached patch should fix it. > But it is not tested: customer reported the problem > and fails to test the patch. > Please review. > https://bugzilla.kernel.org/show_bug.cgi?id=45791 > > Signed-off-by: Stas Sergeev <stsp@xxxxxxxxxxxxxxxxxxxxx> I think this is already fixed by commit 5c263b92f828af6a8cf54041db45ceae5af8f2ab in the linux-next tree that will be going to Linus soon. Can you verify this? I've included the patch below. Oh, and in the future, please put the changelog information, and your signed-off-by: in the patch itself, otherwise I would have to edit a base64 attachment by hand to include it, which I really can't do... thanks, greg k-h -------------------- >From 5c263b92f828af6a8cf54041db45ceae5af8f2ab Mon Sep 17 00:00:00 2001 From: Mark Ferrell <mferrell@xxxxxxxxxxx> Date: Tue, 24 Jul 2012 14:15:13 -0500 Subject: [PATCH] usb: serial: mos7840: Fixup mos7840_chars_in_buffer() * 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@xxxxxxxxxxx> Cc: stable <stable@xxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 57eca24..009c1d9 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -1232,9 +1232,12 @@ static int mos7840_chars_in_buffer(struct tty_struct *tty) return 0; 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; -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html