rtlwifi: btcoex: Remove global variables from btcoex
authorPing-Ke Shih <pkshih@realtek.com>
Wed, 17 Jan 2018 06:15:27 +0000 (14:15 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 17 Jan 2018 15:09:15 +0000 (17:09 +0200)
Remove global variables, so btcoexist can support multiple instances
simultaneously.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
drivers/net/wireless/realtek/rtlwifi/pci.c
drivers/net/wireless/realtek/rtlwifi/wifi.h

index 873bf9303d5dbc883d9e6cf2cd542a08a657c355..606313ee472e5b03d3711625b80ebf184206de3c 100644 (file)
 
 #include "halbt_precomp.h"
 
-/***********************************************
- *             Global variables
- ***********************************************/
-
-struct btc_coexist gl_bt_coexist;
-
-u32 btc_dbg_type[BTC_MSG_MAX];
-
 /***************************************************
  *             Debug related function
  ***************************************************/
@@ -970,9 +962,12 @@ bool halbtc_under_ips(struct btc_coexist *btcoexist)
 /*****************************************************************
  *         Extern functions called by other module
  *****************************************************************/
-bool exhalbtc_initlize_variables(void)
+bool exhalbtc_initlize_variables(struct rtl_priv *rtlpriv)
 {
-       struct btc_coexist *btcoexist = &gl_bt_coexist;
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return false;
 
        halbtc_dbg_init();
 
@@ -1008,9 +1003,12 @@ bool exhalbtc_initlize_variables(void)
 
 bool exhalbtc_bind_bt_coex_withadapter(void *adapter)
 {
-       struct btc_coexist *btcoexist = &gl_bt_coexist;
        struct rtl_priv *rtlpriv = adapter;
-       u8 ant_num = 2, chip_type;
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+       u8 ant_num = 2, chip_type, single_ant_path = 0;
+
+       if (!btcoexist)
+               return false;
 
        if (btcoexist->binded)
                return false;
@@ -1041,10 +1039,16 @@ bool exhalbtc_bind_bt_coex_withadapter(void *adapter)
        btcoexist->bt_info.miracast_plus_bt = false;
 
        chip_type = rtl_get_hwpg_bt_type(rtlpriv);
-       exhalbtc_set_chip_type(chip_type);
+       exhalbtc_set_chip_type(btcoexist, chip_type);
        ant_num = rtl_get_hwpg_ant_num(rtlpriv);
        exhalbtc_set_ant_num(rtlpriv, BT_COEX_ANT_TYPE_PG, ant_num);
 
+       /* set default antenna position to main  port */
+       btcoexist->board_info.btdm_ant_pos = BTC_ANTENNA_AT_MAIN_PORT;
+
+       single_ant_path = rtl_get_hwpg_single_ant_path(rtlpriv);
+       exhalbtc_set_single_ant_path(btcoexist, single_ant_path);
+
        if (rtl_get_hwpg_package_type(rtlpriv) == 0)
                btcoexist->board_info.tfbga_package = false;
        else if (rtl_get_hwpg_package_type(rtlpriv) == 1)
@@ -1549,30 +1553,25 @@ void exhalbtc_stack_update_profile_info(void)
 {
 }
 
-void exhalbtc_update_min_bt_rssi(s8 bt_rssi)
+void exhalbtc_update_min_bt_rssi(struct btc_coexist *btcoexist, s8 bt_rssi)
 {
-       struct btc_coexist *btcoexist = &gl_bt_coexist;
-
        if (!halbtc_is_bt_coexist_available(btcoexist))
                return;
 
        btcoexist->stack_info.min_bt_rssi = bt_rssi;
 }
 
-void exhalbtc_set_hci_version(u16 hci_version)
+void exhalbtc_set_hci_version(struct btc_coexist *btcoexist, u16 hci_version)
 {
-       struct btc_coexist *btcoexist = &gl_bt_coexist;
-
        if (!halbtc_is_bt_coexist_available(btcoexist))
                return;
 
        btcoexist->stack_info.hci_version = hci_version;
 }
 
-void exhalbtc_set_bt_patch_version(u16 bt_hci_version, u16 bt_patch_version)
+void exhalbtc_set_bt_patch_version(struct btc_coexist *btcoexist,
+                                  u16 bt_hci_version, u16 bt_patch_version)
 {
-       struct btc_coexist *btcoexist = &gl_bt_coexist;
-
        if (!halbtc_is_bt_coexist_available(btcoexist))
                return;
 
@@ -1580,7 +1579,7 @@ void exhalbtc_set_bt_patch_version(u16 bt_hci_version, u16 bt_patch_version)
        btcoexist->bt_info.bt_hci_ver = bt_hci_version;
 }
 
-void exhalbtc_set_chip_type(u8 chip_type)
+void exhalbtc_set_chip_type(struct btc_coexist *btcoexist, u8 chip_type)
 {
        switch (chip_type) {
        default:
@@ -1588,48 +1587,54 @@ void exhalbtc_set_chip_type(u8 chip_type)
        case BT_ISSC_3WIRE:
        case BT_ACCEL:
        case BT_RTL8756:
-               gl_bt_coexist.board_info.bt_chip_type = BTC_CHIP_UNDEF;
+               btcoexist->board_info.bt_chip_type = BTC_CHIP_UNDEF;
                break;
        case BT_CSR_BC4:
-               gl_bt_coexist.board_info.bt_chip_type = BTC_CHIP_CSR_BC4;
+               btcoexist->board_info.bt_chip_type = BTC_CHIP_CSR_BC4;
                break;
        case BT_CSR_BC8:
-               gl_bt_coexist.board_info.bt_chip_type = BTC_CHIP_CSR_BC8;
+               btcoexist->board_info.bt_chip_type = BTC_CHIP_CSR_BC8;
                break;
        case BT_RTL8723A:
-               gl_bt_coexist.board_info.bt_chip_type = BTC_CHIP_RTL8723A;
+               btcoexist->board_info.bt_chip_type = BTC_CHIP_RTL8723A;
                break;
        case BT_RTL8821A:
-               gl_bt_coexist.board_info.bt_chip_type = BTC_CHIP_RTL8821;
+               btcoexist->board_info.bt_chip_type = BTC_CHIP_RTL8821;
                break;
        case BT_RTL8723B:
-               gl_bt_coexist.board_info.bt_chip_type = BTC_CHIP_RTL8723B;
+               btcoexist->board_info.bt_chip_type = BTC_CHIP_RTL8723B;
                break;
        }
 }
 
 void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num)
 {
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
+
        if (BT_COEX_ANT_TYPE_PG == type) {
-               gl_bt_coexist.board_info.pg_ant_num = ant_num;
-               gl_bt_coexist.board_info.btdm_ant_num = ant_num;
+               btcoexist->board_info.pg_ant_num = ant_num;
+               btcoexist->board_info.btdm_ant_num = ant_num;
        } else if (BT_COEX_ANT_TYPE_ANTDIV == type) {
-               gl_bt_coexist.board_info.btdm_ant_num = ant_num;
+               btcoexist->board_info.btdm_ant_num = ant_num;
        } else if (type == BT_COEX_ANT_TYPE_DETECTED) {
-               gl_bt_coexist.board_info.btdm_ant_num = ant_num;
+               btcoexist->board_info.btdm_ant_num = ant_num;
                if (rtlpriv->cfg->mod_params->ant_sel == 1)
-                       gl_bt_coexist.board_info.btdm_ant_pos =
+                       btcoexist->board_info.btdm_ant_pos =
                                BTC_ANTENNA_AT_AUX_PORT;
                else
-                       gl_bt_coexist.board_info.btdm_ant_pos =
+                       btcoexist->board_info.btdm_ant_pos =
                                BTC_ANTENNA_AT_MAIN_PORT;
        }
 }
 
 /* Currently used by 8723b only, S0 or S1 */
-void exhalbtc_set_single_ant_path(u8 single_ant_path)
+void exhalbtc_set_single_ant_path(struct btc_coexist *btcoexist,
+                                 u8 single_ant_path)
 {
-       gl_bt_coexist.board_info.single_ant_path = single_ant_path;
+       btcoexist->board_info.single_ant_path = single_ant_path;
 }
 
 void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist,
index bc523af7ef881bed8ee29c923a9f0ff6c5618353..5a7816ff6877ceb80a9677dce10fa65ba7ce198e 100644 (file)
@@ -103,8 +103,6 @@ enum btc_msg_type {
        BTC_MSG_MAX
 };
 
-extern u32 btc_dbg_type[];
-
 /* following is for BTC_MSG_INTERFACE */
 #define                INTF_INIT                               BIT0
 #define                INTF_NOTIFY                             BIT2
@@ -604,9 +602,10 @@ struct btc_coexist {
 
 bool halbtc_is_wifi_uplink(struct rtl_priv *adapter);
 
-extern struct btc_coexist gl_bt_coexist;
+#define rtl_btc_coexist(rtlpriv)                               \
+       ((struct btc_coexist *)((rtlpriv)->btcoexist.btc_context))
 
-bool exhalbtc_initlize_variables(void);
+bool exhalbtc_initlize_variables(struct rtl_priv *rtlpriv);
 bool exhalbtc_bind_bt_coex_withadapter(void *adapter);
 void exhalbtc_power_on_setting(struct btc_coexist *btcoexist);
 void exhalbtc_init_hw_config(struct btc_coexist *btcoexist, bool wifi_only);
@@ -628,11 +627,12 @@ void exhalbtc_periodical(struct btc_coexist *btcoexist);
 void exhalbtc_dbg_control(struct btc_coexist *btcoexist, u8 code, u8 len,
                          u8 *data);
 void exhalbtc_stack_update_profile_info(void);
-void exhalbtc_set_hci_version(u16 hci_version);
-void exhalbtc_set_bt_patch_version(u16 bt_hci_version, u16 bt_patch_version);
-void exhalbtc_update_min_bt_rssi(s8 bt_rssi);
-void exhalbtc_set_bt_exist(bool bt_exist);
-void exhalbtc_set_chip_type(u8 chip_type);
+void exhalbtc_set_hci_version(struct btc_coexist *btcoexist, u16 hci_version);
+void exhalbtc_set_bt_patch_version(struct btc_coexist *btcoexist,
+                                  u16 bt_hci_version, u16 bt_patch_version);
+void exhalbtc_update_min_bt_rssi(struct btc_coexist *btcoexist, s8 bt_rssi);
+void exhalbtc_set_bt_exist(struct btc_coexist *btcoexist, bool bt_exist);
+void exhalbtc_set_chip_type(struct btc_coexist *btcoexist, u8 chip_type);
 void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num);
 void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist,
                                   struct seq_file *m);
@@ -640,6 +640,7 @@ void exhalbtc_signal_compensation(struct btc_coexist *btcoexist,
                                  u8 *rssi_wifi, u8 *rssi_bt);
 void exhalbtc_lps_leave(struct btc_coexist *btcoexist);
 void exhalbtc_low_wifi_traffic_notify(struct btc_coexist *btcoexist);
-void exhalbtc_set_single_ant_path(u8 single_ant_path);
+void exhalbtc_set_single_ant_path(struct btc_coexist *btcoexist,
+                                 u8 single_ant_path);
 
 #endif
index 9e3623b0423cd2f7ef80d51dc30ece08fbb1df7b..ddbef65c374073063e8ca24680a7f93e06f1892a 100644 (file)
@@ -31,6 +31,7 @@
 
 static struct rtl_btc_ops rtl_btc_operation = {
        .btc_init_variables = rtl_btc_init_variables,
+       .btc_deinit_variables = rtl_btc_deinit_variables,
        .btc_init_hal_vars = rtl_btc_init_hal_vars,
        .btc_power_on_setting = rtl_btc_power_on_setting,
        .btc_init_hw_config = rtl_btc_init_hw_config,
@@ -58,58 +59,116 @@ static struct rtl_btc_ops rtl_btc_operation = {
 
 void rtl_btc_display_bt_coex_info(struct rtl_priv *rtlpriv, struct seq_file *m)
 {
-       exhalbtc_display_bt_coex_info(&gl_bt_coexist, m);
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist) {
+               seq_puts(m, "btc_coexist context is NULL!\n");
+               return;
+       }
+
+       exhalbtc_display_bt_coex_info(btcoexist, m);
 }
 
 void rtl_btc_record_pwr_mode(struct rtl_priv *rtlpriv, u8 *buf, u8 len)
 {
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
        u8 safe_len;
 
-       safe_len = sizeof(gl_bt_coexist.pwr_mode_val);
+       if (!btcoexist)
+               return;
+
+       safe_len = sizeof(btcoexist->pwr_mode_val);
 
        if (safe_len > len)
                safe_len = len;
 
-       memcpy(gl_bt_coexist.pwr_mode_val, buf, safe_len);
+       memcpy(btcoexist->pwr_mode_val, buf, safe_len);
 }
 
 u8 rtl_btc_get_lps_val(struct rtl_priv *rtlpriv)
 {
-       return gl_bt_coexist.bt_info.lps_val;
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return 0;
+
+       return btcoexist->bt_info.lps_val;
 }
 
 u8 rtl_btc_get_rpwm_val(struct rtl_priv *rtlpriv)
 {
-       return gl_bt_coexist.bt_info.rpwm_val;
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return 0;
+
+       return btcoexist->bt_info.rpwm_val;
 }
 
 bool rtl_btc_is_bt_ctrl_lps(struct rtl_priv *rtlpriv)
 {
-       return gl_bt_coexist.bt_info.bt_ctrl_lps;
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return false;
+
+       return btcoexist->bt_info.bt_ctrl_lps;
 }
 
 bool rtl_btc_is_bt_lps_on(struct rtl_priv *rtlpriv)
 {
-       return gl_bt_coexist.bt_info.bt_lps_on;
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return false;
+
+       return btcoexist->bt_info.bt_lps_on;
 }
 
 void rtl_btc_get_ampdu_cfg(struct rtl_priv *rtlpriv, u8 *reject_agg,
                           u8 *ctrl_agg_size, u8 *agg_size)
 {
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist) {
+               *reject_agg = false;
+               *ctrl_agg_size = false;
+               return;
+       }
+
        if (reject_agg)
-               *reject_agg = gl_bt_coexist.bt_info.reject_agg_pkt;
+               *reject_agg = btcoexist->bt_info.reject_agg_pkt;
        if (ctrl_agg_size)
-               *ctrl_agg_size = gl_bt_coexist.bt_info.bt_ctrl_agg_buf_size;
+               *ctrl_agg_size = btcoexist->bt_info.bt_ctrl_agg_buf_size;
        if (agg_size)
-               *agg_size = gl_bt_coexist.bt_info.agg_buf_size;
+               *agg_size = btcoexist->bt_info.agg_buf_size;
+}
+
+static void rtl_btc_alloc_variable(struct rtl_priv *rtlpriv, bool wifi_only)
+{
+       rtlpriv->btcoexist.btc_context =
+                       kzalloc(sizeof(struct btc_coexist), GFP_KERNEL);
+}
+
+static void rtl_btc_free_variable(struct rtl_priv *rtlpriv)
+{
+       kfree(rtlpriv->btcoexist.btc_context);
+       rtlpriv->btcoexist.btc_context = NULL;
 }
 
 void rtl_btc_init_variables(struct rtl_priv *rtlpriv)
 {
-       exhalbtc_initlize_variables();
+       rtl_btc_alloc_variable(rtlpriv, false);
+
+       exhalbtc_initlize_variables(rtlpriv);
        exhalbtc_bind_bt_coex_withadapter(rtlpriv);
 }
 
+void rtl_btc_deinit_variables(struct rtl_priv *rtlpriv)
+{
+       rtl_btc_free_variable(rtlpriv);
+}
+
 void rtl_btc_init_hal_vars(struct rtl_priv *rtlpriv)
 {
        /* move ant_num, bt_type and single_ant_path to
@@ -119,71 +178,123 @@ void rtl_btc_init_hal_vars(struct rtl_priv *rtlpriv)
 
 void rtl_btc_power_on_setting(struct rtl_priv *rtlpriv)
 {
-       exhalbtc_power_on_setting(&gl_bt_coexist);
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
+
+       exhalbtc_power_on_setting(btcoexist);
 }
 
 void rtl_btc_init_hw_config(struct rtl_priv *rtlpriv)
 {
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
        u8 bt_exist;
 
        bt_exist = rtl_get_hwpg_bt_exist(rtlpriv);
        RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
                "%s, bt_exist is %d\n", __func__, bt_exist);
 
-       exhalbtc_init_hw_config(&gl_bt_coexist, !bt_exist);
-       exhalbtc_init_coex_dm(&gl_bt_coexist);
+       if (!btcoexist)
+               return;
+
+       exhalbtc_init_hw_config(btcoexist, !bt_exist);
+       exhalbtc_init_coex_dm(btcoexist);
 }
 
 void rtl_btc_ips_notify(struct rtl_priv *rtlpriv, u8 type)
 {
-       exhalbtc_ips_notify(&gl_bt_coexist, type);
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
+
+       exhalbtc_ips_notify(btcoexist, type);
 }
 
 void rtl_btc_lps_notify(struct rtl_priv *rtlpriv, u8 type)
 {
-       exhalbtc_lps_notify(&gl_bt_coexist, type);
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
+
+       exhalbtc_lps_notify(btcoexist, type);
 }
 
 void rtl_btc_scan_notify(struct rtl_priv *rtlpriv, u8 scantype)
 {
-       exhalbtc_scan_notify(&gl_bt_coexist, scantype);
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
+
+       exhalbtc_scan_notify(btcoexist, scantype);
 }
 
 void rtl_btc_connect_notify(struct rtl_priv *rtlpriv, u8 action)
 {
-       exhalbtc_connect_notify(&gl_bt_coexist, action);
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
+
+       exhalbtc_connect_notify(btcoexist, action);
 }
 
 void rtl_btc_mediastatus_notify(struct rtl_priv *rtlpriv,
                                enum rt_media_status mstatus)
 {
-       exhalbtc_mediastatus_notify(&gl_bt_coexist, mstatus);
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
+
+       exhalbtc_mediastatus_notify(btcoexist, mstatus);
 }
 
 void rtl_btc_periodical(struct rtl_priv *rtlpriv)
 {
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
+
        /*rtl_bt_dm_monitor();*/
-       exhalbtc_periodical(&gl_bt_coexist);
+       exhalbtc_periodical(btcoexist);
 }
 
-void rtl_btc_halt_notify(void)
+void rtl_btc_halt_notify(struct rtl_priv *rtlpriv)
 {
-       struct btc_coexist *btcoexist = &gl_bt_coexist;
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
 
        exhalbtc_halt_notify(btcoexist);
 }
 
 void rtl_btc_btinfo_notify(struct rtl_priv *rtlpriv, u8 *tmp_buf, u8 length)
 {
-       exhalbtc_bt_info_notify(&gl_bt_coexist, tmp_buf, length);
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
+
+       exhalbtc_bt_info_notify(btcoexist, tmp_buf, length);
 }
 
 void rtl_btc_btmpinfo_notify(struct rtl_priv *rtlpriv, u8 *tmp_buf, u8 length)
 {
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
        u8 extid, seq, len;
        u16 bt_real_fw_ver;
        u8 bt_fw_ver;
 
+       if (!btcoexist)
+               return;
+
        if ((length < 4) || (!tmp_buf))
                return;
 
@@ -200,14 +311,19 @@ void rtl_btc_btmpinfo_notify(struct rtl_priv *rtlpriv, u8 *tmp_buf, u8 length)
                bt_real_fw_ver = tmp_buf[3] | (tmp_buf[4] << 8);
                bt_fw_ver = tmp_buf[5];
 
-               gl_bt_coexist.bt_info.bt_real_fw_ver = bt_real_fw_ver;
-               gl_bt_coexist.bt_info.bt_fw_ver = bt_fw_ver;
+               btcoexist->bt_info.bt_real_fw_ver = bt_real_fw_ver;
+               btcoexist->bt_info.bt_fw_ver = bt_fw_ver;
        }
 }
 
 bool rtl_btc_is_limited_dig(struct rtl_priv *rtlpriv)
 {
-       return gl_bt_coexist.bt_info.limited_dig;
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return false;
+
+       return btcoexist->bt_info.limited_dig;
 }
 
 bool rtl_btc_is_disable_edca_turbo(struct rtl_priv *rtlpriv)
