Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / ath / ath6kl / cfg80211.c
index 752ffc4f4166df35aaf782d7895ebb9e44fe3bdd..5c9736a94e544d0c9008480ac994c593d1b4d269 100644 (file)
@@ -402,7 +402,7 @@ static bool ath6kl_is_valid_iftype(struct ath6kl *ar, enum nl80211_iftype type,
        if (type == NL80211_IFTYPE_STATION ||
            type == NL80211_IFTYPE_AP || type == NL80211_IFTYPE_ADHOC) {
                for (i = 0; i < ar->vif_max; i++) {
-                       if ((ar->avail_idx_map >> i) & BIT(0)) {
+                       if ((ar->avail_idx_map) & BIT(i)) {
                                *if_idx = i;
                                return true;
                        }
@@ -412,7 +412,7 @@ static bool ath6kl_is_valid_iftype(struct ath6kl *ar, enum nl80211_iftype type,
        if (type == NL80211_IFTYPE_P2P_CLIENT ||
            type == NL80211_IFTYPE_P2P_GO) {
                for (i = ar->max_norm_iface; i < ar->vif_max; i++) {
-                       if ((ar->avail_idx_map >> i) & BIT(0)) {
+                       if ((ar->avail_idx_map) & BIT(i)) {
                                *if_idx = i;
                                return true;
                        }
@@ -1535,7 +1535,9 @@ static int ath6kl_cfg80211_del_iface(struct wiphy *wiphy,
 
        ath6kl_cfg80211_vif_stop(vif, test_bit(WMI_READY, &ar->flag));
 
+       rtnl_lock();
        ath6kl_cfg80211_vif_cleanup(vif);
+       rtnl_unlock();
 
        return 0;
 }
@@ -2990,13 +2992,15 @@ static int ath6kl_change_station(struct wiphy *wiphy, struct net_device *dev,
 {
        struct ath6kl *ar = ath6kl_priv(dev);
        struct ath6kl_vif *vif = netdev_priv(dev);
+       int err;
 
        if (vif->nw_type != AP_NETWORK)
                return -EOPNOTSUPP;
 
-       /* Use this only for authorizing/unauthorizing a station */
-       if (!(params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)))
-               return -EOPNOTSUPP;
+       err = cfg80211_check_station_change(wiphy, params,
+                                           CFG80211_STA_AP_MLME_CLIENT);
+       if (err)
+               return err;
 
        if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED))
                return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx,
@@ -3659,7 +3663,6 @@ struct wireless_dev *ath6kl_interface_add(struct ath6kl *ar, const char *name,
        vif->sme_state = SME_DISCONNECTED;
        set_bit(WLAN_ENABLED, &vif->flags);
        ar->wlan_pwr_state = WLAN_POWER_STATE_ON;
-       set_bit(NETDEV_REGISTERED, &vif->flags);
 
        if (type == NL80211_IFTYPE_ADHOC)
                ar->ibss_if_active = true;