Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / net / wireless / mwifiex / cmdevt.c
index 51e023ec1de4e634638575fc561206cd481fdbd7..225c1a4feeba8f7054f24d016f7380d442948f6a 100644 (file)
@@ -170,7 +170,20 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
        cmd_code = le16_to_cpu(host_cmd->command);
        cmd_size = le16_to_cpu(host_cmd->size);
 
-       skb_trim(cmd_node->cmd_skb, cmd_size);
+       /* Adjust skb length */
+       if (cmd_node->cmd_skb->len > cmd_size)
+               /*
+                * cmd_size is less than sizeof(struct host_cmd_ds_command).
+                * Trim off the unused portion.
+                */
+               skb_trim(cmd_node->cmd_skb, cmd_size);
+       else if (cmd_node->cmd_skb->len < cmd_size)
+               /*
+                * cmd_size is larger than sizeof(struct host_cmd_ds_command)
+                * because we have appended custom IE TLV. Increase skb length
+                * accordingly.
+                */
+               skb_put(cmd_node->cmd_skb, cmd_size - cmd_node->cmd_skb->len);
 
        do_gettimeofday(&tstamp);
        dev_dbg(adapter->dev, "cmd: DNLD_CMD: (%lu.%lu): %#x, act %#x, len %d,"
@@ -447,7 +460,10 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
                        priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
        }
 
-       ret = mwifiex_process_sta_event(priv);
+       if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP)
+               ret = mwifiex_process_uap_event(priv);
+       else
+               ret = mwifiex_process_sta_event(priv);
 
        adapter->event_cause = 0;
        adapter->event_skb = NULL;
@@ -578,6 +594,7 @@ int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no,
        } else {
                adapter->cmd_queued = cmd_node;
                mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true);
+               queue_work(adapter->workqueue, &adapter->main_work);
        }
 
        return ret;
@@ -1102,7 +1119,8 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
                &resp->params.opt_hs_cfg;
        uint32_t conditions = le32_to_cpu(phs_cfg->params.hs_config.conditions);
 
-       if (phs_cfg->action == cpu_to_le16(HS_ACTIVATE)) {
+       if (phs_cfg->action == cpu_to_le16(HS_ACTIVATE) &&
+           adapter->iface_type == MWIFIEX_SDIO) {
                mwifiex_hs_activated_event(priv, true);
                return 0;
        } else {
@@ -1114,6 +1132,9 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
        }
        if (conditions != HOST_SLEEP_CFG_CANCEL) {
                adapter->is_hs_configured = true;
+               if (adapter->iface_type == MWIFIEX_USB ||
+                   adapter->iface_type == MWIFIEX_PCIE)
+                       mwifiex_hs_activated_event(priv, true);
        } else {
                adapter->is_hs_configured = false;
                if (adapter->hs_activated)