diff options
author | Gertjan van Wingerde <gwingerde@gmail.com> | 2010-06-03 04:51:51 -0400 |
---|---|---|
committer | Ivo van Doorn <IvDoorn@gmail.com> | 2010-06-03 04:51:51 -0400 |
commit | 96b61bafe22b2f2abcc833d651739edb977f1b1e (patch) | |
tree | 232a49d57e1525a77d882fe39334bae064a42335 /drivers | |
parent | a903ae004a766a675ff063b88b168bd411e7760c (diff) |
rt2x00: Clean up USB vendor request buffer functions.
There is no need to force the separation between a buffer USB vendor
request that does fit the CSR cache and one that doesn't onto the
callers. This is something that the rt2x00usb_vendor_request_buff
function can figure out by itself.
Combine the rt2x00usb_vendor_request_buff and
rt2x00usb_vendor_request_large_buff functions into a single one, as
both of them were equivalent for small buffers anyway.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 15 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.h | 19 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 32 |
5 files changed, 14 insertions, 87 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 9dab1dccdaff..002db646ae0b 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -345,7 +345,6 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev, | |||
345 | struct rt2x00lib_crypto *crypto, | 345 | struct rt2x00lib_crypto *crypto, |
346 | struct ieee80211_key_conf *key) | 346 | struct ieee80211_key_conf *key) |
347 | { | 347 | { |
348 | int timeout; | ||
349 | u32 mask; | 348 | u32 mask; |
350 | u16 reg; | 349 | u16 reg; |
351 | 350 | ||
@@ -367,18 +366,8 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev, | |||
367 | 366 | ||
368 | key->hw_key_idx += reg ? ffz(reg) : 0; | 367 | key->hw_key_idx += reg ? ffz(reg) : 0; |
369 | 368 | ||
370 | /* | 369 | rt2500usb_register_multiwrite(rt2x00dev, reg, |
371 | * The encryption key doesn't fit within the CSR cache, | 370 | crypto->key, sizeof(crypto->key)); |
372 | * this means we should allocate it separately and use | ||
373 | * rt2x00usb_vendor_request() to send the key to the hardware. | ||
374 | */ | ||
375 | reg = KEY_ENTRY(key->hw_key_idx); | ||
376 | timeout = REGISTER_TIMEOUT32(sizeof(crypto->key)); | ||
377 | rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE, | ||
378 | USB_VENDOR_REQUEST_OUT, reg, | ||
379 | crypto->key, | ||
380 | sizeof(crypto->key), | ||
381 | timeout); | ||
382 | 371 | ||
383 | /* | 372 | /* |
384 | * The driver does not support the IV/EIV generation | 373 | * The driver does not support the IV/EIV generation |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index c697066152d7..c69628d943de 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -169,11 +169,8 @@ static int rt2800usb_load_firmware(struct rt2x00_dev *rt2x00dev, | |||
169 | /* | 169 | /* |
170 | * Write firmware to device. | 170 | * Write firmware to device. |
171 | */ | 171 | */ |
172 | rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE, | 172 | rt2800_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, |
173 | USB_VENDOR_REQUEST_OUT, | 173 | data + offset, length); |
174 | FIRMWARE_IMAGE_BASE, | ||
175 | data + offset, length, | ||
176 | REGISTER_TIMEOUT32(length)); | ||
177 | 174 | ||
178 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 175 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
179 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); | 176 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); |
@@ -478,10 +475,8 @@ static void rt2800usb_write_beacon(struct queue_entry *entry, | |||
478 | * Write entire beacon with descriptor to register. | 475 | * Write entire beacon with descriptor to register. |
479 | */ | 476 | */ |
480 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 477 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
481 | rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE, | 478 | rt2800_register_multiwrite(rt2x00dev, beacon_base, |
482 | USB_VENDOR_REQUEST_OUT, beacon_base, | 479 | entry->skb->data, entry->skb->len); |
483 | entry->skb->data, entry->skb->len, | ||
484 | REGISTER_TIMEOUT32(entry->skb->len)); | ||
485 | 480 | ||
486 | /* | 481 | /* |
487 | * Enable beaconing again. | 482 | * Enable beaconing again. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 5e123519f8cb..b45bc24c3dae 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -113,26 +113,6 @@ int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev, | |||
113 | const u16 offset, void *buffer, | 113 | const u16 offset, void *buffer, |
114 | const u16 buffer_length, const int timeout) | 114 | const u16 buffer_length, const int timeout) |
115 | { | 115 | { |
116 | int status; | ||
117 | |||
118 | mutex_lock(&rt2x00dev->csr_mutex); | ||
119 | |||
120 | status = rt2x00usb_vendor_req_buff_lock(rt2x00dev, request, | ||
121 | requesttype, offset, buffer, | ||
122 | buffer_length, timeout); | ||
123 | |||
124 | mutex_unlock(&rt2x00dev->csr_mutex); | ||
125 | |||
126 | return status; | ||
127 | } | ||
128 | EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff); | ||
129 | |||
130 | int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev, | ||
131 | const u8 request, const u8 requesttype, | ||
132 | const u16 offset, const void *buffer, | ||
133 | const u16 buffer_length, | ||
134 | const int timeout) | ||
135 | { | ||
136 | int status = 0; | 116 | int status = 0; |
137 | unsigned char *tb; | 117 | unsigned char *tb; |
138 | u16 off, len, bsize; | 118 | u16 off, len, bsize; |
@@ -157,7 +137,7 @@ int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev, | |||
157 | 137 | ||
158 | return status; | 138 | return status; |
159 | } | 139 | } |
160 | EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_large_buff); | 140 | EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff); |
161 | 141 | ||
162 | int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev, | 142 | int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev, |
163 | const unsigned int offset, | 143 | const unsigned int offset, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index 621d0f829251..255b81ef9530 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -167,25 +167,6 @@ int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev, | |||
167 | const u16 buffer_length, const int timeout); | 167 | const u16 buffer_length, const int timeout); |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * rt2x00usb_vendor_request_large_buff - Send register command to device (buffered) | ||
171 | * @rt2x00dev: Pointer to &struct rt2x00_dev | ||
172 | * @request: USB vendor command (See &enum rt2x00usb_vendor_request) | ||
173 | * @requesttype: Request type &USB_VENDOR_REQUEST_* | ||
174 | * @offset: Register start offset to perform action on | ||
175 | * @buffer: Buffer where information will be read/written to by device | ||
176 | * @buffer_length: Size of &buffer | ||
177 | * @timeout: Operation timeout | ||
178 | * | ||
179 | * This function is used to transfer register data in blocks larger | ||
180 | * then CSR_CACHE_SIZE. Use for firmware upload, keys and beacons. | ||
181 | */ | ||
182 | int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev, | ||
183 | const u8 request, const u8 requesttype, | ||
184 | const u16 offset, const void *buffer, | ||
185 | const u16 buffer_length, | ||
186 | const int timeout); | ||
187 | |||
188 | /** | ||
189 | * rt2x00usb_vendor_request_sw - Send single register command to device | 170 | * rt2x00usb_vendor_request_sw - Send single register command to device |
190 | * @rt2x00dev: Pointer to &struct rt2x00_dev | 171 | * @rt2x00dev: Pointer to &struct rt2x00_dev |
191 | * @request: USB vendor command (See &enum rt2x00usb_vendor_request) | 172 | * @request: USB vendor command (See &enum rt2x00usb_vendor_request) |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 4ab38c3641cc..113ad690f9d3 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -270,7 +270,6 @@ static int rt73usb_config_shared_key(struct rt2x00_dev *rt2x00dev, | |||
270 | { | 270 | { |
271 | struct hw_key_entry key_entry; | 271 | struct hw_key_entry key_entry; |
272 | struct rt2x00_field32 field; | 272 | struct rt2x00_field32 field; |
273 | int timeout; | ||
274 | u32 mask; | 273 | u32 mask; |
275 | u32 reg; | 274 | u32 reg; |
276 | 275 | ||
@@ -306,12 +305,8 @@ static int rt73usb_config_shared_key(struct rt2x00_dev *rt2x00dev, | |||
306 | sizeof(key_entry.rx_mic)); | 305 | sizeof(key_entry.rx_mic)); |
307 | 306 | ||
308 | reg = SHARED_KEY_ENTRY(key->hw_key_idx); | 307 | reg = SHARED_KEY_ENTRY(key->hw_key_idx); |
309 | timeout = REGISTER_TIMEOUT32(sizeof(key_entry)); | 308 | rt2x00usb_register_multiwrite(rt2x00dev, reg, |
310 | rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE, | 309 | &key_entry, sizeof(key_entry)); |
311 | USB_VENDOR_REQUEST_OUT, reg, | ||
312 | &key_entry, | ||
313 | sizeof(key_entry), | ||
314 | timeout); | ||
315 | 310 | ||
316 | /* | 311 | /* |
317 | * The cipher types are stored over 2 registers. | 312 | * The cipher types are stored over 2 registers. |
@@ -372,7 +367,6 @@ static int rt73usb_config_pairwise_key(struct rt2x00_dev *rt2x00dev, | |||
372 | { | 367 | { |
373 | struct hw_pairwise_ta_entry addr_entry; | 368 | struct hw_pairwise_ta_entry addr_entry; |
374 | struct hw_key_entry key_entry; | 369 | struct hw_key_entry key_entry; |
375 | int timeout; | ||
376 | u32 mask; | 370 | u32 mask; |
377 | u32 reg; | 371 | u32 reg; |
378 | 372 | ||
@@ -407,17 +401,11 @@ static int rt73usb_config_pairwise_key(struct rt2x00_dev *rt2x00dev, | |||
407 | sizeof(key_entry.rx_mic)); | 401 | sizeof(key_entry.rx_mic)); |
408 | 402 | ||
409 | reg = PAIRWISE_KEY_ENTRY(key->hw_key_idx); | 403 | reg = PAIRWISE_KEY_ENTRY(key->hw_key_idx); |
410 | timeout = REGISTER_TIMEOUT32(sizeof(key_entry)); | 404 | rt2x00usb_register_multiwrite(rt2x00dev, reg, |
411 | rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE, | 405 | &key_entry, sizeof(key_entry)); |
412 | USB_VENDOR_REQUEST_OUT, reg, | ||
413 | &key_entry, | ||
414 | sizeof(key_entry), | ||
415 | timeout); | ||
416 | 406 | ||
417 | /* | 407 | /* |
418 | * Send the address and cipher type to the hardware register. | 408 | * Send the address and cipher type to the hardware register. |
419 | * This data fits within the CSR cache size, so we can use | ||
420 | * rt2x00usb_register_multiwrite() directly. | ||
421 | */ | 409 | */ |
422 | memset(&addr_entry, 0, sizeof(addr_entry)); | 410 | memset(&addr_entry, 0, sizeof(addr_entry)); |
423 | memcpy(&addr_entry, crypto->address, ETH_ALEN); | 411 | memcpy(&addr_entry, crypto->address, ETH_ALEN); |
@@ -1092,11 +1080,7 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, | |||
1092 | /* | 1080 | /* |
1093 | * Write firmware to device. | 1081 | * Write firmware to device. |
1094 | */ | 1082 | */ |
1095 | rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE, | 1083 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, data, len); |
1096 | USB_VENDOR_REQUEST_OUT, | ||
1097 | FIRMWARE_IMAGE_BASE, | ||
1098 | data, len, | ||
1099 | REGISTER_TIMEOUT32(len)); | ||
1100 | 1084 | ||
1101 | /* | 1085 | /* |
1102 | * Send firmware request to device to load firmware, | 1086 | * Send firmware request to device to load firmware, |
@@ -1548,10 +1532,8 @@ static void rt73usb_write_beacon(struct queue_entry *entry, | |||
1548 | * Write entire beacon with descriptor to register. | 1532 | * Write entire beacon with descriptor to register. |
1549 | */ | 1533 | */ |
1550 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 1534 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
1551 | rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE, | 1535 | rt2x00usb_register_multiwrite(rt2x00dev, beacon_base, |
1552 | USB_VENDOR_REQUEST_OUT, beacon_base, | 1536 | entry->skb->data, entry->skb->len); |
1553 | entry->skb->data, entry->skb->len, | ||
1554 | REGISTER_TIMEOUT32(entry->skb->len)); | ||
1555 | 1537 | ||
1556 | /* | 1538 | /* |
1557 | * Enable beaconing again. | 1539 | * Enable beaconing again. |