rt2x00: Move bssidx calculation into its own function
authorHelmut Schaa <helmut.schaa@googlemail.com>
Thu, 8 Sep 2011 12:34:22 +0000 (14:34 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 14 Sep 2011 17:56:53 +0000 (13:56 -0400)
This will be used by a later patch. No functional changes.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00mac.c

index f82bfeb79ebb67dc73c8d85cb434ab0b0cdacb7e..d454ec8f5c6f9ed30d8610c47efdb41482fc66e4 100644 (file)
@@ -1225,6 +1225,12 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
 }
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 
+/*
+ * Utility functions.
+ */
+u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
+                        struct ieee80211_vif *vif);
+
 /*
  * Interrupt context handlers.
  */
index 92ff6a72a2bb422771c85788cda715ed797068c2..634b084a6527a0e6c5d5f3697c0ae05aa85c1cd6 100644 (file)
 #include "rt2x00.h"
 #include "rt2x00lib.h"
 
+/*
+ * Utility functions.
+ */
+u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
+                        struct ieee80211_vif *vif)
+{
+       /*
+        * When in STA mode, bssidx is always 0 otherwise local_address[5]
+        * contains the bss number, see BSS_ID_MASK comments for details.
+        */
+       if (rt2x00dev->intf_sta_count)
+               return 0;
+       return vif->addr[5] & (rt2x00dev->ops->max_ap_intf - 1);
+}
+EXPORT_SYMBOL_GPL(rt2x00lib_get_bssidx);
+
 /*
  * Radio control handlers.
  */
index 4ccf238059730cf20e589d9f567e35a3af3f189d..9db9378820bf19e8d51df0ca05cceb932c429e9a 100644 (file)
@@ -504,15 +504,7 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
        memset(&crypto, 0, sizeof(crypto));
 
-       /*
-        * When in STA mode, bssidx is always 0 otherwise local_address[5]
-        * contains the bss number, see BSS_ID_MASK comments for details.
-        */
-       if (rt2x00dev->intf_sta_count)
-               crypto.bssidx = 0;
-       else
-               crypto.bssidx = vif->addr[5] & (rt2x00dev->ops->max_ap_intf - 1);
-
+       crypto.bssidx = rt2x00lib_get_bssidx(rt2x00dev, vif);
        crypto.cipher = rt2x00crypto_key_to_cipher(key);
        if (crypto.cipher == CIPHER_NONE)
                return -EOPNOTSUPP;