From 177aa53a0d11b258a6615a042380fe7abf15d780 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Mon, 19 Sep 2016 00:28:06 +0700 Subject: [PATCH] staging: r8188eu: remove GET_HAL_DATA macro GET_HAL_DATA replaced by its definition. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_sreset.c | 9 +-- drivers/staging/rtl8188eu/hal/bb_cfg.c | 13 ++-- drivers/staging/rtl8188eu/hal/odm.c | 17 ++--- drivers/staging/rtl8188eu/hal/phy.c | 40 ++++------ drivers/staging/rtl8188eu/hal/rf.c | 16 ++-- drivers/staging/rtl8188eu/hal/rf_cfg.c | 6 +- drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c | 18 ++--- drivers/staging/rtl8188eu/hal/rtl8188e_dm.c | 28 +++---- drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 26 +++---- drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 4 +- drivers/staging/rtl8188eu/hal/rtl8188eu_led.c | 6 +- drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 22 ++---- drivers/staging/rtl8188eu/hal/usb_halinit.c | 91 +++++++++-------------- drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 3 - drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 12 +-- 15 files changed, 124 insertions(+), 187 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_sreset.c b/drivers/staging/rtl8188eu/core/rtw_sreset.c index 5d631c5..a198c57 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sreset.c +++ b/drivers/staging/rtl8188eu/core/rtw_sreset.c @@ -18,16 +18,14 @@ void rtw_hal_sreset_init(struct adapter *padapter) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); - struct sreset_priv *psrtpriv = &pHalData->srestpriv; + struct sreset_priv *psrtpriv = &padapter->HalData->srestpriv; psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; } u8 sreset_get_wifi_status(struct adapter *padapter) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); - struct sreset_priv *psrtpriv = &pHalData->srestpriv; + struct sreset_priv *psrtpriv = &padapter->HalData->srestpriv; u8 status = WIFI_STATUS_SUCCESS; u32 val32 = 0; @@ -54,6 +52,5 @@ u8 sreset_get_wifi_status(struct adapter *padapter) void sreset_set_wifi_error_status(struct adapter *padapter, u32 status) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); - pHalData->srestpriv.Wifi_Error_Status = status; + padapter->HalData->srestpriv.Wifi_Error_Status = status; } diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c b/drivers/staging/rtl8188eu/hal/bb_cfg.c index cce1ea2..c349923 100644 --- a/drivers/staging/rtl8188eu/hal/bb_cfg.c +++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c @@ -498,7 +498,7 @@ static u32 array_phy_reg_pg_8188e[] = { static void store_pwrindex_offset(struct adapter *adapter, u32 regaddr, u32 bitmask, u32 data) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapter); + struct hal_data_8188e *hal_data = adapter->HalData; u32 * const power_level_offset = hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt]; @@ -588,11 +588,10 @@ static bool config_bb_with_pgheader(struct adapter *adapt) static void rtl88e_phy_init_bb_rf_register_definition(struct adapter *adapter) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapter); struct bb_reg_def *reg[4]; - reg[RF_PATH_A] = &hal_data->PHYRegDef[RF_PATH_A]; - reg[RF_PATH_B] = &hal_data->PHYRegDef[RF_PATH_B]; + reg[RF_PATH_A] = &adapter->HalData->PHYRegDef[RF_PATH_A]; + reg[RF_PATH_B] = &adapter->HalData->PHYRegDef[RF_PATH_B]; reg[RF_PATH_A]->rfintfs = rFPGA0_XAB_RFInterfaceSW; reg[RF_PATH_B]->rfintfs = rFPGA0_XAB_RFInterfaceSW; @@ -652,13 +651,12 @@ static void rtl88e_phy_init_bb_rf_register_definition(struct adapter *adapter) static bool config_parafile(struct adapter *adapt) { struct eeprom_priv *eeprom = GET_EEPROM_EFUSE_PRIV(adapt); - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); set_baseband_phy_config(adapt); /* If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */ if (!eeprom->bautoload_fail_flag) { - hal_data->pwrGroupCnt = 0; + adapt->HalData->pwrGroupCnt = 0; config_bb_with_pgheader(adapt); } set_baseband_agc_config(adapt); @@ -668,7 +666,6 @@ static bool config_parafile(struct adapter *adapt) bool rtl88eu_phy_bb_config(struct adapter *adapt) { int rtstatus = true; - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); u32 regval; u8 crystal_cap; @@ -688,7 +685,7 @@ bool rtl88eu_phy_bb_config(struct adapter *adapt) rtstatus = config_parafile(adapt); /* write 0x24[16:11] = 0x24[22:17] = crystal_cap */ - crystal_cap = hal_data->CrystalCap & 0x3F; + crystal_cap = adapt->HalData->CrystalCap & 0x3F; phy_set_bb_reg(adapt, REG_AFE_XTAL_CTRL, 0x7ff800, (crystal_cap | (crystal_cap << 6))); diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c index d1c9ef3..0677474 100644 --- a/drivers/staging/rtl8188eu/hal/odm.c +++ b/drivers/staging/rtl8188eu/hal/odm.c @@ -912,8 +912,7 @@ bool ODM_RAStateCheck(struct odm_dm_struct *pDM_Odm, s32 RSSI, bool bForceUpdate void odm_DynamicTxPowerInit(struct odm_dm_struct *pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; - struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; + struct dm_priv *pdmpriv = &Adapter->HalData->dmpriv; pdmpriv->bDynamicTxPowerEnable = false; pdmpriv->LastDTPLvl = TxHighPwrLevel_Normal; pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; @@ -938,8 +937,7 @@ void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm) static void FindMinimumRSSI(struct adapter *pAdapter) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(pAdapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; + struct dm_priv *pdmpriv = &pAdapter->HalData->dmpriv; /* 1 1.Unconditionally set RSSI */ pdmpriv->MinUndecoratedPWDBForDM = pdmpriv->EntryMinUndecoratedSmoothedPWDB; @@ -948,8 +946,7 @@ static void FindMinimumRSSI(struct adapter *pAdapter) void odm_RSSIMonitorCheckCE(struct odm_dm_struct *pDM_Odm) { struct adapter *Adapter = pDM_Odm->Adapter; - struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; + struct dm_priv *pdmpriv = &Adapter->HalData->dmpriv; int i; int tmpEntryMaxPWDB = 0, tmpEntryMinPWDB = 0xff; u8 sta_cnt = 0; @@ -978,7 +975,7 @@ void odm_RSSIMonitorCheckCE(struct odm_dm_struct *pDM_Odm) for (i = 0; i < sta_cnt; i++) { if (PWDB_rssi[i] != 0) { - ODM_RA_SetRSSI_8188E(&pHalData->odmpriv, + ODM_RA_SetRSSI_8188E(&Adapter->HalData->odmpriv, PWDB_rssi[i] & 0xFF, (PWDB_rssi[i] >> 16) & 0xFF); } @@ -995,7 +992,7 @@ void odm_RSSIMonitorCheckCE(struct odm_dm_struct *pDM_Odm) pdmpriv->EntryMinUndecoratedSmoothedPWDB = 0; FindMinimumRSSI(Adapter); - pHalData->odmpriv.RSSI_Min = pdmpriv->MinUndecoratedPWDBForDM; + Adapter->HalData->odmpriv.RSSI_Min = pdmpriv->MinUndecoratedPWDBForDM; } /* 3============================================================ */ @@ -1105,7 +1102,6 @@ void odm_EdcaTurboCheckCE(struct odm_dm_struct *pDM_Odm) u64 cur_tx_bytes = 0; u64 cur_rx_bytes = 0; u8 bbtchange = false; - struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter); struct xmit_priv *pxmitpriv = &(Adapter->xmitpriv); struct recv_priv *precvpriv = &(Adapter->recvpriv); struct registry_priv *pregpriv = &Adapter->registrypriv; @@ -1159,7 +1155,8 @@ void odm_EdcaTurboCheckCE(struct odm_dm_struct *pDM_Odm) /* Turn Off EDCA turbo here. */ /* Restore original EDCA according to the declaration of AP. */ if (pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA) { - usb_write32(Adapter, REG_EDCA_BE_PARAM, pHalData->AcParam_BE); + usb_write32(Adapter, REG_EDCA_BE_PARAM, + Adapter->HalData->AcParam_BE); pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false; } } diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 776e5b8..4e3c2e6 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -65,8 +65,7 @@ static u32 rf_serial_read(struct adapter *adapt, enum rf_radio_path rfpath, u32 offset) { u32 ret = 0; - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); - struct bb_reg_def *phyreg = &hal_data->PHYRegDef[rfpath]; + struct bb_reg_def *phyreg = &adapt->HalData->PHYRegDef[rfpath]; u32 tmplong, tmplong2; u8 rfpi_enable = 0; @@ -110,8 +109,7 @@ static void rf_serial_write(struct adapter *adapt, u32 data) { u32 data_and_addr = 0; - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); - struct bb_reg_def *phyreg = &hal_data->PHYRegDef[rfpath]; + struct bb_reg_def *phyreg = &adapt->HalData->PHYRegDef[rfpath]; offset &= 0xff; data_and_addr = ((offset<<20) | (data&0x000fffff)) & 0x0fffffff; @@ -147,7 +145,7 @@ void phy_set_rf_reg(struct adapter *adapt, enum rf_radio_path rf_path, static void get_tx_power_index(struct adapter *adapt, u8 channel, u8 *cck_pwr, u8 *ofdm_pwr, u8 *bw20_pwr, u8 *bw40_pwr) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; u8 index = (channel - 1); u8 TxCount = 0, path_nums; @@ -183,7 +181,7 @@ static void phy_power_index_check(struct adapter *adapt, u8 channel, u8 *cck_pwr, u8 *ofdm_pwr, u8 *bw20_pwr, u8 *bw40_pwr) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; hal_data->CurrentCckTxPwrIdx = cck_pwr[0]; hal_data->CurrentOfdm24GTxPwrIdx = ofdm_pwr[0]; @@ -211,7 +209,7 @@ void phy_set_tx_power_level(struct adapter *adapt, u8 channel) static void phy_set_bw_mode_callback(struct adapter *adapt) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; u8 reg_bw_opmode; u8 reg_prsr_rsc; @@ -277,7 +275,7 @@ static void phy_set_bw_mode_callback(struct adapter *adapt) void rtw_hal_set_bwmode(struct adapter *adapt, enum ht_channel_width bandwidth, unsigned char offset) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; enum ht_channel_width tmp_bw = hal_data->CurrentChannelBW; hal_data->CurrentChannelBW = bandwidth; @@ -293,7 +291,7 @@ static void phy_sw_chnl_callback(struct adapter *adapt, u8 channel) { u8 rf_path; u32 param1, param2; - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; phy_set_tx_power_level(adapt, channel); @@ -309,7 +307,7 @@ static void phy_sw_chnl_callback(struct adapter *adapt, u8 channel) void rtw_hal_set_chan(struct adapter *adapt, u8 channel) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; u8 tmpchannel = hal_data->CurrentChannel; if (hal_data->rf_chip == RF_PSEUDO_11N) @@ -404,7 +402,7 @@ static void dm_txpwr_track_setpwr(struct odm_dm_struct *dm_odm) void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; u8 thermal_val = 0, delta, delta_lck, delta_iqk, offset; u8 thermal_avg_count = 0; u32 thermal_avg = 0; @@ -629,8 +627,7 @@ static u8 phy_path_a_rx_iqk(struct adapter *adapt, bool configPathB) { u32 reg_eac, reg_e94, reg_e9c, reg_ea4, u4tmp; u8 result = 0x00; - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); - struct odm_dm_struct *dm_odm = &hal_data->odmpriv; + struct odm_dm_struct *dm_odm = &adapt->HalData->odmpriv; /* 1 Get TXIMR setting */ /* modify RXIQK mode table */ @@ -734,8 +731,7 @@ static u8 phy_path_b_iqk(struct adapter *adapt) { u32 regeac, regeb4, regebc, regec4, regecc; u8 result = 0x00; - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); - struct odm_dm_struct *dm_odm = &hal_data->odmpriv; + struct odm_dm_struct *dm_odm = &adapt->HalData->odmpriv; /* One shot, path B LOK & IQK */ phy_set_bb_reg(adapt, rIQK_AGC_Cont, bMaskDWord, 0x00000002); @@ -951,8 +947,7 @@ static bool simularity_compare(struct adapter *adapt, s32 resulta[][8], u8 c1, u8 c2) { u32 i, j, diff, sim_bitmap = 0, bound; - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); - struct odm_dm_struct *dm_odm = &hal_data->odmpriv; + struct odm_dm_struct *dm_odm = &adapt->HalData->odmpriv; u8 final_candidate[2] = {0xFF, 0xFF}; /* for path A and path B */ bool result = true; s32 tmp1 = 0, tmp2 = 0; @@ -1030,8 +1025,7 @@ static bool simularity_compare(struct adapter *adapt, s32 resulta[][8], static void phy_iq_calibrate(struct adapter *adapt, s32 result[][8], u8 t, bool is2t) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); - struct odm_dm_struct *dm_odm = &hal_data->odmpriv; + struct odm_dm_struct *dm_odm = &adapt->HalData->odmpriv; u32 i; u8 path_a_ok, path_b_ok; u32 adda_reg[IQK_ADDA_REG_NUM] = { @@ -1276,8 +1270,7 @@ static void phy_lc_calibrate(struct adapter *adapt, bool is2t) void rtl88eu_phy_iq_calibrate(struct adapter *adapt, bool recovery) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); - struct odm_dm_struct *dm_odm = &hal_data->odmpriv; + struct odm_dm_struct *dm_odm = &adapt->HalData->odmpriv; s32 result[4][8]; u8 i, final, chn_index; bool pathaok, pathbok; @@ -1388,7 +1381,7 @@ void rtl88eu_phy_iq_calibrate(struct adapter *adapt, bool recovery) (reg_ec4 == 0)); } - chn_index = get_right_chnl_for_iqk(hal_data->CurrentChannel); + chn_index = get_right_chnl_for_iqk(adapt->HalData->CurrentChannel); if (final < 4) { for (i = 0; i < IQK_Matrix_REG_NUM; i++) @@ -1404,8 +1397,7 @@ void rtl88eu_phy_lc_calibrate(struct adapter *adapt) { bool singletone = false, carrier_sup = false; u32 timeout = 2000, timecount = 0; - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); - struct odm_dm_struct *dm_odm = &hal_data->odmpriv; + struct odm_dm_struct *dm_odm = &adapt->HalData->odmpriv; if (!(dm_odm->SupportAbility & ODM_RF_CALIBRATION)) return; diff --git a/drivers/staging/rtl8188eu/hal/rf.c b/drivers/staging/rtl8188eu/hal/rf.c index 1596274..2f3edf0 100644 --- a/drivers/staging/rtl8188eu/hal/rf.c +++ b/drivers/staging/rtl8188eu/hal/rf.c @@ -22,7 +22,7 @@ void rtl88eu_phy_rf6052_set_bandwidth(struct adapter *adapt, enum ht_channel_width bandwidth) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; switch (bandwidth) { case HT_CHANNEL_WIDTH_20: @@ -44,7 +44,7 @@ void rtl88eu_phy_rf6052_set_bandwidth(struct adapter *adapt, void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter *adapt, u8 *powerlevel) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; struct dm_priv *pdmpriv = &hal_data->dmpriv; struct mlme_ext_priv *pmlmeext = &adapt->mlmeextpriv; u32 tx_agc[2] = {0, 0}, tmpval = 0, pwrtrac_value; @@ -129,7 +129,6 @@ static void getpowerbase88e(struct adapter *adapt, u8 *pwr_level_ofdm, u8 *pwr_level_bw20, u8 *pwr_level_bw40, u8 channel, u32 *ofdmbase, u32 *mcs_base) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); u32 powerbase0, powerbase1; u8 i, powerlevel[2]; @@ -140,9 +139,9 @@ static void getpowerbase88e(struct adapter *adapt, u8 *pwr_level_ofdm, (powerbase0<<8) | powerbase0; *(ofdmbase+i) = powerbase0; } - for (i = 0; i < hal_data->NumTotalRFPath; i++) { + for (i = 0; i < adapt->HalData->NumTotalRFPath; i++) { /* Check HT20 to HT40 diff */ - if (hal_data->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + if (adapt->HalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) powerlevel[i] = pwr_level_bw20[i]; else powerlevel[i] = pwr_level_bw40[i]; @@ -156,7 +155,7 @@ static void get_rx_power_val_by_reg(struct adapter *adapt, u8 channel, u8 index, u32 *powerbase0, u32 *powerbase1, u32 *out_val) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; struct dm_priv *pdmpriv = &hal_data->dmpriv; u8 i, chnlGroup = 0, pwr_diff_limit[4], customer_pwr_limit; s8 pwr_diff = 0; @@ -286,7 +285,6 @@ void rtl88eu_phy_rf6052_set_ofdm_txpower(struct adapter *adapt, u8 *pwr_level_bw20, u8 *pwr_level_bw40, u8 channel) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); u32 write_val[2], powerbase0[2], powerbase1[2], pwrtrac_value; u8 direction; u8 index = 0; @@ -294,8 +292,8 @@ void rtl88eu_phy_rf6052_set_ofdm_txpower(struct adapter *adapt, getpowerbase88e(adapt, pwr_level_ofdm, pwr_level_bw20, pwr_level_bw40, channel, &powerbase0[0], &powerbase1[0]); - rtl88eu_dm_txpower_track_adjust(&hal_data->odmpriv, 0, &direction, - &pwrtrac_value); + rtl88eu_dm_txpower_track_adjust(&adapt->HalData->odmpriv, 0, + &direction, &pwrtrac_value); for (index = 0; index < 6; index++) { get_rx_power_val_by_reg(adapt, channel, index, diff --git a/drivers/staging/rtl8188eu/hal/rf_cfg.c b/drivers/staging/rtl8188eu/hal/rf_cfg.c index 453f9e7..dc26ad3 100644 --- a/drivers/staging/rtl8188eu/hal/rf_cfg.c +++ b/drivers/staging/rtl8188eu/hal/rf_cfg.c @@ -19,7 +19,7 @@ static bool check_condition(struct adapter *adapt, const u32 condition) { - struct odm_dm_struct *odm = &GET_HAL_DATA(adapt)->odmpriv; + struct odm_dm_struct *odm = &adapt->HalData->odmpriv; u32 _board = odm->BoardType; u32 _platform = odm->SupportPlatform; u32 _interface = odm->SupportInterface; @@ -228,7 +228,7 @@ static bool rtl88e_phy_config_rf_with_headerfile(struct adapter *adapt) static bool rf6052_conf_para(struct adapter *adapt) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; u32 u4val = 0; u8 rfpath; bool rtstatus = true; @@ -299,7 +299,7 @@ static bool rf6052_conf_para(struct adapter *adapt) static bool rtl88e_phy_rf6052_config(struct adapter *adapt) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); + struct hal_data_8188e *hal_data = adapt->HalData; if (hal_data->rf_type == RF_1T1R) hal_data->NumTotalRFPath = 1; diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c b/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c index 18f69b8..4e7cef3 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c @@ -60,7 +60,6 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 *p u8 h2c_box_num; u32 msgbox_addr; u32 msgbox_ex_addr; - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); u8 cmd_idx, ext_cmd_len; u32 h2c_cmd = 0; u32 h2c_cmd_ex = 0; @@ -81,7 +80,7 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 *p /* pay attention to if race condition happened in H2C cmd setting. */ do { - h2c_box_num = haldata->LastHMEBoxNum; + h2c_box_num = adapt->HalData->LastHMEBoxNum; if (!_is_fw_read_cmd_down(adapt, h2c_box_num)) { DBG_88E(" fw read cmd failed...\n"); @@ -110,7 +109,8 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 *p } bcmd_down = true; - haldata->LastHMEBoxNum = (h2c_box_num+1) % RTL88E_MAX_H2C_BOX_NUMS; + adapt->HalData->LastHMEBoxNum = + (h2c_box_num+1) % RTL88E_MAX_H2C_BOX_NUMS; } while ((!bcmd_down) && (retry_cnts--)); @@ -128,7 +128,7 @@ exit: /* arg[5] = Short GI */ void rtw_hal_add_ra_tid(struct adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi_level) { - struct hal_data_8188e *haldata = GET_HAL_DATA(pAdapter); + struct odm_dm_struct *odmpriv = &pAdapter->HalData->odmpriv; u8 macid, init_rate, raid, shortGIrate = false; @@ -138,7 +138,7 @@ void rtw_hal_add_ra_tid(struct adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi_le bitmap &= 0x0fffffff; if (rssi_level != DM_RATR_STA_INIT) - bitmap = ODM_Get_Rate_Bitmap(&haldata->odmpriv, macid, bitmap, rssi_level); + bitmap = ODM_Get_Rate_Bitmap(odmpriv, macid, bitmap, rssi_level); bitmap |= ((raid<<28)&0xf0000000); @@ -156,7 +156,7 @@ void rtw_hal_add_ra_tid(struct adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi_le DBG_88E("%s=> mac_id:%d, raid:%d, ra_bitmap=0x%x, shortGIrate=0x%02x\n", __func__, macid, raid, bitmap, shortGIrate); - ODM_RA_UpdateRateInfo_8188E(&(haldata->odmpriv), macid, raid, bitmap, shortGIrate); + ODM_RA_UpdateRateInfo_8188E(odmpriv, macid, raid, bitmap, shortGIrate); } void rtl8188e_set_FwPwrMode_cmd(struct adapter *adapt, u8 Mode) @@ -445,7 +445,6 @@ static void ConstructProbeRsp(struct adapter *adapt, u8 *pframe, u32 *pLength, u /* 2009.10.15 by tynli. */ static void SetFwRsvdPagePkt(struct adapter *adapt, bool bDLFinished) { - struct hal_data_8188e *haldata; struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; struct xmit_priv *pxmitpriv; @@ -467,7 +466,6 @@ static void SetFwRsvdPagePkt(struct adapter *adapt, bool bDLFinished) return; } - haldata = GET_HAL_DATA(adapt); pxmitpriv = &adapt->xmitpriv; pmlmeext = &adapt->mlmeextpriv; pmlmeinfo = &pmlmeext->mlmext_info; @@ -487,7 +485,7 @@ static void SetFwRsvdPagePkt(struct adapter *adapt, bool bDLFinished) if (PageNeed == 1) PageNeed += 1; PageNum += PageNeed; - haldata->FwRsvdPageStartOffset = PageNum; + adapt->HalData->FwRsvdPageStartOffset = PageNum; BufIndex += PageNeed*128; @@ -554,7 +552,7 @@ exit: void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *adapt, u8 mstatus) { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); + struct hal_data_8188e *haldata = adapt->HalData; struct mlme_ext_priv *pmlmeext = &(adapt->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); bool bSendBeacon = false; diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c index 0c853fc..964b169 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c @@ -42,7 +42,7 @@ static void dm_InitGPIOSetting(struct adapter *Adapter) /* */ static void Init_ODM_ComInfo_88E(struct adapter *Adapter) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); + struct hal_data_8188e *hal_data = Adapter->HalData; struct dm_priv *pdmpriv = &hal_data->dmpriv; struct odm_dm_struct *dm_odm = &(hal_data->odmpriv); @@ -83,7 +83,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; struct pwrctrl_priv *pwrctrlpriv = &Adapter->pwrctrlpriv; - struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); + struct hal_data_8188e *hal_data = Adapter->HalData; struct odm_dm_struct *dm_odm = &(hal_data->odmpriv); struct dm_priv *pdmpriv = &hal_data->dmpriv; int i; @@ -133,9 +133,8 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) void rtl8188e_InitHalDm(struct adapter *Adapter) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &hal_data->dmpriv; - struct odm_dm_struct *dm_odm = &(hal_data->odmpriv); + struct dm_priv *pdmpriv = &Adapter->HalData->dmpriv; + struct odm_dm_struct *dm_odm = &(Adapter->HalData->odmpriv); dm_InitGPIOSetting(Adapter); pdmpriv->DM_Type = DM_Type_ByDriver; @@ -147,7 +146,6 @@ void rtl8188e_InitHalDm(struct adapter *Adapter) void rtw_hal_dm_watchdog(struct adapter *Adapter) { u8 hw_init_completed = false; - struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); struct mlme_priv *pmlmepriv = NULL; u8 bLinked = false; @@ -169,8 +167,8 @@ void rtw_hal_dm_watchdog(struct adapter *Adapter) bLinked = true; } - hal_data->odmpriv.bLinked = bLinked; - ODM_DMWatchdog(&hal_data->odmpriv); + Adapter->HalData->odmpriv.bLinked = bLinked; + ODM_DMWatchdog(&Adapter->HalData->odmpriv); skip_dm: /* Check GPIO to determine current RF on/off and Pbc status. */ /* Check Hardware Radio ON/OFF or not */ @@ -179,9 +177,8 @@ skip_dm: void rtw_hal_dm_init(struct adapter *Adapter) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &hal_data->dmpriv; - struct odm_dm_struct *podmpriv = &hal_data->odmpriv; + struct dm_priv *pdmpriv = &Adapter->HalData->dmpriv; + struct odm_dm_struct *podmpriv = &Adapter->HalData->odmpriv; memset(pdmpriv, 0, sizeof(struct dm_priv)); Init_ODM_ComInfo_88E(Adapter); @@ -192,9 +189,7 @@ void rtw_hal_dm_init(struct adapter *Adapter) /* Compare RSSI for deciding antenna */ void rtw_hal_antdiv_rssi_compared(struct adapter *Adapter, struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); - - if (0 != hal_data->AntDivCfg) { + if (0 != Adapter->HalData->AntDivCfg) { /* select optimum_antenna for before linked =>For antenna diversity */ if (dst->Rssi >= src->Rssi) {/* keep org parameter */ src->Rssi = dst->Rssi; @@ -206,13 +201,12 @@ void rtw_hal_antdiv_rssi_compared(struct adapter *Adapter, struct wlan_bssid_ex /* Add new function to reset the state of antenna diversity before link. */ u8 rtw_hal_antdiv_before_linked(struct adapter *Adapter) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); - struct odm_dm_struct *dm_odm = &hal_data->odmpriv; + struct odm_dm_struct *dm_odm = &Adapter->HalData->odmpriv; struct sw_ant_switch *dm_swat_tbl = &dm_odm->DM_SWAT_Table; struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); /* Condition that does not need to use antenna diversity. */ - if (hal_data->AntDivCfg == 0) + if (Adapter->HalData->AntDivCfg == 0) return false; if (check_fwstate(pmlmepriv, _FW_LINKED)) diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index a1812dd..a7b0375 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -108,13 +108,11 @@ void _8051Reset88E(struct adapter *padapter) void rtl8188e_InitializeFirmwareVars(struct adapter *padapter) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); - /* Init Fw LPS related. */ padapter->pwrctrlpriv.bFwCurrentInPSMode = false; /* Init H2C counter. by tynli. 2009.12.09. */ - pHalData->LastHMEBoxNum = 0; + padapter->HalData->LastHMEBoxNum = 0; } void rtw_hal_free_data(struct adapter *padapter) @@ -127,9 +125,7 @@ void rtw_hal_read_chip_version(struct adapter *padapter) { u32 value32; struct HAL_VERSION ChipVersion; - struct hal_data_8188e *pHalData; - - pHalData = GET_HAL_DATA(padapter); + struct hal_data_8188e *pHalData = padapter->HalData; value32 = usb_read32(padapter, REG_SYS_CFG); ChipVersion.ChipType = ((value32 & RTL_ID) ? TEST_CHIP : NORMAL_CHIP); @@ -147,8 +143,8 @@ void rtw_hal_read_chip_version(struct adapter *padapter) void rtw_hal_set_odm_var(struct adapter *Adapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter); - struct odm_dm_struct *podmpriv = &pHalData->odmpriv; + struct odm_dm_struct *podmpriv = &Adapter->HalData->odmpriv; + switch (eVariable) { case HAL_ODM_STA_INFO: { @@ -475,7 +471,7 @@ void Hal_ReadPowerSavingMode88E(struct adapter *padapter, u8 *hwinfo, bool AutoL void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool AutoLoadFail) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); + struct hal_data_8188e *pHalData = padapter->HalData; struct txpowerinfo24g pwrInfo24G; u8 rfPath, ch, group; u8 bIn24G, TxCount; @@ -527,7 +523,7 @@ void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool Auto void Hal_EfuseParseXtal_8188E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoadFail) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(pAdapter); + struct hal_data_8188e *pHalData = pAdapter->HalData; if (!AutoLoadFail) { pHalData->CrystalCap = hwinfo[EEPROM_XTAL_88E]; @@ -541,7 +537,7 @@ void Hal_EfuseParseXtal_8188E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoa void Hal_EfuseParseBoardType88E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoadFail) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(pAdapter); + struct hal_data_8188e *pHalData = pAdapter->HalData; if (!AutoLoadFail) pHalData->BoardType = (hwinfo[EEPROM_RF_BOARD_OPTION_88E] @@ -553,7 +549,7 @@ void Hal_EfuseParseBoardType88E(struct adapter *pAdapter, u8 *hwinfo, bool AutoL void Hal_EfuseParseEEPROMVer88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); + struct hal_data_8188e *pHalData = padapter->HalData; if (!AutoLoadFail) { pHalData->EEPROMVersion = hwinfo[EEPROM_VERSION_88E]; @@ -580,7 +576,7 @@ void rtl8188e_EfuseParseChnlPlan(struct adapter *padapter, u8 *hwinfo, bool Auto void Hal_EfuseParseCustomerID88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); + struct hal_data_8188e *pHalData = padapter->HalData; if (!AutoLoadFail) { pHalData->EEPROMCustomerID = hwinfo[EEPROM_CUSTOMERID_88E]; @@ -593,7 +589,7 @@ void Hal_EfuseParseCustomerID88E(struct adapter *padapter, u8 *hwinfo, bool Auto void Hal_ReadAntennaDiversity88E(struct adapter *pAdapter, u8 *PROMContent, bool AutoLoadFail) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(pAdapter); + struct hal_data_8188e *pHalData = pAdapter->HalData; struct registry_priv *registry_par = &pAdapter->registrypriv; if (!AutoLoadFail) { @@ -626,7 +622,7 @@ void Hal_ReadAntennaDiversity88E(struct adapter *pAdapter, u8 *PROMContent, bool void Hal_ReadThermalMeter_88E(struct adapter *Adapter, u8 *PROMContent, bool AutoloadFail) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter); + struct hal_data_8188e *pHalData = Adapter->HalData; /* ThermalMeter from EEPROM */ if (!AutoloadFail) diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c index f110c96..8aea710 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c @@ -140,7 +140,6 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, { struct adapter *padapter = precvframe->adapter; struct rx_pkt_attrib *pattrib = &precvframe->attrib; - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); struct odm_phy_status_info *pPHYInfo = (struct odm_phy_status_info *)(&pattrib->phy_info); u8 *wlanhdr; struct odm_per_pkt_info pkt_info; @@ -181,7 +180,8 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, pkt_info.StationID = psta->mac_id; pkt_info.Rate = pattrib->mcs_rate; - ODM_PhyStatusQuery(&pHalData->odmpriv, pPHYInfo, (u8 *)pphy_status, &(pkt_info)); + ODM_PhyStatusQuery(&padapter->HalData->odmpriv, pPHYInfo, + (u8 *)pphy_status, &(pkt_info)); precvframe->psta = NULL; if (pkt_info.bPacketMatchBSSID && diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c index becf5b5..780666a 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c @@ -40,14 +40,13 @@ void SwLedOn(struct adapter *padapter, struct LED_871x *pLed) void SwLedOff(struct adapter *padapter, struct LED_871x *pLed) { u8 LedCfg; - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); if (padapter->bSurpriseRemoved || padapter->bDriverStopped) goto exit; LedCfg = usb_read8(padapter, REG_LEDCFG2);/* 0x4E */ - if (pHalData->bLedOpenDrain) { + if (padapter->HalData->bLedOpenDrain) { /* Open-drain arrangement for controlling the LED) */ LedCfg &= 0x90; /* Set to software control. */ usb_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3))); @@ -69,11 +68,10 @@ exit: void rtw_hal_sw_led_init(struct adapter *padapter) { struct led_priv *pledpriv = &(padapter->ledpriv); - struct hal_data_8188e *haldata = GET_HAL_DATA(padapter); pledpriv->bRegUseLed = true; pledpriv->LedControlHandler = LedControl8188eu; - haldata->bLedOpenDrain = true; + padapter->HalData->bLedOpenDrain = true; InitLed871x(padapter, &(pledpriv->SwLed0)); } diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c index 169d6c8..85650b2 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c @@ -33,11 +33,7 @@ s32 rtw_hal_init_xmit_priv(struct adapter *adapt) static u8 urb_zero_packet_chk(struct adapter *adapt, int sz) { - u8 set_tx_desc_offset; - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); - set_tx_desc_offset = (((sz + TXDESC_SIZE) % haldata->UsbBulkOutSize) == 0) ? 1 : 0; - - return set_tx_desc_offset; + return !((sz + TXDESC_SIZE) % adapt->HalData->UsbBulkOutSize); } static void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc) @@ -175,7 +171,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag u8 data_rate, pwr_status, offset; struct adapter *adapt = pxmitframe->padapter; struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); + struct odm_dm_struct *odmpriv = &adapt->HalData->odmpriv; struct tx_desc *ptxdesc = (struct tx_desc *)pmem; struct mlme_ext_priv *pmlmeext = &adapt->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -259,12 +255,12 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag ptxdesc->txdw5 |= cpu_to_le32(0x0001ff00);/* DATA/RTS Rate FB LMT */ if (pattrib->ht_en) { - if (ODM_RA_GetShortGI_8188E(&haldata->odmpriv, pattrib->mac_id)) + if (ODM_RA_GetShortGI_8188E(odmpriv, pattrib->mac_id)) ptxdesc->txdw5 |= cpu_to_le32(SGI);/* SGI */ } - data_rate = ODM_RA_GetDecisionRate_8188E(&haldata->odmpriv, pattrib->mac_id); + data_rate = ODM_RA_GetDecisionRate_8188E(odmpriv, pattrib->mac_id); ptxdesc->txdw5 |= cpu_to_le32(data_rate & 0x3F); - pwr_status = ODM_RA_GetHwPwrStatus_8188E(&haldata->odmpriv, pattrib->mac_id); + pwr_status = ODM_RA_GetHwPwrStatus_8188E(odmpriv, pattrib->mac_id); ptxdesc->txdw4 |= cpu_to_le32((pwr_status & 0x7) << PWR_STATUS_SHT); } else { /* EAP data packet and ARP packet and DHCP. */ @@ -332,8 +328,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag ptxdesc->txdw4 |= cpu_to_le32(HW_SSN); /* Hw set sequence number */ } - rtl88eu_dm_set_tx_ant_by_tx_info(&haldata->odmpriv, pmem, - pattrib->mac_id); + rtl88eu_dm_set_tx_ant_by_tx_info(odmpriv, pmem, pattrib->mac_id); rtl8188eu_cal_txdesc_chksum(ptxdesc); _dbg_dump_tx_info(adapt, pxmitframe->frame_tag, ptxdesc); @@ -426,7 +421,6 @@ static u32 xmitframe_need_length(struct xmit_frame *pxmitframe) s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitpriv) { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); struct xmit_frame *pxmitframe = NULL; struct xmit_frame *pfirstframe = NULL; struct xmit_buf *pxmitbuf; @@ -442,7 +436,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp u32 pbuf_tail; /* last pkt tail */ u32 len; /* packet length, except TXDESC_SIZE and PKT_OFFSET */ - u32 bulksize = haldata->UsbBulkOutSize; + u32 bulksize = adapt->HalData->UsbBulkOutSize; u8 desc_cnt; u32 bulkptr; @@ -563,7 +557,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp if (pbuf < bulkptr) { desc_cnt++; - if (desc_cnt == haldata->UsbTxAggDescNum) + if (desc_cnt == adapt->HalData->UsbTxAggDescNum) break; } else { desc_cnt = 0; diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index 897e469..113bd0b 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -27,7 +27,7 @@ static void _ConfigNormalChipOutEP_8188E(struct adapter *adapt, u8 NumOutPipe) { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); + struct hal_data_8188e *haldata = adapt->HalData; switch (NumOutPipe) { case 3: @@ -50,13 +50,12 @@ static void _ConfigNormalChipOutEP_8188E(struct adapter *adapt, u8 NumOutPipe) static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumInPipe, u8 NumOutPipe) { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); bool result = false; _ConfigNormalChipOutEP_8188E(adapt, NumOutPipe); /* Normal chip with one IN and one OUT doesn't have interrupt IN EP. */ - if (haldata->OutEpNumber == 1) { + if (adapt->HalData->OutEpNumber == 1) { if (NumInPipe != 1) return result; } @@ -70,7 +69,7 @@ static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumInPip void rtw_hal_chip_configure(struct adapter *adapt) { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); + struct hal_data_8188e *haldata = adapt->HalData; struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapt); if (pdvobjpriv->ishighspeed) @@ -97,8 +96,7 @@ u32 rtw_hal_power_on(struct adapter *adapt) { u16 value16; /* HW Power on sequence */ - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); - if (haldata->bMacPwrCtrlOn) + if (adapt->HalData->bMacPwrCtrlOn) return _SUCCESS; if (!rtl88eu_pwrseqcmdparsing(adapt, PWR_CUT_ALL_MSK, @@ -118,7 +116,7 @@ u32 rtw_hal_power_on(struct adapter *adapt) /* for SDIO - Set CR bit10 to enable 32k calibration. Suggested by SD1 Gimmy. Added by tynli. 2011.08.31. */ usb_write16(adapt, REG_CR, value16); - haldata->bMacPwrCtrlOn = true; + adapt->HalData->bMacPwrCtrlOn = true; return _SUCCESS; } @@ -128,18 +126,17 @@ static void _InitInterrupt(struct adapter *Adapter) { u32 imr, imr_ex; u8 usb_opt; - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); /* HISR write one to clear */ usb_write32(Adapter, REG_HISR_88E, 0xFFFFFFFF); /* HIMR - */ imr = IMR_PSTIMEOUT_88E | IMR_TBDER_88E | IMR_CPWM_88E | IMR_CPWM2_88E; usb_write32(Adapter, REG_HIMR_88E, imr); - haldata->IntrMask[0] = imr; + Adapter->HalData->IntrMask[0] = imr; imr_ex = IMR_TXERR_88E | IMR_RXERR_88E | IMR_TXFOVW_88E | IMR_RXFOVW_88E; usb_write32(Adapter, REG_HIMRE_88E, imr_ex); - haldata->IntrMask[1] = imr_ex; + Adapter->HalData->IntrMask[1] = imr_ex; /* REG_USB_SPECIAL_OPTION - BIT(4) */ /* 0; Use interrupt endpoint to upload interrupt pkt */ @@ -156,7 +153,6 @@ static void _InitInterrupt(struct adapter *Adapter) static void _InitQueueReservedPage(struct adapter *Adapter) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); struct registry_priv *pregistrypriv = &Adapter->registrypriv; u32 numHQ = 0; u32 numLQ = 0; @@ -167,14 +163,14 @@ static void _InitQueueReservedPage(struct adapter *Adapter) bool bWiFiConfig = pregistrypriv->wifi_spec; if (bWiFiConfig) { - if (haldata->OutEpQueueSel & TX_SELE_HQ) + if (Adapter->HalData->OutEpQueueSel & TX_SELE_HQ) numHQ = 0x29; - if (haldata->OutEpQueueSel & TX_SELE_LQ) + if (Adapter->HalData->OutEpQueueSel & TX_SELE_LQ) numLQ = 0x1C; /* NOTE: This step shall be proceed before writing REG_RQPN. */ - if (haldata->OutEpQueueSel & TX_SELE_NQ) + if (Adapter->HalData->OutEpQueueSel & TX_SELE_NQ) numNQ = 0x1C; value8 = (u8)_NPQ(numNQ); usb_write8(Adapter, REG_RQPN_NPQ, value8); @@ -224,10 +220,9 @@ static void _InitNormalChipRegPriority(struct adapter *Adapter, u16 beQ, static void _InitNormalChipOneOutEpPriority(struct adapter *Adapter) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); - u16 value = 0; - switch (haldata->OutEpQueueSel) { + + switch (Adapter->HalData->OutEpQueueSel) { case TX_SELE_HQ: value = QUEUE_HIGH; break; @@ -246,13 +241,12 @@ static void _InitNormalChipOneOutEpPriority(struct adapter *Adapter) static void _InitNormalChipTwoOutEpPriority(struct adapter *Adapter) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); struct registry_priv *pregistrypriv = &Adapter->registrypriv; u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ; u16 valueHi = 0; u16 valueLow = 0; - switch (haldata->OutEpQueueSel) { + switch (Adapter->HalData->OutEpQueueSel) { case (TX_SELE_HQ | TX_SELE_LQ): valueHi = QUEUE_HIGH; valueLow = QUEUE_LOW; @@ -312,9 +306,7 @@ static void _InitNormalChipThreeOutEpPriority(struct adapter *Adapter) static void _InitQueuePriority(struct adapter *Adapter) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); - - switch (haldata->OutEpNumber) { + switch (Adapter->HalData->OutEpNumber) { case 1: _InitNormalChipOneOutEpPriority(Adapter); break; @@ -356,7 +348,7 @@ static void _InitDriverInfoSize(struct adapter *Adapter, u8 drvInfoSize) static void _InitWMACSetting(struct adapter *Adapter) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); + struct hal_data_8188e *haldata = Adapter->HalData; haldata->ReceiveConfig = RCR_AAP | RCR_APM | RCR_AM | RCR_AB | RCR_CBSSID_DATA | RCR_CBSSID_BCN | @@ -455,7 +447,7 @@ static void _InitRetryFunction(struct adapter *Adapter) */ static void usb_AggSettingTxUpdate(struct adapter *Adapter) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); + struct hal_data_8188e *haldata = Adapter->HalData; u32 value32; if (Adapter->registrypriv.wifi_spec) @@ -491,7 +483,7 @@ usb_AggSettingRxUpdate( struct adapter *Adapter ) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); + struct hal_data_8188e *haldata = Adapter->HalData; u8 valueDMA; u8 valueUSB; @@ -565,8 +557,6 @@ usb_AggSettingRxUpdate( static void InitUsbAggregationSetting(struct adapter *Adapter) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); - /* Tx aggregation setting */ usb_AggSettingTxUpdate(Adapter); @@ -574,12 +564,12 @@ static void InitUsbAggregationSetting(struct adapter *Adapter) usb_AggSettingRxUpdate(Adapter); /* 201/12/10 MH Add for USB agg mode dynamic switch. */ - haldata->UsbRxHighSpeedMode = false; + Adapter->HalData->UsbRxHighSpeedMode = false; } static void _InitBeaconParameters(struct adapter *Adapter) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); + struct hal_data_8188e *haldata = Adapter->HalData; usb_write16(Adapter, REG_BCN_CTRL, 0x1010); @@ -621,7 +611,7 @@ enum { static void _InitAntenna_Selection(struct adapter *Adapter) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); + struct hal_data_8188e *haldata = Adapter->HalData; if (haldata->AntDivCfg == 0) return; @@ -677,7 +667,7 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter) u16 value16; u8 txpktbuf_bndy; u32 status = _SUCCESS; - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); + struct hal_data_8188e *haldata = Adapter->HalData; struct pwrctrl_priv *pwrctrlpriv = &Adapter->pwrctrlpriv; struct registry_priv *pregistrypriv = &Adapter->registrypriv; unsigned long init_start_time = jiffies; @@ -904,7 +894,6 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_END); static void CardDisableRTL8188EU(struct adapter *Adapter) { u8 val8; - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("CardDisableRTL8188EU\n")); @@ -957,7 +946,7 @@ static void CardDisableRTL8188EU(struct adapter *Adapter) val8 = usb_read8(Adapter, REG_GPIO_IO_SEL+1); usb_write8(Adapter, REG_GPIO_IO_SEL+1, val8|0x0F);/* Reg0x43 */ usb_write32(Adapter, REG_BB_PAD_CTRL, 0x00080808);/* set LNA ,TRSW,EX_PA Pin to output mode */ - haldata->bMacPwrCtrlOn = false; + Adapter->HalData->bMacPwrCtrlOn = false; Adapter->bFWReady = false; } @@ -1035,7 +1024,7 @@ exit: /* */ static void Hal_EfuseParsePIDVID_8188EU(struct adapter *adapt, u8 *hwinfo, bool AutoLoadFail) { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); + struct hal_data_8188e *haldata = adapt->HalData; if (!AutoLoadFail) { /* VID, PID */ @@ -1120,9 +1109,7 @@ static void _ReadPROMContent( static void _ReadRFType(struct adapter *Adapter) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); - - haldata->rf_chip = RF_6052; + Adapter->HalData->rf_chip = RF_6052; } void rtw_hal_read_chip_info(struct adapter *Adapter) @@ -1145,7 +1132,7 @@ static void rtl8192cu_trigger_gpio_0(struct adapter *adapt) static void ResumeTxBeacon(struct adapter *adapt) { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); + struct hal_data_8188e *haldata = adapt->HalData; /* 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value */ /* which should be read from register to a global variable. */ @@ -1159,7 +1146,7 @@ static void ResumeTxBeacon(struct adapter *adapt) static void StopTxBeacon(struct adapter *adapt) { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); + struct hal_data_8188e *haldata = adapt->HalData; /* 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value */ /* which should be read from register to a global variable. */ @@ -1266,7 +1253,7 @@ static void hw_var_set_bcn_func(struct adapter *Adapter, u8 variable, u8 *val) void rtw_hal_set_hwreg(struct adapter *Adapter, u8 variable, u8 *val) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); + struct hal_data_8188e *haldata = Adapter->HalData; struct dm_priv *pdmpriv = &haldata->dmpriv; struct odm_dm_struct *podmpriv = &haldata->odmpriv; @@ -1765,11 +1752,9 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 variable, u8 *val) void rtw_hal_get_hwreg(struct adapter *Adapter, u8 variable, u8 *val) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); - switch (variable) { case HW_VAR_BASIC_RATE: - *((u16 *)(val)) = haldata->BasicRateSet; + *((u16 *)(val)) = Adapter->HalData->BasicRateSet; case HW_VAR_TXPAUSE: val[0] = usb_read8(Adapter, REG_TXPAUSE); break; @@ -1778,7 +1763,7 @@ void rtw_hal_get_hwreg(struct adapter *Adapter, u8 variable, u8 *val) val[0] = (BIT(0) & usb_read8(Adapter, REG_TDECTRL+2)) ? true : false; break; case HW_VAR_RF_TYPE: - val[0] = haldata->rf_type; + val[0] = Adapter->HalData->rf_type; break; case HW_VAR_FWLPS_RF_ON: { @@ -1799,13 +1784,13 @@ void rtw_hal_get_hwreg(struct adapter *Adapter, u8 variable, u8 *val) } break; case HW_VAR_CURRENT_ANTENNA: - val[0] = haldata->CurAntenna; + val[0] = Adapter->HalData->CurAntenna; break; case HW_VAR_EFUSE_BYTES: /* To get EFUE total used bytes, added by Roger, 2008.12.22. */ - *((u16 *)(val)) = haldata->EfuseUsedBytes; + *((u16 *)(val)) = Adapter->HalData->EfuseUsedBytes; break; case HW_VAR_APFM_ON_MAC: - *val = haldata->bMacPwrCtrlOn; + *val = Adapter->HalData->bMacPwrCtrlOn; break; case HW_VAR_CHK_HI_QUEUE_EMPTY: *val = ((usb_read32(Adapter, REG_HGQ_INFORMATION)&0x0000ff00) == 0) ? true : false; @@ -1825,7 +1810,7 @@ u8 rtw_hal_get_def_var( void *pValue ) { - struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); + struct hal_data_8188e *haldata = Adapter->HalData; u8 bResult = _SUCCESS; switch (eVariable) { @@ -1921,7 +1906,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level) u8 shortGIrate = false; int supportRateNum = 0; struct sta_info *psta; - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); + struct odm_dm_struct *odmpriv = &adapt->HalData->odmpriv; struct mlme_ext_priv *pmlmeext = &adapt->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *cur_network = &pmlmeinfo->network; @@ -1960,7 +1945,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level) break; } - rate_bitmap = ODM_Get_Rate_Bitmap(&haldata->odmpriv, mac_id, mask, rssi_level); + rate_bitmap = ODM_Get_Rate_Bitmap(odmpriv, mac_id, mask, rssi_level); DBG_88E("%s => mac_id:%d, networkType:0x%02x, mask:0x%08x\n\t ==> rssi_level:%d, rate_bitmap:0x%08x\n", __func__, mac_id, networkType, mask, rssi_level, rate_bitmap); @@ -1968,8 +1953,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level) init_rate = get_highest_rate_idx(mask)&0x3f; - ODM_RA_UpdateRateInfo_8188E(&haldata->odmpriv, mac_id, - raid, mask, shortGIrate); + ODM_RA_UpdateRateInfo_8188E(odmpriv, mac_id, raid, mask, shortGIrate); /* set ra_id */ psta->raid = raid; @@ -2012,11 +1996,10 @@ void rtw_hal_bcn_related_reg_setting(struct adapter *adapt) void rtw_hal_def_value_init(struct adapter *adapt) { - struct hal_data_8188e *haldata; + struct hal_data_8188e *haldata = adapt->HalData; struct pwrctrl_priv *pwrctrlpriv; u8 i; - haldata = GET_HAL_DATA(adapt); pwrctrlpriv = &adapt->pwrctrlpriv; /* init default value */ diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h index 5362218..34268d9 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h @@ -351,9 +351,6 @@ struct hal_data_8188e { u8 UsbRxAggPageTimeout; }; -#define GET_HAL_DATA(__pAdapter) \ - ((struct hal_data_8188e *)((__pAdapter)->HalData)) - /* rtl8188e_hal_init.c */ void _8051Reset88E(struct adapter *padapter); void rtl8188e_InitializeFirmwareVars(struct adapter *padapter); diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c index 52fa659..d0d5915 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c @@ -20,7 +20,7 @@ static void interrupt_handler_8188eu(struct adapter *adapt, u16 pkt_len, u8 *pbuf) { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); + struct hal_data_8188e *haldata = adapt->HalData; if (pkt_len != INTERRUPT_MSG_FORMAT_LEN) { DBG_88E("%s Invalid interrupt content length (%d)!\n", __func__, pkt_len); @@ -48,7 +48,7 @@ static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb) struct sk_buff *pkt_copy = NULL; struct recv_frame *precvframe = NULL; struct rx_pkt_attrib *pattrib = NULL; - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); + struct hal_data_8188e *haldata = adapt->HalData; struct recv_priv *precvpriv = &adapt->recvpriv; struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue; @@ -285,8 +285,7 @@ static int usbctrl_vendorreq(struct adapter *adapt, u8 request, u16 value, u16 i if (status == (-ESHUTDOWN) || status == -ENODEV) { adapt->bSurpriseRemoved = true; } else { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); - haldata->srestpriv.Wifi_Error_Status = USB_VEN_REQ_CMD_FAIL; + adapt->HalData->srestpriv.Wifi_Error_Status = USB_VEN_REQ_CMD_FAIL; } } else { /* status != len && status >= 0 */ if (status > 0) { @@ -436,10 +435,7 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) break; case -EPROTO: case -EOVERFLOW: - { - struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); - haldata->srestpriv.Wifi_Error_Status = USB_READ_PORT_FAIL; - } + adapt->HalData->srestpriv.Wifi_Error_Status = USB_READ_PORT_FAIL; precvbuf->reuse = true; usb_read_port(adapt, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); break; -- 2.7.4