Merge 5.7-rc3 into staging-next
[sfrench/cifs-2.6.git] / drivers / staging / vt6656 / main_usb.c
index 7fda26bedbf9213a4bc5f4b670eb10687deb448b..aad97fcaf9c89e77caaa609977e6c791eee3029b 100644 (file)
@@ -702,8 +702,6 @@ static int vnt_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 
        priv->op_mode = vif->type;
 
-       vnt_set_bss_mode(priv);
-
        /* LED blink on TX */
        vnt_mac_set_led(priv, LEDSTS_STS, LEDSTS_INTER);
 
@@ -789,7 +787,6 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
                priv->basic_rates = conf->basic_rates;
 
                vnt_update_top_rates(priv);
-               vnt_set_bss_mode(priv);
 
                dev_dbg(&priv->usb->dev, "basic rates %x\n", conf->basic_rates);
        }
@@ -818,10 +815,13 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
                        priv->short_slot_time = false;
 
                vnt_set_short_slot_time(priv);
-               vnt_update_ifs(priv);
                vnt_set_vga_gain_offset(priv, priv->bb_vga[0]);
        }
 
+       if (changed & (BSS_CHANGED_BASIC_RATES | BSS_CHANGED_ERP_PREAMBLE |
+                      BSS_CHANGED_ERP_SLOT))
+               vnt_set_bss_mode(priv);
+
        if (changed & (BSS_CHANGED_TXPOWER | BSS_CHANGED_BANDWIDTH))
                vnt_rf_setpower(priv, conf->chandef.chan);
 
@@ -844,12 +844,15 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
                        vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL,
                                            TFTCTL_TSFCNTREN);
 
-                       vnt_adjust_tsf(priv, conf->beacon_rate->hw_value,
-                                      conf->sync_tsf, priv->current_tsf);
-
                        vnt_mac_set_beacon_interval(priv, conf->beacon_int);
 
                        vnt_reset_next_tbtt(priv, conf->beacon_int);
+
+                       vnt_adjust_tsf(priv, conf->beacon_rate->hw_value,
+                                      conf->sync_tsf, priv->current_tsf);
+
+                       vnt_update_next_tbtt(priv,
+                                            conf->sync_tsf, conf->beacon_int);
                } else {
                        vnt_clear_current_tsf(priv);
 
@@ -883,15 +886,11 @@ static void vnt_configure(struct ieee80211_hw *hw,
 {
        struct vnt_private *priv = hw->priv;
        u8 rx_mode = 0;
-       int rc;
 
        *total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC;
 
-       rc = vnt_control_in(priv, MESSAGE_TYPE_READ, MAC_REG_RCR,
-                           MESSAGE_REQUEST_MACREG, sizeof(u8), &rx_mode);
-
-       if (!rc)
-               rx_mode = RCR_MULTICAST | RCR_BROADCAST;
+       vnt_control_in(priv, MESSAGE_TYPE_READ, MAC_REG_RCR,
+                      MESSAGE_REQUEST_MACREG, sizeof(u8), &rx_mode);
 
        dev_dbg(&priv->usb->dev, "rx mode in = %x\n", rx_mode);
 
@@ -930,8 +929,12 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
        case SET_KEY:
                return vnt_set_keys(hw, sta, vif, key);
        case DISABLE_KEY:
-               if (test_bit(key->hw_key_idx, &priv->key_entry_inuse))
+               if (test_bit(key->hw_key_idx, &priv->key_entry_inuse)) {
                        clear_bit(key->hw_key_idx, &priv->key_entry_inuse);
+
+                       vnt_mac_disable_keyentry(priv, key->hw_key_idx);
+               }
+
        default:
                break;
        }