drivers/net: Convert compare_ether_addr to ether_addr_equal
[deliverable/linux.git] / drivers / net / wireless / iwlegacy / common.c
index e5ac04739bcc5f998487c7e29845ce0a757727fa..cbf2dc18341f58eec6141158e0c6d3aaad02d12b 100644 (file)
@@ -1896,8 +1896,8 @@ il_prep_station(struct il_priv *il, const u8 *addr, bool is_ap,
                sta_id = il->hw_params.bcast_id;
        else
                for (i = IL_STA_ID; i < il->hw_params.max_stations; i++) {
-                       if (!compare_ether_addr
-                           (il->stations[i].sta.sta.addr, addr)) {
+                       if (ether_addr_equal(il->stations[i].sta.sta.addr,
+                                            addr)) {
                                sta_id = i;
                                break;
                        }
@@ -1926,7 +1926,7 @@ il_prep_station(struct il_priv *il, const u8 *addr, bool is_ap,
 
        if ((il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) &&
            (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE) &&
-           !compare_ether_addr(il->stations[sta_id].sta.sta.addr, addr)) {
+           ether_addr_equal(il->stations[sta_id].sta.sta.addr, addr)) {
                D_ASSOC("STA %d (%pM) already added, not adding again.\n",
                        sta_id, addr);
                return sta_id;
@@ -3744,10 +3744,10 @@ il_full_rxon_required(struct il_priv *il)
 
        /* These items are only settable from the full RXON command */
        CHK(!il_is_associated(il));
-       CHK(compare_ether_addr(staging->bssid_addr, active->bssid_addr));
-       CHK(compare_ether_addr(staging->node_addr, active->node_addr));
-       CHK(compare_ether_addr
-           (staging->wlap_bssid_addr, active->wlap_bssid_addr));
+       CHK(!ether_addr_equal(staging->bssid_addr, active->bssid_addr));
+       CHK(!ether_addr_equal(staging->node_addr, active->node_addr));
+       CHK(!ether_addr_equal(staging->wlap_bssid_addr,
+                             active->wlap_bssid_addr));
        CHK_NEQ(staging->dev_type, active->dev_type);
        CHK_NEQ(staging->channel, active->channel);
        CHK_NEQ(staging->air_propagation, active->air_propagation);
@@ -4508,6 +4508,7 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
        struct il_priv *il = hw->priv;
        int err;
+       bool reset;
 
        mutex_lock(&il->mutex);
        D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr);
@@ -4518,7 +4519,12 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
                goto out;
        }
 
-       if (il->vif) {
+       /*
+        * We do not support multiple virtual interfaces, but on hardware reset
+        * we have to add the same interface again.
+        */
+       reset = (il->vif == vif);
+       if (il->vif && !reset) {
                err = -EOPNOTSUPP;
                goto out;
        }
@@ -4528,8 +4534,11 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 
        err = il_set_mode(il);
        if (err) {
-               il->vif = NULL;
-               il->iw_mode = NL80211_IFTYPE_STATION;
+               IL_WARN("Fail to set mode %d\n", vif->type);
+               if (!reset) {
+                       il->vif = NULL;
+                       il->iw_mode = NL80211_IFTYPE_STATION;
+               }
        }
 
 out:
@@ -5279,9 +5288,9 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                D_MAC80211("BSSID %pM\n", bss_conf->bssid);
 
                /*
-                * If there is currently a HW scan going on in the
-                * background then we need to cancel it else the RXON
-                * below/in post_associate will fail.
+                * If there is currently a HW scan going on in the background,
+                * then we need to cancel it, otherwise sometimes we are not
+                * able to authenticate (FIXME: why ?)
                 */
                if (il_scan_cancel_timeout(il, 100)) {
                        D_MAC80211("leave - scan abort failed\n");
@@ -5290,14 +5299,10 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                }
 
                /* mac80211 only sets assoc when in STATION mode */
-               if (vif->type == NL80211_IFTYPE_ADHOC || bss_conf->assoc) {
-                       memcpy(il->staging.bssid_addr, bss_conf->bssid,
-                              ETH_ALEN);
+               memcpy(il->staging.bssid_addr, bss_conf->bssid, ETH_ALEN);
 
-                       /* currently needed in a few places */
-                       memcpy(il->bssid, bss_conf->bssid, ETH_ALEN);
-               } else
-                       il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
+               /* FIXME: currently needed in a few places */
+               memcpy(il->bssid, bss_conf->bssid, ETH_ALEN);
        }
 
        /*
This page took 0.034333 seconds and 5 git commands to generate.