public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Fulghum <paulkf@microgate.com>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: Greg KH <greg@kroah.com>, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.4] usb serial write fix
Date: Mon, 01 Nov 2004 08:51:08 -0600	[thread overview]
Message-ID: <1099320668.2853.7.camel@deimos.microgate.com> (raw)

Fix usb serial write path in post_helper to check return
code from component driver write routine and
resubmit if necessary. The post helper introduced in
2.4.27-pre6 can lose write data if component device write is busy.

This was previously reported as a problem with
the pl2303 driver running PPP by oleksiy@jabber.ru
Oleksiy has tested the patch with success.

Signed-off-by: Paul Fulghum <paulkf@microgate.com>

-- 
Paul Fulghum
paulkf@microgate.com

--- linux-2.4.28-pre4/drivers/usb/serial/usbserial.c	2004-08-07 18:26:05.000000000 -0500
+++ b/drivers/usb/serial/usbserial.c	2004-11-01 08:29:07.000000000 -0600
@@ -508,8 +508,18 @@ static void post_helper(void *arg)
 		down(&port->sem);
 		dbg("%s - port %d len %d backlog %d", __FUNCTION__,
 		    port->number, job->len, port->write_backlog);
-		if (port->tty != NULL)
-			__serial_write(port, 0, job->buff, job->len);
+		if (port->tty != NULL) {
+			int rc;
+			int sent = 0;
+			while (sent < job->len) {
+				rc = __serial_write(port, 0, job->buff + sent, job->len - sent);
+				if ((rc < 0) || signal_pending(current))
+					break;
+				sent += rc;
+				if ((sent < job->len) && current->need_resched)
+					schedule();
+			}
+		}
 		up(&port->sem);
 
 		spin_lock_irqsave(&post_lock, flags);



             reply	other threads:[~2004-11-01 14:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-01 14:51 Paul Fulghum [this message]
     [not found] <mailman.1099321382.10097.linux-kernel2news@redhat.com>
2004-11-02  3:36 ` [PATCH 2.4] usb serial write fix Pete Zaitcev
2004-11-02 14:03   ` Paul Fulghum
2004-11-02 15:25     ` Paul Fulghum
2004-11-27 18:46       ` Pete Zaitcev

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=1099320668.2853.7.camel@deimos.microgate.com \
    --to=paulkf@microgate.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox