rt2x00: Clean up USB vendor request buffer functions.
authorGertjan van Wingerde <gwingerde@gmail.com>
Thu, 3 Jun 2010 08:51:51 +0000 (10:51 +0200)
committerIvo van Doorn <IvDoorn@gmail.com>
Thu, 3 Jun 2010 08:51:51 +0000 (10:51 +0200)
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>
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt2x00usb.h
drivers/net/wireless/rt2x00/rt73usb.c

index 9dab1dccdaff063185a348e1e84d6e2aee61d1eb..002db646ae0b0e0c985ebc523ca60c0a7b3b736e 100644 (file)
@@ -345,7 +345,6 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
                                struct rt2x00lib_crypto *crypto,
                                struct ieee80211_key_conf *key)
 {
-       int timeout;
        u32 mask;
        u16 reg;
 
@@ -367,18 +366,8 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
 
                key->hw_key_idx += reg ? ffz(reg) : 0;
 
-               /*
-                * The encryption key doesn't fit within the CSR cache,
-                * this means we should allocate it separately and use
-                * rt2x00usb_vendor_request() to send the key to the hardware.
-                */
-               reg = KEY_ENTRY(key->hw_key_idx);
-               timeout = REGISTER_TIMEOUT32(sizeof(crypto->key));
-               rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
-                                                   USB_VENDOR_REQUEST_OUT, reg,
-                                                   crypto->key,
-                                                   sizeof(crypto->key),
-                                                   timeout);
+               rt2500usb_register_multiwrite(rt2x00dev, reg,
+                                             crypto->key, sizeof(crypto->key));
 
                /*
                 * The driver does not support the IV/EIV generation
index c697066152d7c4ee61878e10fc6b4597c464bb44..c69628d943de96fb35f1a1b881121f6795099c58 100644 (file)
@@ -169,11 +169,8 @@ static int rt2800usb_load_firmware(struct rt2x00_dev *rt2x00dev,
        /*
         * Write firmware to device.
         */
-       rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
-                                           USB_VENDOR_REQUEST_OUT,
-                                           FIRMWARE_IMAGE_BASE,
-                                           data + offset, length,
-                                           REGISTER_TIMEOUT32(length));
+       rt2800_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
+                                  data + offset, length);
 
        rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
        rt2800_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);
