mwifiex: add custom IE framework
[deliverable/linux.git] / drivers / net / wireless / mwifiex / init.c
index 54bb4839b57c7cc8f2e1dc4c11ab7f97896bbd9f..c1cb004db913cd0064c55758962900f2ed5aa04f 100644 (file)
@@ -131,6 +131,8 @@ static int mwifiex_init_priv(struct mwifiex_private *priv)
        priv->wmm_qosinfo = 0;
        priv->curr_bcn_buf = NULL;
        priv->curr_bcn_size = 0;
+       priv->wps_ie = NULL;
+       priv->wps_ie_len = 0;
 
        priv->scan_block = false;
 
@@ -186,10 +188,10 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
 
        adapter->cmd_sent = false;
 
-       if (adapter->iface_type == MWIFIEX_PCIE)
-               adapter->data_sent = false;
-       else
+       if (adapter->iface_type == MWIFIEX_SDIO)
                adapter->data_sent = true;
+       else
+               adapter->data_sent = false;
 
        adapter->cmd_resp_received = false;
        adapter->event_received = false;
@@ -277,6 +279,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
        memset(&adapter->arp_filter, 0, sizeof(adapter->arp_filter));
        adapter->arp_filter_size = 0;
        adapter->channel_type = NL80211_CHAN_HT20;
+       adapter->max_mgmt_ie_index = MAX_MGMT_IE_INDEX;
 }
 
 /*
@@ -377,7 +380,8 @@ mwifiex_free_adapter(struct mwifiex_adapter *adapter)
 
        dev_dbg(adapter->dev, "info: free scan table\n");
 
-       adapter->if_ops.cleanup_if(adapter);
+       if (adapter->if_ops.cleanup_if)
+               adapter->if_ops.cleanup_if(adapter);
 
        if (adapter->sleep_cfm)
                dev_kfree_skb_any(adapter->sleep_cfm);
@@ -417,6 +421,8 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter)
        spin_lock_init(&adapter->cmd_pending_q_lock);
        spin_lock_init(&adapter->scan_pending_q_lock);
 
+       skb_queue_head_init(&adapter->usb_rx_data_q);
+
        for (i = 0; i < adapter->priv_num; ++i) {
                INIT_LIST_HEAD(&adapter->bss_prio_tbl[i].bss_prio_head);
                adapter->bss_prio_tbl[i].bss_prio_cur = NULL;
@@ -572,6 +578,7 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
        struct mwifiex_private *priv;
        s32 i;
        unsigned long flags;
+       struct sk_buff *skb;
 
        /* mwifiex already shutdown */
        if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY)
@@ -599,6 +606,18 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
 
        spin_lock_irqsave(&adapter->mwifiex_lock, flags);
 
+       if (adapter->if_ops.data_complete) {
+               while ((skb = skb_dequeue(&adapter->usb_rx_data_q))) {
+                       struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
+
+                       priv = adapter->priv[rx_info->bss_num];
+                       if (priv)
+                               priv->stats.rx_dropped++;
+
+                       adapter->if_ops.data_complete(adapter, skb);
+               }
+       }
+
        /* Free adapter structure */
        mwifiex_free_adapter(adapter);
 
@@ -628,24 +647,28 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,
        int ret;
        u32 poll_num = 1;
 
-       adapter->winner = 0;
+       if (adapter->if_ops.check_fw_status) {
+               adapter->winner = 0;
 
-       /* Check if firmware is already running */
-       ret = adapter->if_ops.check_fw_status(adapter, poll_num);
-       if (!ret) {
-               dev_notice(adapter->dev,
-                          "WLAN FW already running! Skip FW download\n");
-               goto done;
-       }
-       poll_num = MAX_FIRMWARE_POLL_TRIES;
-
-       /* Check if we are the winner for downloading FW */
-       if (!adapter->winner) {
-               dev_notice(adapter->dev,
-                          "Other intf already running! Skip FW download\n");
-               poll_num = MAX_MULTI_INTERFACE_POLL_TRIES;
-               goto poll_fw;
+               /* check if firmware is already running */
+               ret = adapter->if_ops.check_fw_status(adapter, poll_num);
+               if (!ret) {
+                       dev_notice(adapter->dev,
+                                  "WLAN FW already running! Skip FW dnld\n");
+                       goto done;
+               }
+
+               poll_num = MAX_FIRMWARE_POLL_TRIES;
+
+               /* check if we are the winner for downloading FW */
+               if (!adapter->winner) {
+                       dev_notice(adapter->dev,
+                                  "FW already running! Skip FW dnld\n");
+                       poll_num = MAX_MULTI_INTERFACE_POLL_TRIES;
+                       goto poll_fw;
+               }
        }
+
        if (pmfw) {
                /* Download firmware with helper */
                ret = adapter->if_ops.prog_fw(adapter, pmfw);
@@ -664,6 +687,8 @@ poll_fw:
        }
 done:
        /* re-enable host interrupt for mwifiex after fw dnld is successful */
-       adapter->if_ops.enable_int(adapter);
+       if (adapter->if_ops.enable_int)
+               adapter->if_ops.enable_int(adapter);
+
        return ret;
 }
This page took 0.034438 seconds and 5 git commands to generate.