LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: dvomlehn@cisco.com, gregkh@suse.de, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [REGRESSION] "USB: use kfifo to buffer usb-generic serial writes" causes gobi_loader to hang
Date: Tue, 19 Jan 2010 14:20:29 +0100
Message-ID: <201001191420.29652.oliver@neukum.org> (raw)
In-Reply-To: <20100118201416.GA26511@srcf.ucam.org>


[-- Attachment #1: Type: Text/Plain, Size: 399 bytes --]

Am Montag, 18. Januar 2010 21:14:16 schrieb Matthew Garrett:

> drivers/usb/serial/generic.c: usb_serial_generic_write - port 0, 1565 
> bytes
> drivers/usb/serial/generic.c: usb_serial_generic_write - put 0 bytes 
> into fifo
> drivers/usb/serial/generic.c: usb_serial_generic_read_bulk_callback - 
> port 0

If the FIFO is full we can do nothing. Please try the attached patch.

	Regards
		Oliver

[-- Attachment #2: 0001-usb-serial-Deal-with-filled-FIFO.patch --]
[-- Type: text/x-patch, Size: 938 bytes --]

From d7317bae0772b794a1cc9b832bc3d3e1b3642a13 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@neukum.org>
Date: Tue, 19 Jan 2010 14:16:41 +0100
Subject: [PATCH] usb:serial:Deal with filled FIFO

Bail out if the FIFO is filled

Signed-off-by: Oliver Neukum <oliver@neukum.org>
---
 drivers/usb/serial/generic.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 76e5514..053f7f1 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -349,6 +349,10 @@ int usb_serial_generic_write(struct tty_struct *tty,
 
 	count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock);
 	dbg("%s - put %d bytes into fifo", __func__, count);
+	if (!count) {
+		dbg("%s - FIFO is full", __func__);
+		return 0;
+	}
 	result = usb_serial_generic_write_start(port);
 
 	if (result >= 0)
-- 
1.6.4.2


  reply index

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-17  2:55 Matthew Garrett
2010-01-17  8:13 ` Marcel Holtmann
2010-01-17  9:14 ` Oliver Neukum
2010-01-18  1:58   ` Matthew Garrett
2010-01-18 17:25     ` Oliver Neukum
2010-01-18 20:14       ` Matthew Garrett
2010-01-19 13:20         ` Oliver Neukum [this message]
2010-01-19 13:29           ` Alan Cox
2010-01-19 13:57             ` Oliver Neukum
2010-01-19 14:21               ` Alan Cox
2010-01-19 15:15                 ` Oliver Neukum
2010-01-19 14:26               ` Alan Cox
2010-01-19 15:25                 ` Johan Hovold
2010-01-19 15:52                   ` Johan Hovold
2010-01-19 16:27                   ` Alan Cox
2010-01-19 18:44                     ` Oliver Neukum
2010-01-19 19:45                       ` Johan Hovold
2010-01-28 17:45           ` Greg KH
2010-01-28 18:40             ` Oliver Neukum
2010-01-28 22:32               ` Greg KH
2010-02-03 16:46           ` Matthew Garrett
2010-02-03 17:21             ` Oliver Neukum
2010-02-03 22:37               ` Matthew Garrett
2010-02-03 22:58                 ` Oliver Neukum
2010-02-05 19:58                   ` Matthew Garrett
2010-02-05 21:35                     ` Matthew Garrett
2010-02-08 19:00                       ` Oliver Neukum
2010-02-05 21:59                     ` Oliver Neukum
2010-02-13  2:09                       ` Anssi Hannula
2010-02-13  2:50                         ` Alan Stern
2010-02-13  7:11                           ` Oliver Neukum
2010-02-13 13:35                             ` Anssi Hannula
2010-02-13 19:01                               ` Anssi Hannula
2010-02-15 13:08                                 ` Oliver Neukum
2010-02-20 16:03                                   ` Anssi Hannula
2010-02-20 18:19                                     ` Oliver Neukum
2010-02-21 21:28                                       ` Alan Stern
2010-02-21 21:42                                         ` Anssi Hannula
2010-02-21 22:12                                           ` Oliver Neukum
2010-02-21 23:06                                             ` Anssi Hannula
2010-02-21 23:13                                               ` Anssi Hannula
2010-02-21 23:21                                                 ` Anssi Hannula
2010-02-22 15:28                                                   ` Alan Stern
2010-02-22 18:35                                                     ` Anssi Hannula
2010-02-22 19:10                                                       ` Alan Stern
2010-02-22 19:14                                                         ` Matthew Garrett
2010-02-22 20:12                                                           ` Alan Stern
2010-02-24  2:33                                                             ` Anssi Hannula
2010-02-22 19:24                                                         ` Anssi Hannula
2010-02-22 20:10                                                           ` Alan Stern
2010-02-22 21:24                                                           ` Alan Cox
2010-02-22 21:23                                                             ` Matthew Garrett
2010-02-22 23:26                                                       ` Oliver Neukum
2010-02-23  1:55                                                         ` Anssi Hannula
2010-02-21 22:09                                         ` Oliver Neukum
2010-02-21 21:37                                       ` Anssi Hannula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201001191420.29652.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=dvomlehn@cisco.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git