[PATCH] Re: 2.6.3-bk9 QA testing: firewire good, USB printing dead

From: Barry K. Nathan
Date: Mon Mar 01 2004 - 02:46:59 EST


Does this patch (following my signature) fix the printer hangs?
(It does for me.)

BTW, it's also an attachment on OSDL bugzilla #2221:
http://bugme.osdl.org/show_bug.cgi?id=2221

-Barry K. Nathan <barryn@xxxxxxxxx>

diff -ruN linux-2.6.3-bk2/drivers/usb/class/usblp.c linux-2.6.3-bk2-bkn1/drivers/usb/class/usblp.c
--- linux-2.6.3-bk2/drivers/usb/class/usblp.c 2004-02-29 23:18:26.000000000 -0800
+++ linux-2.6.3-bk2-bkn1/drivers/usb/class/usblp.c 2004-02-29 23:17:24.000000000 -0800
@@ -603,7 +603,7 @@
{
DECLARE_WAITQUEUE(wait, current);
struct usblp *usblp = file->private_data;
- int timeout, err = 0, transfer_length;
+ int timeout, err = 0, transfer_length = 0;
size_t writecount = 0;

while (writecount < count) {
@@ -654,6 +654,16 @@
continue;
}

+ /* We must increment writecount here, and not at the
+ * end of the loop. Otherwise, the final loop iteration may
+ * be skipped, leading to incomplete printer output.
+ */
+ writecount += transfer_length;
+ if (writecount == count) {
+ up (&usblp->sem);
+ break;
+ }
+
transfer_length=(count - writecount);
if (transfer_length > USBLP_BUF_SIZE)
transfer_length = USBLP_BUF_SIZE;
@@ -677,8 +687,6 @@
break;
}
up (&usblp->sem);
-
- writecount += transfer_length;
}

return count;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/