[PATCH] USB speedtouch: handle failure of usb_set_interface.

From: Duncan Sands (baldrick@wanadoo.fr)
Date: Wed Mar 26 2003 - 12:04:59 EST


 speedtch.c | 26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff -Nru a/drivers/usb/misc/speedtch.c b/drivers/usb/misc/speedtch.c
--- a/drivers/usb/misc/speedtch.c Wed Mar 26 18:02:57 2003
+++ b/drivers/usb/misc/speedtch.c Wed Mar 26 18:02:57 2003
@@ -1034,6 +1034,23 @@
 ** USB **
 **********/
 
+static int udsl_set_alternate (struct udsl_instance_data *instance)
+{
+ down (&instance->serialize); /* vs self */
+ if (!instance->firmware_loaded) {
+ int ret;
+
+ if ((ret = usb_set_interface (instance->usb_dev, 1, 1)) < 0) {
+ up (&instance->serialize);
+ return ret;
+ }
+ instance->firmware_loaded = 1;
+ }
+ up (&instance->serialize);
+ udsl_fire_receivers (instance);
+ return 0;
+}
+
 static int udsl_usb_ioctl (struct usb_interface *intf, unsigned int code, void *user_data)
 {
         struct udsl_instance_data *instance = usb_get_intfdata (intf);
@@ -1048,14 +1065,7 @@
         switch (code) {
         case UDSL_IOCTL_START:
                 instance->atm_dev->signal = ATM_PHY_SIG_FOUND;
- down (&instance->serialize); /* vs self */
- if (!instance->firmware_loaded) {
- usb_set_interface (instance->usb_dev, 1, 1);
- instance->firmware_loaded = 1;
- }
- up (&instance->serialize);
- udsl_fire_receivers (instance);
- return 0;
+ return udsl_set_alternate (instance);
         case UDSL_IOCTL_STOP:
                 instance->atm_dev->signal = ATM_PHY_SIG_LOST;
                 return 0;

-
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/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:24 EST