Re: [PATCH/RFC] 2.5.42 partial fix for older pl2303

Greg KH (greg@kroah.com)
Sun, 13 Oct 2002 13:25:04 -0700


On Sat, Oct 12, 2002 at 09:30:08PM -0700, Barry K. Nathan wrote:
> On Sat, Oct 12, 2002 at 06:16:44PM -0700, Greg KH wrote:
> [snip stuff regarding pl2303 on 2.4.20-pre]
> > Now, would you mind taking a look at 2.5, and fixing this there too? :)
>
> Here's a half-successful attempt. With this patch, the device no longer
> appears twice, and it always works on the first open (at least, so I've
> observed up to this point). The open following a successful open usually
> fails (roughly speaking, it appears to play dead), and the open following
> a failed open usually (always?) succeeds.
>
> So, on my PL-2303, it's not perfect but it's certainly livable.
>
> This patch is based on the one I did for 2.4, and in fact, this code
> functions when it's plugged into 2.4.20-pre10 instead of 2.5.42. In that
> scenario, the opens work 100% of the time.
>
> I'd be interested in suggestions or comments regarding this patch.
> Anyone who has a PL-2303 working under 2.5 might want to try this patch
> just to make sure it doesn't kill their working setup.

Nice, I've added this to my tree. I also made the following patch, to
fix up the proper return value for the probe() call, and fix a memory
leak.

Let me know if this patch causes any problems for you.

thanks,

greg k-h

diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c Sun Oct 13 13:35:48 2002
+++ b/drivers/usb/serial/usb-serial.c Sun Oct 13 13:35:48 2002
@@ -1249,7 +1249,6 @@
}

#if defined(CONFIG_USB_SERIAL_PL2303) || defined(CONFIG_USB_SERIAL_PL2303_MODULE)
-#if 1
/* BEGIN HORRIBLE HACK FOR PL2303 */
/* this is needed due to the looney way its endpoints are set up */
if (((dev->descriptor.idVendor == PL2303_VENDOR_ID) &&
@@ -1280,11 +1279,11 @@
*/
if (num_bulk_in == 0 || num_bulk_out == 0) {
info("PL-2303 hack: descriptors matched but endpoints did not");
- return NULL;
+ kfree (serial);
+ return -ENODEV;
}
}
/* END HORRIBLE HACK FOR PL2303 */
-#endif
#endif

/* found all that we need */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/