Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6
[pandora-kernel.git] / drivers / net / wireless / mwifiex / cmdevt.c
index b75cc92..b5352af 100644 (file)
@@ -91,7 +91,7 @@ mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter,
        cmd_node->wait_q_enabled = false;
 
        if (cmd_node->resp_skb) {
-               mwifiex_recv_complete(adapter, cmd_node->resp_skb, 0);
+               dev_kfree_skb_any(cmd_node->resp_skb);
                cmd_node->resp_skb = NULL;
        }
 }
@@ -104,13 +104,11 @@ mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter,
  * main thread.
  */
 static int mwifiex_cmd_host_cmd(struct mwifiex_private *priv,
-                               struct host_cmd_ds_command *cmd, void *data_buf)
+                               struct host_cmd_ds_command *cmd,
+                               struct mwifiex_ds_misc_cmd *pcmd_ptr)
 {
-       struct mwifiex_ds_misc_cmd *pcmd_ptr =
-               (struct mwifiex_ds_misc_cmd *) data_buf;
-
        /* Copy the HOST command to command buffer */
-       memcpy((void *) cmd, pcmd_ptr->cmd, pcmd_ptr->len);
+       memcpy(cmd, pcmd_ptr->cmd, pcmd_ptr->len);
        dev_dbg(priv->adapter->dev, "cmd: host cmd size = %d\n", pcmd_ptr->len);
        return 0;
 }
@@ -223,24 +221,23 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
 static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
 {
        int ret;
-       u16 cmd_len;
        struct mwifiex_private *priv;
-       struct mwifiex_opt_sleep_confirm_buffer *sleep_cfm_buf =
-                               (struct mwifiex_opt_sleep_confirm_buffer *)
+       struct mwifiex_opt_sleep_confirm *sleep_cfm_buf =
+                               (struct mwifiex_opt_sleep_confirm *)
                                adapter->sleep_cfm->data;
-       cmd_len = sizeof(struct mwifiex_opt_sleep_confirm);
        priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
 
-       sleep_cfm_buf->ps_cfm_sleep.seq_num =
+       sleep_cfm_buf->seq_num =
                cpu_to_le16((HostCmd_SET_SEQ_NO_BSS_INFO
                                        (adapter->seq_num, priv->bss_num,
                                         priv->bss_type)));
        adapter->seq_num++;
 
+       skb_push(adapter->sleep_cfm, INTF_HEADER_LEN);
        ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD,
                                             adapter->sleep_cfm->data,
-                                            adapter->sleep_cfm->len +
-                                            INTF_HEADER_LEN, NULL);
+                                            adapter->sleep_cfm->len, NULL);
+       skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN);
 
        if (ret == -1) {
                dev_err(adapter->dev, "SLEEP_CFM: failed\n");
@@ -249,14 +246,14 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
        }
        if (GET_BSS_ROLE(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY))
                        == MWIFIEX_BSS_ROLE_STA) {
-               if (!sleep_cfm_buf->ps_cfm_sleep.resp_ctrl)
+               if (!sleep_cfm_buf->resp_ctrl)
                        /* Response is not needed for sleep
                           confirm command */
                        adapter->ps_state = PS_STATE_SLEEP;
                else
                        adapter->ps_state = PS_STATE_SLEEP_CFM;
 
-               if (!sleep_cfm_buf->ps_cfm_sleep.resp_ctrl
+               if (!sleep_cfm_buf->resp_ctrl
                                && (adapter->is_hs_configured
                                        && !adapter->sleep_period.period)) {
                        adapter->pm_wakeup_card_req = true;
@@ -292,7 +289,7 @@ int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter)
        if (!cmd_array) {
                dev_err(adapter->dev, "%s: failed to alloc cmd_array\n",
                                __func__);
-               return -1;
+               return -ENOMEM;
        }
 
        adapter->cmd_pool = cmd_array;
@@ -340,7 +337,7 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter)
                }
                if (!cmd_array[i].resp_skb)
                        continue;
-               mwifiex_recv_complete(adapter, cmd_array[i].resp_skb, 0);
+               dev_kfree_skb_any(cmd_array[i].resp_skb);
        }
        /* Release struct cmd_ctrl_node */
        if (adapter->cmd_pool) {
@@ -403,7 +400,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
        adapter->event_cause = 0;
        adapter->event_skb = NULL;
 
-       mwifiex_recv_complete(adapter, skb, 0);
+       dev_kfree_skb_any(skb);
 
        return ret;
 }
@@ -708,15 +705,14 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
 
        if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) {
                /* Copy original response back to response buffer */
-               struct mwifiex_ds_misc_cmd *hostcmd = NULL;
+               struct mwifiex_ds_misc_cmd *hostcmd;
                uint16_t size = le16_to_cpu(resp->size);
                dev_dbg(adapter->dev, "info: host cmd resp size = %d\n", size);
                size = min_t(u16, size, MWIFIEX_SIZE_OF_CMD_BUFFER);
                if (adapter->curr_cmd->data_buf) {
-                       hostcmd = (struct mwifiex_ds_misc_cmd *)
-                                               adapter->curr_cmd->data_buf;
+                       hostcmd = adapter->curr_cmd->data_buf;
                        hostcmd->len = size;
-                       memcpy(hostcmd->cmd, (void *) resp, size);
+                       memcpy(hostcmd->cmd, resp, size);
                }
        }
        orig_cmdresp_no = le16_to_cpu(resp->command);
@@ -1156,7 +1152,7 @@ EXPORT_SYMBOL_GPL(mwifiex_process_sleep_confirm_resp);
 int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
                               struct host_cmd_ds_command *cmd,
                               u16 cmd_action, uint16_t ps_bitmap,
-                              void *data_buf)
+                              struct mwifiex_ds_auto_ds *auto_ds)
 {
        struct host_cmd_ds_802_11_ps_mode_enh *psmode_enh =
                &cmd->params.psmode_enh;
@@ -1219,9 +1215,8 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
                                        sizeof(struct mwifiex_ie_types_header));
                        cmd_size += sizeof(*auto_ds_tlv);
                        tlv += sizeof(*auto_ds_tlv);
-                       if (data_buf)
-                               idletime = ((struct mwifiex_ds_auto_ds *)
-                                            data_buf)->idle_time;
+                       if (auto_ds)
+                               idletime = auto_ds->idle_time;
                        dev_dbg(priv->adapter->dev,
                                        "cmd: PS Command: Enter Auto Deep Sleep\n");
                        auto_ds_tlv->deep_sleep_timeout = cpu_to_le16(idletime);
@@ -1240,7 +1235,7 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
  */
 int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
                               struct host_cmd_ds_command *resp,
-                              void *data_buf)
+                              struct mwifiex_ds_pm_cfg *pm_cfg)
 {
        struct mwifiex_adapter *adapter = priv->adapter;
        struct host_cmd_ds_802_11_ps_mode_enh *ps_mode =
@@ -1283,10 +1278,8 @@ int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
 
                dev_dbg(adapter->dev, "cmd: ps_bitmap=%#x\n", ps_bitmap);
 
-               if (data_buf) {
+               if (pm_cfg) {
                        /* This section is for get power save mode */
-                       struct mwifiex_ds_pm_cfg *pm_cfg =
-                                       (struct mwifiex_ds_pm_cfg *)data_buf;
                        if (ps_bitmap & BITMAP_STA_PS)
                                pm_cfg->param.ps_mode = 1;
                        else