Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / mwifiex / sta_ioctl.c
index f542bb8ccbc8d4ce6859e8fff1e45784183f8fbb..8c943b6ebf4512034eb17349a9bb320c8f66cb4e 100644 (file)
@@ -54,16 +54,10 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
  * This function waits on a cmd wait queue. It also cancels the pending
  * request after waking up, in case of errors.
  */
-int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter)
+int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
+                               struct cmd_ctrl_node *cmd_queued)
 {
        int status;
-       struct cmd_ctrl_node *cmd_queued;
-
-       if (!adapter->cmd_queued)
-               return 0;
-
-       cmd_queued = adapter->cmd_queued;
-       adapter->cmd_queued = NULL;
 
        dev_dbg(adapter->dev, "cmd pending\n");
        atomic_inc(&adapter->cmd_pending);
@@ -162,13 +156,9 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
 
        rcu_read_lock();
        ies = rcu_dereference(bss->ies);
-       if (WARN_ON(!ies)) {
-               /* should never happen */
-               rcu_read_unlock();
-               return -EINVAL;
-       }
        beacon_ie = kmemdup(ies->data, ies->len, GFP_ATOMIC);
        beacon_ie_len = ies->len;
+       bss_desc->timestamp = ies->tsf;
        rcu_read_unlock();
 
        if (!beacon_ie) {
@@ -184,7 +174,6 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
        bss_desc->cap_info_bitmap = bss->capability;
        bss_desc->bss_band = bss_priv->band;
        bss_desc->fw_tsf = bss_priv->fw_tsf;
-       bss_desc->timestamp = bss->tsf;
        if (bss_desc->cap_info_bitmap & WLAN_CAPABILITY_PRIVACY) {
                dev_dbg(priv->adapter->dev, "info: InterpretIE: AP WEP enabled\n");
                bss_desc->privacy = MWIFIEX_802_11_PRIV_FILTER_8021X_WEP;
@@ -266,11 +255,9 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
 
                /* Allocate and fill new bss descriptor */
                bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor),
-                               GFP_KERNEL);
-               if (!bss_desc) {
-                       dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
+                                  GFP_KERNEL);
+               if (!bss_desc)
                        return -ENOMEM;
-               }
 
                ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc);
                if (ret)
@@ -288,9 +275,10 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
 
                        if (mwifiex_band_to_radio_type((u8) bss_desc->bss_band)
                            == HostCmd_SCAN_RADIO_TYPE_BG)
-                               config_bands = BAND_B | BAND_G | BAND_GN;
+                               config_bands = BAND_B | BAND_G | BAND_GN |
+                                              BAND_GAC;
                        else
-                               config_bands = BAND_A | BAND_AN;
+                               config_bands = BAND_A | BAND_AN | BAND_AAC;
 
                        if (!((config_bands | adapter->fw_bands) &
                              ~adapter->fw_bands))
@@ -324,7 +312,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
                }
 
                if (bss)
-                       cfg80211_put_bss(bss);
+                       cfg80211_put_bss(priv->adapter->wiphy, bss);
        } else {
                /* Adhoc mode */
                /* If the requested SSID matches current SSID, return */
@@ -354,7 +342,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
                                                        " list. Joining...\n");
                        ret = mwifiex_adhoc_join(priv, bss_desc);
                        if (bss)
-                               cfg80211_put_bss(bss);
+                               cfg80211_put_bss(priv->adapter->wiphy, bss);
                } else {
                        dev_dbg(adapter->dev, "info: Network not found in "
                                "the list, creating adhoc with ssid = %s\n",
@@ -394,7 +382,7 @@ static int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
                        break;
                }
                if (hs_cfg->is_invoke_hostcmd) {
-                       if (hs_cfg->conditions == HOST_SLEEP_CFG_CANCEL) {
+                       if (hs_cfg->conditions == HS_CFG_CANCEL) {
                                if (!adapter->is_hs_configured)
                                        /* Already cancelled */
                                        break;
@@ -409,8 +397,8 @@ static int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
                                adapter->hs_cfg.gpio = (u8)hs_cfg->gpio;
                                if (hs_cfg->gap)
                                        adapter->hs_cfg.gap = (u8)hs_cfg->gap;
-                       } else if (adapter->hs_cfg.conditions
-                                  == cpu_to_le32(HOST_SLEEP_CFG_CANCEL)) {
+                       } else if (adapter->hs_cfg.conditions ==
+                                  cpu_to_le32(HS_CFG_CANCEL)) {
                                /* Return failure if no parameters for HS
                                   enable */
                                status = -1;
@@ -426,7 +414,7 @@ static int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
                                                HostCmd_CMD_802_11_HS_CFG_ENH,
                                                HostCmd_ACT_GEN_SET, 0,
                                                &adapter->hs_cfg);
-                       if (hs_cfg->conditions == HOST_SLEEP_CFG_CANCEL)
+                       if (hs_cfg->conditions == HS_CFG_CANCEL)
                                /* Restore previous condition */
                                adapter->hs_cfg.conditions =
                                                cpu_to_le32(prev_cond);
@@ -460,7 +448,7 @@ int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type)
 {
        struct mwifiex_ds_hs_cfg hscfg;
 
-       hscfg.conditions = HOST_SLEEP_CFG_CANCEL;
+       hscfg.conditions = HS_CFG_CANCEL;
        hscfg.is_invoke_hostcmd = true;
 
        return mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_SET,
@@ -636,11 +624,8 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
                }
        }
        buf = kzalloc(MWIFIEX_SIZE_OF_CMD_BUFFER, GFP_KERNEL);
-       if (!buf) {
-               dev_err(priv->adapter->dev, "%s: failed to alloc cmd buffer\n",
-                       __func__);
+       if (!buf)
                return -ENOMEM;
-       }
 
        txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf;
        txp_cfg->action = cpu_to_le16(HostCmd_ACT_GEN_SET);