diff options
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.h | 19 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 18 |
4 files changed, 29 insertions, 18 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 0dac1f5b5c4a..80b34d47114a 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -76,10 +76,10 @@ static inline void rt2500usb_register_multiread(struct rt2x00_dev *rt2x00dev, | |||
76 | const unsigned int offset, | 76 | const unsigned int offset, |
77 | void *value, const u16 length) | 77 | void *value, const u16 length) |
78 | { | 78 | { |
79 | int timeout = REGISTER_TIMEOUT * (length / sizeof(u16)); | ||
80 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ, | 79 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ, |
81 | USB_VENDOR_REQUEST_IN, offset, | 80 | USB_VENDOR_REQUEST_IN, offset, |
82 | value, length, timeout); | 81 | value, length, |
82 | REGISTER_TIMEOUT16(length)); | ||
83 | } | 83 | } |
84 | 84 | ||
85 | static inline void rt2500usb_register_write(struct rt2x00_dev *rt2x00dev, | 85 | static inline void rt2500usb_register_write(struct rt2x00_dev *rt2x00dev, |
@@ -106,10 +106,10 @@ static inline void rt2500usb_register_multiwrite(struct rt2x00_dev *rt2x00dev, | |||
106 | const unsigned int offset, | 106 | const unsigned int offset, |
107 | void *value, const u16 length) | 107 | void *value, const u16 length) |
108 | { | 108 | { |
109 | int timeout = REGISTER_TIMEOUT * (length / sizeof(u16)); | ||
110 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_WRITE, | 109 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_WRITE, |
111 | USB_VENDOR_REQUEST_OUT, offset, | 110 | USB_VENDOR_REQUEST_OUT, offset, |
112 | value, length, timeout); | 111 | value, length, |
112 | REGISTER_TIMEOUT16(length)); | ||
113 | } | 113 | } |
114 | 114 | ||
115 | static u16 rt2500usb_bbp_check(struct rt2x00_dev *rt2x00dev) | 115 | static u16 rt2500usb_bbp_check(struct rt2x00_dev *rt2x00dev) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 47f96b34087e..98aafc2d584a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -344,7 +344,7 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
344 | struct data_queue *queue; | 344 | struct data_queue *queue; |
345 | unsigned int i; | 345 | unsigned int i; |
346 | 346 | ||
347 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_RX_CONTROL, 0x0000, 0x0000, | 347 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_RX_CONTROL, 0, 0, |
348 | REGISTER_TIMEOUT); | 348 | REGISTER_TIMEOUT); |
349 | 349 | ||
350 | /* | 350 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index 11e55180cbaf..1efaaae04632 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -47,6 +47,20 @@ | |||
47 | #define REGISTER_TIMEOUT 500 | 47 | #define REGISTER_TIMEOUT 500 |
48 | #define REGISTER_TIMEOUT_FIRMWARE 1000 | 48 | #define REGISTER_TIMEOUT_FIRMWARE 1000 |
49 | 49 | ||
50 | /** | ||
51 | * REGISTER_TIMEOUT16 - Determine the timeout for 16bit register access | ||
52 | * @__datalen: Data length | ||
53 | */ | ||
54 | #define REGISTER_TIMEOUT16(__datalen) \ | ||
55 | ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u16)) ) | ||
56 | |||
57 | /** | ||
58 | * REGISTER_TIMEOUT32 - Determine the timeout for 32bit register access | ||
59 | * @__datalen: Data length | ||
60 | */ | ||
61 | #define REGISTER_TIMEOUT32(__datalen) \ | ||
62 | ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u32)) ) | ||
63 | |||
50 | /* | 64 | /* |
51 | * Cache size | 65 | * Cache size |
52 | */ | 66 | */ |
@@ -187,11 +201,10 @@ static inline int rt2x00usb_vendor_request_sw(struct rt2x00_dev *rt2x00dev, | |||
187 | static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev, | 201 | static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev, |
188 | __le16 *eeprom, const u16 lenght) | 202 | __le16 *eeprom, const u16 lenght) |
189 | { | 203 | { |
190 | int timeout = REGISTER_TIMEOUT * (lenght / sizeof(u16)); | ||
191 | |||
192 | return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ, | 204 | return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ, |
193 | USB_VENDOR_REQUEST_IN, 0, 0, | 205 | USB_VENDOR_REQUEST_IN, 0, 0, |
194 | eeprom, lenght, timeout); | 206 | eeprom, lenght, |
207 | REGISTER_TIMEOUT16(lenght)); | ||
195 | } | 208 | } |
196 | 209 | ||
197 | /* | 210 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index a6419c900772..351d95c4f50d 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -74,10 +74,10 @@ static inline void rt73usb_register_multiread(struct rt2x00_dev *rt2x00dev, | |||
74 | const unsigned int offset, | 74 | const unsigned int offset, |
75 | void *value, const u32 length) | 75 | void *value, const u32 length) |
76 | { | 76 | { |
77 | int timeout = REGISTER_TIMEOUT * (length / sizeof(u32)); | ||
78 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ, | 77 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ, |
79 | USB_VENDOR_REQUEST_IN, offset, | 78 | USB_VENDOR_REQUEST_IN, offset, |
80 | value, length, timeout); | 79 | value, length, |
80 | REGISTER_TIMEOUT32(length)); | ||
81 | } | 81 | } |
82 | 82 | ||
83 | static inline void rt73usb_register_write(struct rt2x00_dev *rt2x00dev, | 83 | static inline void rt73usb_register_write(struct rt2x00_dev *rt2x00dev, |
@@ -102,10 +102,10 @@ static inline void rt73usb_register_multiwrite(struct rt2x00_dev *rt2x00dev, | |||
102 | const unsigned int offset, | 102 | const unsigned int offset, |
103 | void *value, const u32 length) | 103 | void *value, const u32 length) |
104 | { | 104 | { |
105 | int timeout = REGISTER_TIMEOUT * (length / sizeof(u32)); | ||
106 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_WRITE, | 105 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_WRITE, |
107 | USB_VENDOR_REQUEST_OUT, offset, | 106 | USB_VENDOR_REQUEST_OUT, offset, |
108 | value, length, timeout); | 107 | value, length, |
108 | REGISTER_TIMEOUT32(length)); | ||
109 | } | 109 | } |
110 | 110 | ||
111 | static u32 rt73usb_bbp_check(struct rt2x00_dev *rt2x00dev) | 111 | static u32 rt73usb_bbp_check(struct rt2x00_dev *rt2x00dev) |
@@ -876,7 +876,6 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data, | |||
876 | char *ptr = data; | 876 | char *ptr = data; |
877 | char *cache; | 877 | char *cache; |
878 | int buflen; | 878 | int buflen; |
879 | int timeout; | ||
880 | 879 | ||
881 | /* | 880 | /* |
882 | * Wait for stable hardware. | 881 | * Wait for stable hardware. |
@@ -907,14 +906,14 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data, | |||
907 | 906 | ||
908 | for (i = 0; i < len; i += CSR_CACHE_SIZE_FIRMWARE) { | 907 | for (i = 0; i < len; i += CSR_CACHE_SIZE_FIRMWARE) { |
909 | buflen = min_t(int, len - i, CSR_CACHE_SIZE_FIRMWARE); | 908 | buflen = min_t(int, len - i, CSR_CACHE_SIZE_FIRMWARE); |
910 | timeout = REGISTER_TIMEOUT * (buflen / sizeof(u32)); | ||
911 | 909 | ||
912 | memcpy(cache, ptr, buflen); | 910 | memcpy(cache, ptr, buflen); |
913 | 911 | ||
914 | rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE, | 912 | rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE, |
915 | USB_VENDOR_REQUEST_OUT, | 913 | USB_VENDOR_REQUEST_OUT, |
916 | FIRMWARE_IMAGE_BASE + i, 0, | 914 | FIRMWARE_IMAGE_BASE + i, 0, |
917 | cache, buflen, timeout); | 915 | cache, buflen, |
916 | REGISTER_TIMEOUT32(buflen)); | ||
918 | 917 | ||
919 | ptr += buflen; | 918 | ptr += buflen; |
920 | } | 919 | } |
@@ -1966,7 +1965,6 @@ static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1966 | struct rt2x00_intf *intf = vif_to_intf(control->vif); | 1965 | struct rt2x00_intf *intf = vif_to_intf(control->vif); |
1967 | struct skb_frame_desc *skbdesc; | 1966 | struct skb_frame_desc *skbdesc; |
1968 | unsigned int beacon_base; | 1967 | unsigned int beacon_base; |
1969 | unsigned int timeout; | ||
1970 | u32 reg; | 1968 | u32 reg; |
1971 | 1969 | ||
1972 | if (unlikely(!intf->beacon)) | 1970 | if (unlikely(!intf->beacon)) |
@@ -2006,10 +2004,10 @@ static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2006 | */ | 2004 | */ |
2007 | rt2x00lib_write_tx_desc(rt2x00dev, skb, control); | 2005 | rt2x00lib_write_tx_desc(rt2x00dev, skb, control); |
2008 | beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx); | 2006 | beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx); |
2009 | timeout = REGISTER_TIMEOUT * (skb->len / sizeof(u32)); | ||
2010 | rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE, | 2007 | rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE, |
2011 | USB_VENDOR_REQUEST_OUT, beacon_base, 0, | 2008 | USB_VENDOR_REQUEST_OUT, beacon_base, 0, |
2012 | skb->data, skb->len, timeout); | 2009 | skb->data, skb->len, |
2010 | REGISTER_TIMEOUT32(skb->len)); | ||
2013 | rt73usb_kick_tx_queue(rt2x00dev, QID_BEACON); | 2011 | rt73usb_kick_tx_queue(rt2x00dev, QID_BEACON); |
2014 | 2012 | ||
2015 | return 0; | 2013 | return 0; |