aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index dc85d3e0ffe5..258e2a87c5ea 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -42,31 +42,27 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev,
42{ 42{
43 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); 43 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
44 int status; 44 int status;
45 unsigned int i;
46 unsigned int pipe = 45 unsigned int pipe =
47 (requesttype == USB_VENDOR_REQUEST_IN) ? 46 (requesttype == USB_VENDOR_REQUEST_IN) ?
48 usb_rcvctrlpipe(usb_dev, 0) : usb_sndctrlpipe(usb_dev, 0); 47 usb_rcvctrlpipe(usb_dev, 0) : usb_sndctrlpipe(usb_dev, 0);
48 unsigned long expire = jiffies + msecs_to_jiffies(timeout);
49 49
50 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) 50 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
51 return -ENODEV; 51 return -ENODEV;
52 52
53 for (i = 0; i < REGISTER_BUSY_COUNT; i++) { 53 do {
54 status = usb_control_msg(usb_dev, pipe, request, requesttype, 54 status = usb_control_msg(usb_dev, pipe, request, requesttype,
55 value, offset, buffer, buffer_length, 55 value, offset, buffer, buffer_length,
56 timeout); 56 timeout / 2);
57 if (status >= 0) 57 if (status >= 0)
58 return 0; 58 return 0;
59 59
60 /* 60 if (status == -ENODEV) {
61 * Check for errors 61 /* Device has disappeared. */
62 * -ENODEV: Device has disappeared, no point continuing.
63 * All other errors: Try again.
64 */
65 else if (status == -ENODEV) {
66 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); 62 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
67 break; 63 break;
68 } 64 }
69 } 65 } while (time_before(jiffies, expire));
70 66
71 /* If the port is powered down, we get a -EPROTO error, and this 67 /* If the port is powered down, we get a -EPROTO error, and this
72 * leads to a endless loop. So just say that the device is gone. 68 * leads to a endless loop. So just say that the device is gone.