Commit e9136550 authored by Ivo van Doorn's avatar Ivo van Doorn Committed by David S. Miller

[PATCH] rt2x00: Increase rt2x00usb_vendor_request timeout.

By increasing the timeout for rt2x00usb_vendor_request,
we should limit the number of loops required to send
a signal to the device succefully.
500ms timeout is specified by the Ralink legacy drivers
for rt2500usb. For rt73usb 1000ms is specified, but that
includes the timeout for the firmware which is already
specified in a different define.
Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 24845910
...@@ -42,7 +42,7 @@ int rt2x00usb_vendor_request(const struct rt2x00_dev *rt2x00dev, ...@@ -42,7 +42,7 @@ int rt2x00usb_vendor_request(const struct rt2x00_dev *rt2x00dev,
const u8 request, const u8 requesttype, const u8 request, const u8 requesttype,
const u16 offset, const u16 value, const u16 offset, const u16 value,
void *buffer, const u16 buffer_length, void *buffer, const u16 buffer_length,
u16 timeout) const int timeout)
{ {
struct usb_device *usb_dev = struct usb_device *usb_dev =
interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); interface_to_usbdev(rt2x00dev_usb(rt2x00dev));
...@@ -60,12 +60,10 @@ int rt2x00usb_vendor_request(const struct rt2x00_dev *rt2x00dev, ...@@ -60,12 +60,10 @@ int rt2x00usb_vendor_request(const struct rt2x00_dev *rt2x00dev,
return 0; return 0;
/* /*
* Check for errors, * Check for errors
* -ETIMEDOUT: We need a bit more time to complete.
* -ENODEV: Device has disappeared, no point continuing. * -ENODEV: Device has disappeared, no point continuing.
* All other errors: Try again.
*/ */
if (status == -ETIMEDOUT)
timeout *= 2;
else if (status == -ENODEV) else if (status == -ENODEV)
break; break;
} }
...@@ -81,7 +79,7 @@ EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request); ...@@ -81,7 +79,7 @@ EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request);
int rt2x00usb_vendor_request_buff(const struct rt2x00_dev *rt2x00dev, int rt2x00usb_vendor_request_buff(const struct rt2x00_dev *rt2x00dev,
const u8 request, const u8 requesttype, const u8 request, const u8 requesttype,
const u16 offset, void *buffer, const u16 offset, void *buffer,
const u16 buffer_length, u16 timeout) const u16 buffer_length, const int timeout)
{ {
int status; int status;
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
*/ */
#define REGISTER_BUSY_COUNT 5 #define REGISTER_BUSY_COUNT 5
#define REGISTER_BUSY_DELAY 100 #define REGISTER_BUSY_DELAY 100
#define REGISTER_TIMEOUT 20 #define REGISTER_TIMEOUT 500
#define REGISTER_TIMEOUT_FIRMWARE 1000 #define REGISTER_TIMEOUT_FIRMWARE 1000
/* /*
...@@ -95,7 +95,7 @@ int rt2x00usb_vendor_request(const struct rt2x00_dev *rt2x00dev, ...@@ -95,7 +95,7 @@ int rt2x00usb_vendor_request(const struct rt2x00_dev *rt2x00dev,
const u8 request, const u8 requesttype, const u8 request, const u8 requesttype,
const u16 offset, const u16 value, const u16 offset, const u16 value,
void *buffer, const u16 buffer_length, void *buffer, const u16 buffer_length,
u16 timeout); const int timeout);
/* /*
* Used to read/write from/to the device. * Used to read/write from/to the device.
...@@ -110,7 +110,7 @@ int rt2x00usb_vendor_request(const struct rt2x00_dev *rt2x00dev, ...@@ -110,7 +110,7 @@ int rt2x00usb_vendor_request(const struct rt2x00_dev *rt2x00dev,
int rt2x00usb_vendor_request_buff(const struct rt2x00_dev *rt2x00dev, int rt2x00usb_vendor_request_buff(const struct rt2x00_dev *rt2x00dev,
const u8 request, const u8 requesttype, const u8 request, const u8 requesttype,
const u16 offset, void *buffer, const u16 offset, void *buffer,
const u16 buffer_length, u16 timeout); const u16 buffer_length, const int timeout);
/* /*
* Simple wrapper around rt2x00usb_vendor_request to write a single * Simple wrapper around rt2x00usb_vendor_request to write a single
...@@ -122,7 +122,7 @@ static inline int rt2x00usb_vendor_request_sw(const struct rt2x00_dev ...@@ -122,7 +122,7 @@ static inline int rt2x00usb_vendor_request_sw(const struct rt2x00_dev
const u8 request, const u8 request,
const u16 offset, const u16 offset,
const u16 value, const u16 value,
int timeout) const int timeout)
{ {
return rt2x00usb_vendor_request(rt2x00dev, request, return rt2x00usb_vendor_request(rt2x00dev, request,
USB_VENDOR_REQUEST_OUT, offset, USB_VENDOR_REQUEST_OUT, offset,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment