From: Greg KH To: Marcelo Tosatti Cc: linux-usb-devel@lists.sourceforge.net, stuartm@connecttech.com Subject: [PATCH 2 of 3] USB serial driver not attached bug fix. Hi, Here's a patch against 2.4.18-pre3 that fixes a problem with usb-serial drivers that download firmware to their devices, disconnect, and then reenumerate themselves. After they download firmware, the usb serial core would return that the device was not claimed by it, causing an error message to the console. This patch fixes this problem. The patch was originally written by Stuart MacDonald, but simplified by me. thanks, greg k-h diff -Nru a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h --- a/drivers/usb/serial/usb-serial.h Fri Jan 11 11:26:03 2002 +++ b/drivers/usb/serial/usb-serial.h Fri Jan 11 11:26:03 2002 @@ -132,8 +132,12 @@ struct list_head driver_list; - /* function call to make before accepting driver */ - /* return 0 to continue initialization, anything else to abort */ + /* function call to make before accepting driver + * return 0 to continue initialization, + * < 0 aborts startup, + * > 0 does not set up anything else and is useful for devices that have + * downloaded firmware, and will reset themselves shortly. + */ int (*startup) (struct usb_serial *serial); void (*shutdown) (struct usb_serial *serial); diff -Nru a/drivers/usb/serial/usbserial.c b/drivers/usb/serial/usbserial.c --- a/drivers/usb/serial/usbserial.c Fri Jan 11 11:26:05 2002 +++ b/drivers/usb/serial/usbserial.c Fri Jan 11 11:26:05 2002 @@ -1203,9 +1203,11 @@ /* if this device type has a startup function, call it */ if (type->startup) { - if (type->startup (serial)) { + i = type->startup (serial); + if (i < 0) goto probe_error; - } + if (i > 0) + return serial; } /* set up the endpoint information */