2003-03-26 16:53:58

by Duncan Sands

[permalink] [raw]
Subject: [PATCH] USB speedtouch: handle failure of usb_set_interface.

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;


2003-03-28 22:06:06

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] USB speedtouch: handle failure of usb_set_interface.

On Wed, Mar 26, 2003 at 06:04:59PM +0100, Duncan Sands wrote:
> speedtch.c | 26 ++++++++++++++++++--------
> 1 files changed, 18 insertions(+), 8 deletions(-)

Applied, thanks.

greg k-h