@@ -239,8 +355,13 @@ bool rtl_btc_is_disable_edca_turbo(struct rtl_priv *rtlpriv)
 
 bool rtl_btc_is_bt_disabled(struct rtl_priv *rtlpriv)
 {
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return true;
+
        /* It seems 'bt_disabled' is never be initialized or set. */
-       if (gl_bt_coexist.bt_info.bt_disabled)
+       if (btcoexist->bt_info.bt_disabled)
                return true;
        else
                return false;
@@ -248,7 +369,12 @@ bool rtl_btc_is_bt_disabled(struct rtl_priv *rtlpriv)
 
 void rtl_btc_special_packet_notify(struct rtl_priv *rtlpriv, u8 pkt_type)
 {
-       return exhalbtc_special_packet_notify(&gl_bt_coexist, pkt_type);
+       struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
+
+       if (!btcoexist)
+               return;
+
+       return exhalbtc_special_packet_notify(btcoexist, pkt_type);
 }
 
 struct rtl_btc_ops *rtl_btc_get_ops_pointer(void)
index 9becfa59407d45a885219d08c1727234eaa31563..8c5098266039c1317275d8cb68032bec84ea2c51 100644 (file)
@@ -28,6 +28,7 @@
 #include "halbt_precomp.h"
 
 void rtl_btc_init_variables(struct rtl_priv *rtlpriv);
+void rtl_btc_deinit_variables(struct rtl_priv *rtlpriv);
 void rtl_btc_init_hal_vars(struct rtl_priv *rtlpriv);
 void rtl_btc_power_on_setting(struct rtl_priv *rtlpriv);
 void rtl_btc_init_hw_config(struct rtl_priv *rtlpriv);
@@ -38,7 +39,7 @@ void rtl_btc_connect_notify(struct rtl_priv *rtlpriv, u8 action);
 void rtl_btc_mediastatus_notify(struct rtl_priv *rtlpriv,
                                enum rt_media_status mstatus);
 void rtl_btc_periodical(struct rtl_priv *rtlpriv);
-void rtl_btc_halt_notify(void);
+void rtl_btc_halt_notify(struct rtl_priv *rtlpriv);
 void rtl_btc_btinfo_notify(struct rtl_priv *rtlpriv, u8 *tmpbuf, u8 length);
 void rtl_btc_btmpinfo_notify(struct rtl_priv *rtlpriv, u8 *tmp_buf, u8 length);
 bool rtl_btc_is_limited_dig(struct rtl_priv *rtlpriv);
index c1833a501be4c10408bc413430a7d62ac12f8bc1..aa1d3ae4937f36337dbc9cfec386341010b11fe7 100644 (file)
@@ -1841,7 +1841,10 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
        u8 rf_timeout = 0;
 
        if (rtlpriv->cfg->ops->get_btc_status())
-               rtlpriv->btcoexist.btc_ops->btc_halt_notify();
+               rtlpriv->btcoexist.btc_ops->btc_halt_notify(rtlpriv);
+
+       if (rtlpriv->btcoexist.btc_ops)
+               rtlpriv->btcoexist.btc_ops->btc_deinit_variables(rtlpriv);
 
        /*should be before disable interrupt&adapter
         *and will do it immediately.
index b27dbe10b1630bea2a4b6f04afb7458c429b57c1..531c86df54d48ab5a85229713e98d4f909b33078 100644 (file)
@@ -2500,6 +2500,8 @@ struct rtl_btc_info {
 struct bt_coexist_info {
        struct rtl_btc_ops *btc_ops;
        struct rtl_btc_info btc_info;
+       /* btc context */
+       void *btc_context;
        /* EEPROM BT info. */
        u8 eeprom_bt_coexist;
        u8 eeprom_bt_type;
@@ -2556,6 +2558,7 @@ struct bt_coexist_info {
 
 struct rtl_btc_ops {
        void (*btc_init_variables) (struct rtl_priv *rtlpriv);
+       void (*btc_deinit_variables)(struct rtl_priv *rtlpriv);
        void (*btc_init_hal_vars) (struct rtl_priv *rtlpriv);
        void (*btc_power_on_setting)(struct rtl_priv *rtlpriv);
        void (*btc_init_hw_config) (struct rtl_priv *rtlpriv);
@@ -2566,7 +2569,7 @@ struct rtl_btc_ops {
        void (*btc_mediastatus_notify) (struct rtl_priv *rtlpriv,
                                        enum rt_media_status mstatus);
        void (*btc_periodical) (struct rtl_priv *rtlpriv);
-       void (*btc_halt_notify) (void);
+       void (*btc_halt_notify)(struct rtl_priv *rtlpriv);
        void (*btc_btinfo_notify) (struct rtl_priv *rtlpriv,
                                   u8 *tmp_buf, u8 length);
        void (*btc_btmpinfo_notify)(struct rtl_priv *rtlpriv,