public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.4] usb serial write fix
@ 2004-11-01 14:51 Paul Fulghum
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Fulghum @ 2004-11-01 14:51 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Greg KH, linux-kernel

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);



^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <mailman.1099321382.10097.linux-kernel2news@redhat.com>]

end of thread, other threads:[~2004-11-27 18:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-01 14:51 [PATCH 2.4] usb serial write fix Paul Fulghum
     [not found] <mailman.1099321382.10097.linux-kernel2news@redhat.com>
2004-11-02  3:36 ` Pete Zaitcev
2004-11-02 14:03   ` Paul Fulghum
2004-11-02 15:25     ` Paul Fulghum
2004-11-27 18:46       ` Pete Zaitcev

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