@@ -478,10 +475,8 @@ static void rt2800usb_write_beacon(struct queue_entry *entry,
         * Write entire beacon with descriptor to register.
         */
        beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
-       rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
-                                           USB_VENDOR_REQUEST_OUT, beacon_base,
-                                           entry->skb->data, entry->skb->len,
-                                           REGISTER_TIMEOUT32(entry->skb->len));
+       rt2800_register_multiwrite(rt2x00dev, beacon_base,
+                                  entry->skb->data, entry->skb->len);
 
        /*
         * Enable beaconing again.
index 5e123519f8cb589bb5d4292374cf3522059282ff..b45bc24c3daeb0ff239b8c14bcc67e7450b04f5b 100644 (file)
@@ -112,26 +112,6 @@ int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev,
                                  const u8 request, const u8 requesttype,
                                  const u16 offset, void *buffer,
                                  const u16 buffer_length, const int timeout)
-{
-       int status;
-
-       mutex_lock(&rt2x00dev->csr_mutex);
-
-       status = rt2x00usb_vendor_req_buff_lock(rt2x00dev, request,
-                                               requesttype, offset, buffer,
-                                               buffer_length, timeout);
-
-       mutex_unlock(&rt2x00dev->csr_mutex);
-
-       return status;
-}
-EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff);
-
-int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
-                                       const u8 request, const u8 requesttype,
-                                       const u16 offset, const void *buffer,
-                                       const u16 buffer_length,
-                                       const int timeout)
 {
        int status = 0;
        unsigned char *tb;
@@ -157,7 +137,7 @@ int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
 
        return status;
 }
-EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_large_buff);
+EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff);
 
 int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev,
                           const unsigned int offset,
index 621d0f8292514cf93079dbb6a553d9524bbc8d76..255b81ef95308ff16a145b57d7b49af72eb2a7de 100644 (file)
@@ -166,25 +166,6 @@ int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev,
                                   const u16 offset, void *buffer,
                                   const u16 buffer_length, const int timeout);
 
-/**
- * rt2x00usb_vendor_request_large_buff - Send register command to device (buffered)
- * @rt2x00dev: Pointer to &struct rt2x00_dev
- * @request: USB vendor command (See &enum rt2x00usb_vendor_request)
- * @requesttype: Request type &USB_VENDOR_REQUEST_*
- * @offset: Register start offset to perform action on
- * @buffer: Buffer where information will be read/written to by device
- * @buffer_length: Size of &buffer
- * @timeout: Operation timeout
- *
- * This function is used to transfer register data in blocks larger
- * then CSR_CACHE_SIZE. Use for firmware upload, keys and beacons.
- */
-int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
-                                       const u8 request, const u8 requesttype,
-                                       const u16 offset, const void *buffer,
-                                       const u16 buffer_length,
-                                       const int timeout);
-
 /**
  * rt2x00usb_vendor_request_sw - Send single register command to device
  * @rt2x00dev: Pointer to &struct rt2x00_dev
index 4ab38c3641cc020699a97c3c0234d6484a9728a1..113ad690f9d30956fa8ddea78ee1c080e410b5e7 100644 (file)
@@ -270,7 +270,6 @@ static int rt73usb_config_shared_key(struct rt2x00_dev *rt2x00dev,
 {
        struct hw_key_entry key_entry;
        struct rt2x00_field32 field;
-       int timeout;
        u32 mask;
        u32 reg;
 
@@ -306,12 +305,8 @@ static int rt73usb_config_shared_key(struct rt2x00_dev *rt2x00dev,
                       sizeof(key_entry.rx_mic));
 
                reg = SHARED_KEY_ENTRY(key->hw_key_idx);
-               timeout = REGISTER_TIMEOUT32(sizeof(key_entry));
-               rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
-                                                   USB_VENDOR_REQUEST_OUT, reg,
-                                                   &key_entry,
-                                                   sizeof(key_entry),
-                                                   timeout);
+               rt2x00usb_register_multiwrite(rt2x00dev, reg,
+                                             &key_entry, sizeof(key_entry));
 
                /*
                 * The cipher types are stored over 2 registers.
@@ -372,7 +367,6 @@ static int rt73usb_config_pairwise_key(struct rt2x00_dev *rt2x00dev,
 {
        struct hw_pairwise_ta_entry addr_entry;
        struct hw_key_entry key_entry;
-       int timeout;
        u32 mask;
        u32 reg;
 
@@ -407,17 +401,11 @@ static int rt73usb_config_pairwise_key(struct rt2x00_dev *rt2x00dev,
                       sizeof(key_entry.rx_mic));
 
                reg = PAIRWISE_KEY_ENTRY(key->hw_key_idx);
-               timeout = REGISTER_TIMEOUT32(sizeof(key_entry));
-               rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
-                                                   USB_VENDOR_REQUEST_OUT, reg,
-                                                   &key_entry,
-                                                   sizeof(key_entry),
-                                                   timeout);
+               rt2x00usb_register_multiwrite(rt2x00dev, reg,
+                                             &key_entry, sizeof(key_entry));
 
                /*
                 * Send the address and cipher type to the hardware register.
-                * This data fits within the CSR cache size, so we can use
-                * rt2x00usb_register_multiwrite() directly.
                 */
                memset(&addr_entry, 0, sizeof(addr_entry));
                memcpy(&addr_entry, crypto->address, ETH_ALEN);
@@ -1092,11 +1080,7 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev,
        /*
         * Write firmware to device.
         */
-       rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
-                                           USB_VENDOR_REQUEST_OUT,
-                                           FIRMWARE_IMAGE_BASE,
-                                           data, len,
-                                           REGISTER_TIMEOUT32(len));
+       rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, data, len);
 
        /*
         * Send firmware request to device to load firmware,
@@ -1548,10 +1532,8 @@ static void rt73usb_write_beacon(struct queue_entry *entry,
         * Write entire beacon with descriptor to register.
         */
        beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
-       rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
-                                           USB_VENDOR_REQUEST_OUT, beacon_base,
-                                           entry->skb->data, entry->skb->len,
-                                           REGISTER_TIMEOUT32(entry->skb->len));
+       rt2x00usb_register_multiwrite(rt2x00dev, beacon_base,
+                                     entry->skb->data, entry->skb->len);
 
        /*
         * Enable beaconing again.