aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2014-11-26 09:29:13 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-12-01 15:57:20 -0500
commitad92bc9e8e62b9dd013f8afa7497e916f8de0364 (patch)
tree82ca1307e9746c8b41e1a18eb2c1f810504d55d6 /drivers/net/wireless/rt2x00
parent4cc2fa0036530fcd07446ab1ba690c9c23fe603d (diff)
rt2x00: use timeout in rt2x00usb_vendor_request
Use provided timeout value in rt2x00usb_vendor_request() instead of iterating REGISTER_BUSY_COUNT times. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-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.