diff options
Diffstat (limited to 'drivers/staging/rtl8188eu/core/rtw_cmd.c')
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_cmd.c | 220 |
1 files changed, 50 insertions, 170 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 82fe8c47a1de..c2fb050337d5 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -32,11 +32,10 @@ Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. No irqsave is necessary. */ -int _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) +int _rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { int res = _SUCCESS; -_func_enter_; sema_init(&(pcmdpriv->cmd_queue_sema), 0); /* sema_init(&(pcmdpriv->cmd_done_sema), 0); */ @@ -71,7 +70,6 @@ _func_enter_; pcmdpriv->cmd_done_cnt = 0; pcmdpriv->rsp_cnt = 0; exit: -_func_exit_; return res; } @@ -81,24 +79,21 @@ int _rtw_init_evt_priv(struct evt_priv *pevtpriv) { int res = _SUCCESS; -_func_enter_; /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ atomic_set(&pevtpriv->event_seq, 0); pevtpriv->evt_done_cnt = 0; - _init_workitem(&pevtpriv->c2h_wk, c2h_wk_callback, NULL); + INIT_WORK(&pevtpriv->c2h_wk, c2h_wk_callback); pevtpriv->c2h_wk_alive = false; pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN+1); -_func_exit_; return res; } -void rtw_free_evt_priv(struct evt_priv *pevtpriv) +void rtw_free_evt_priv(struct evt_priv *pevtpriv) { -_func_enter_; RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("+rtw_free_evt_priv\n")); @@ -113,21 +108,15 @@ _func_enter_; } RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("-rtw_free_evt_priv\n")); -_func_exit_; } -void _rtw_free_cmd_priv (struct cmd_priv *pcmdpriv) +void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) { -_func_enter_; if (pcmdpriv) { - if (pcmdpriv->cmd_allocated_buf) - kfree(pcmdpriv->cmd_allocated_buf); - - if (pcmdpriv->rsp_allocated_buf) - kfree(pcmdpriv->rsp_allocated_buf); + kfree(pcmdpriv->cmd_allocated_buf); + kfree(pcmdpriv->rsp_allocated_buf); } -_func_exit_; } /* @@ -140,11 +129,10 @@ ISR/Call-Back functions can't call this sub-function. */ -int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) +int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) { unsigned long irqL; -_func_enter_; if (obj == NULL) goto exit; @@ -157,7 +145,6 @@ _func_enter_; exit: -_func_exit_; return _SUCCESS; } @@ -167,47 +154,39 @@ struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue) unsigned long irqL; struct cmd_obj *obj; -_func_enter_; spin_lock_irqsave(&queue->lock, irqL); if (rtw_is_list_empty(&(queue->queue))) { obj = NULL; } else { - obj = LIST_CONTAINOR(get_next(&(queue->queue)), struct cmd_obj, list); + obj = container_of((&queue->queue)->next, struct cmd_obj, list); rtw_list_delete(&obj->list); } spin_unlock_irqrestore(&queue->lock, irqL); -_func_exit_; return obj; } -u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) +u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { u32 res; -_func_enter_; - res = _rtw_init_cmd_priv (pcmdpriv); -_func_exit_; + res = _rtw_init_cmd_priv(pcmdpriv); return res; } -u32 rtw_init_evt_priv (struct evt_priv *pevtpriv) +u32 rtw_init_evt_priv(struct evt_priv *pevtpriv) { - int res; -_func_enter_; + int res; res = _rtw_init_evt_priv(pevtpriv); -_func_exit_; return res; } -void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) +void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) { -_func_enter_; RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("rtw_free_cmd_priv\n")); _rtw_free_cmd_priv(pcmdpriv); -_func_exit_; } static int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) @@ -238,7 +217,6 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) int res = _FAIL; struct adapter *padapter = pcmdpriv->padapter; -_func_enter_; if (cmd_obj == NULL) goto exit; @@ -258,34 +236,28 @@ _func_enter_; exit: -_func_exit_; return res; } -struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv) +struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv) { struct cmd_obj *cmd_obj; -_func_enter_; cmd_obj = _rtw_dequeue_cmd(&pcmdpriv->cmd_queue); -_func_exit_; return cmd_obj; } -void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv) +void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv) { -_func_enter_; pcmdpriv->cmd_done_cnt++; /* up(&(pcmdpriv->cmd_done_sema)); */ -_func_exit_; } void rtw_free_cmd_obj(struct cmd_obj *pcmd) { -_func_enter_; if ((pcmd->cmdcode != _JoinBss_CMD_) && (pcmd->cmdcode != _CreateBss_CMD_)) { /* free parmbuf in cmd_obj */ @@ -302,7 +274,6 @@ _func_enter_; /* free cmd_obj */ kfree(pcmd); -_func_exit_; } int rtw_cmd_thread(void *context) @@ -315,7 +286,6 @@ int rtw_cmd_thread(void *context) struct adapter *padapter = (struct adapter *)context; struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); -_func_enter_; thread_enter("RTW_CMD_THREAD"); @@ -410,7 +380,6 @@ post_process: up(&pcmdpriv->terminate_cmdthread_sema); -_func_exit_; complete_and_exit(NULL, 0); } @@ -423,15 +392,14 @@ u8 rtw_setstandby_cmd(struct adapter *padapter, uint action) u8 ret = _SUCCESS; -_func_enter_; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (ph2c == NULL) { ret = _FAIL; goto exit; } - psetusbsuspend = (struct usb_suspend_parm *)rtw_zmalloc(sizeof(struct usb_suspend_parm)); + psetusbsuspend = kzalloc(sizeof(struct usb_suspend_parm), GFP_KERNEL); if (psetusbsuspend == NULL) { kfree(ph2c); ret = _FAIL; @@ -446,7 +414,6 @@ _func_enter_; exit: -_func_exit_; return ret; } @@ -465,14 +432,11 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -_func_enter_; - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED) == true) rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); - } - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED) == true) p2p_ps_wk_cmd(padapter, P2P_PS_SCAN, 1); - } ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) @@ -500,9 +464,6 @@ _func_enter_; if (ssid[i].SsidLength) { memcpy(&psurveyPara->ssid[i], &ssid[i], sizeof(struct ndis_802_11_ssid)); psurveyPara->ssid_num++; - if (0) - DBG_88E(FUNC_ADPT_FMT" ssid:(%s, %d)\n", FUNC_ADPT_ARG(padapter), - psurveyPara->ssid[i].Ssid, psurveyPara->ssid[i].SsidLength); } } } @@ -514,9 +475,6 @@ _func_enter_; if (ch[i].hw_value && !(ch[i].flags & RTW_IEEE80211_CHAN_DISABLED)) { memcpy(&psurveyPara->ch[i], &ch[i], sizeof(struct rtw_ieee80211_channel)); psurveyPara->ch_num++; - if (0) - DBG_88E(FUNC_ADPT_FMT" ch:%u\n", FUNC_ADPT_ARG(padapter), - psurveyPara->ch[i].hw_value); } } } @@ -537,7 +495,6 @@ _func_enter_; _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); } -_func_exit_; return res; } @@ -549,7 +506,6 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -570,7 +526,6 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; } @@ -582,7 +537,6 @@ u8 rtw_setbasicrate_cmd(struct adapter *padapter, u8 *rateset) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -604,7 +558,6 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; } @@ -624,7 +577,6 @@ u8 rtw_setphy_cmd(struct adapter *padapter, u8 modem, u8 ch) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -648,7 +600,6 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; } @@ -659,7 +610,6 @@ u8 rtw_setbbreg_cmd(struct adapter *padapter, u8 offset, u8 val) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -680,7 +630,6 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; } @@ -691,7 +640,6 @@ u8 rtw_getbbreg_cmd(struct adapter *padapter, u8 offset, u8 *pval) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -715,7 +663,6 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; } @@ -725,7 +672,6 @@ u8 rtw_setrfreg_cmd(struct adapter *padapter, u8 offset, u32 val) struct writeRF_parm *pwriterfparm; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -746,7 +692,6 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; } @@ -757,7 +702,6 @@ u8 rtw_getrfreg_cmd(struct adapter *padapter, u8 offset, u8 *pval) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -785,33 +729,28 @@ _func_enter_; exit: -_func_exit_; return res; } void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) { - _func_enter_; kfree(pcmd->parmbuf); kfree(pcmd); if (padapter->registrypriv.mp_mode == 1) padapter->mppriv.workparam.bcompleted = true; -_func_exit_; } void rtw_readtssi_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) { - _func_enter_; kfree(pcmd->parmbuf); kfree(pcmd); if (padapter->registrypriv.mp_mode == 1) padapter->mppriv.workparam.bcompleted = true; -_func_exit_; } u8 rtw_createbss_cmd(struct adapter *padapter) @@ -822,7 +761,6 @@ u8 rtw_createbss_cmd(struct adapter *padapter) struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network; u8 res = _SUCCESS; -_func_enter_; rtw_led_control(padapter, LED_CTL_START_TO_LINK); @@ -847,7 +785,6 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, pcmd); exit: -_func_exit_; return res; } @@ -858,7 +795,6 @@ u8 rtw_createbss_cmd_ex(struct adapter *padapter, unsigned char *pbss, unsigned struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmd == NULL) { @@ -877,7 +813,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -898,15 +833,13 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); -_func_enter_; rtw_led_control(padapter, LED_CTL_START_TO_LINK); - if (pmlmepriv->assoc_ssid.SsidLength == 0) { + if (pmlmepriv->assoc_ssid.SsidLength == 0) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("+Join cmd: Any SSid\n")); - } else { + else RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); - } pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmd == NULL) { @@ -952,11 +885,10 @@ _func_enter_; psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->IELength; - if ((psecnetwork->IELength-12) < (256-1)) { + if ((psecnetwork->IELength-12) < (256-1)) memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12); - } else { + else memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1)); - } psecnetwork->IELength = 0; /* Added by Albert 2009/02/18 */ @@ -987,9 +919,12 @@ _func_enter_; phtpriv->ht_option = false; if (pregistrypriv->ht_enable) { - /* Added by Albert 2010/06/23 */ - /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ - /* Especially for Realtek 8192u SoftAP. */ + /* + * Added by Albert 2010/06/23 + * For the WEP mode, we will use the bg mode to do + * the connection to avoid some IOT issue. + * Especially for Realtek 8192u SoftAP. + */ if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) { @@ -1020,7 +955,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -1032,7 +966,6 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu struct cmd_priv *cmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_disassoc_cmd\n")); @@ -1063,7 +996,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -1076,7 +1008,6 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infra n struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -1098,7 +1029,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -1115,7 +1045,6 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key) struct sta_info *sta = (struct sta_info *)psta; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -1142,7 +1071,7 @@ _func_enter_; ph2c->rsp = (u8 *)psetstakey_rsp; ph2c->rspsz = sizeof(struct set_stakey_rsp); - memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN); + ether_addr_copy(psetstakey_para->addr, sta->hwaddr); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) psetstakey_para->algorithm = (unsigned char) psecuritypriv->dot11PrivacyAlgrthm; @@ -1161,7 +1090,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -1175,7 +1103,6 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue) struct sta_info *sta = (struct sta_info *)psta; u8 res = _SUCCESS; -_func_enter_; if (!enqueue) { clear_cam_entry(padapter, entry); @@ -1205,7 +1132,7 @@ _func_enter_; ph2c->rsp = (u8 *)psetstakey_rsp; ph2c->rspsz = sizeof(struct set_stakey_rsp); - memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN); + ether_addr_copy(psetstakey_para->addr, sta->hwaddr); psetstakey_para->algorithm = _NO_PRIVACY_; @@ -1215,7 +1142,6 @@ _func_enter_; } exit: -_func_exit_; return res; } @@ -1226,7 +1152,6 @@ u8 rtw_setrttbl_cmd(struct adapter *padapter, struct setratable_parm *prate_tab struct setratable_parm *psetrttblparm; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -1247,7 +1172,6 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; } @@ -1257,7 +1181,6 @@ u8 rtw_getrttbl_cmd(struct adapter *padapter, struct getratable_rsp *pval) struct getratable_parm *pgetrttblparm; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -1272,8 +1195,6 @@ _func_enter_; goto exit; } -/* init_h2fwcmd_w_parm_no_rsp(ph2c, psetrttblparm, GEN_CMD_CODE(_SetRaTable)); */ - _rtw_init_listhead(&ph2c->list); ph2c->cmdcode = GEN_CMD_CODE(_GetRaTable); ph2c->parmbuf = (unsigned char *)pgetrttblparm; @@ -1285,7 +1206,6 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; } @@ -1298,7 +1218,6 @@ u8 rtw_setassocsta_cmd(struct adapter *padapter, u8 *mac_addr) u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -1324,16 +1243,15 @@ _func_enter_; ph2c->rsp = (u8 *)psetassocsta_rsp; ph2c->rspsz = sizeof(struct set_assocsta_rsp); - memcpy(psetassocsta_para->addr, mac_addr, ETH_ALEN); + ether_addr_copy(psetassocsta_para->addr, mac_addr); res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; - } +} u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr) { @@ -1342,7 +1260,6 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr) struct addBaReq_parm *paddbareq_parm; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -1369,7 +1286,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -1381,7 +1297,6 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -1406,7 +1321,6 @@ _func_enter_; /* rtw_enqueue_cmd(pcmdpriv, ph2c); */ res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; } @@ -1418,7 +1332,6 @@ u8 rtw_set_ch_cmd(struct adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 enque u8 res = _SUCCESS; -_func_enter_; DBG_88E(FUNC_NDEV_FMT" ch:%u, bw:%u, ch_offset:%u\n", FUNC_NDEV_ARG(padapter->pnetdev), ch, bw, ch_offset); @@ -1460,7 +1373,6 @@ exit: DBG_88E(FUNC_NDEV_FMT" res:%u\n", FUNC_NDEV_ARG(padapter->pnetdev), res); -_func_exit_; return res; } @@ -1473,7 +1385,6 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) u8 res = _SUCCESS; -_func_enter_; RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_chplan_cmd\n")); @@ -1516,7 +1427,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -1529,7 +1439,6 @@ u8 rtw_led_blink_cmd(struct adapter *padapter, struct LED_871x *pLed) u8 res = _SUCCESS; -_func_enter_; RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_led_blink_cmd\n")); @@ -1553,7 +1462,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -1566,7 +1474,6 @@ u8 rtw_set_csa_cmd(struct adapter *padapter, u8 new_ch_no) u8 res = _SUCCESS; -_func_enter_; RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_csa_cmd\n")); @@ -1590,7 +1497,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -1685,7 +1591,6 @@ static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type) struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); u8 mstatus; -_func_enter_; if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) @@ -1724,7 +1629,6 @@ _func_enter_; break; } -_func_exit_; } u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) @@ -1735,11 +1639,6 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) /* struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; */ u8 res = _SUCCESS; -_func_enter_; - - /* if (!pwrctrlpriv->bLeisurePs) */ - /* return res; */ - if (enqueue) { ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { @@ -1767,7 +1666,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -1785,7 +1683,6 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time) u8 res = _SUCCESS; -_func_enter_; ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ph2c == NULL) { res = _FAIL; @@ -1806,7 +1703,6 @@ _func_enter_; res = rtw_enqueue_cmd(pcmdpriv, ph2c); exit: -_func_exit_; return res; } @@ -1824,7 +1720,6 @@ u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue) u8 support_ant_div; u8 res = _SUCCESS; -_func_enter_; rtw_hal_get_def_var(padapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &support_ant_div); if (!support_ant_div) return res; @@ -1854,7 +1749,6 @@ _func_enter_; } exit: -_func_exit_; return res; } @@ -1873,7 +1767,6 @@ u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return res; @@ -1892,8 +1785,8 @@ _func_enter_; } pdrvextra_cmd_parm->ec_id = P2P_PROTO_WK_CID; - pdrvextra_cmd_parm->type_size = intCmdType; /* As the command tppe. */ - pdrvextra_cmd_parm->pbuf = NULL; /* Must be NULL here */ + pdrvextra_cmd_parm->type_size = intCmdType; /* As the command tppe. */ + pdrvextra_cmd_parm->pbuf = NULL; /* Must be NULL here */ init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); @@ -1901,7 +1794,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -1914,7 +1806,6 @@ u8 rtw_ps_cmd(struct adapter *padapter) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; -_func_enter_; ppscmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); if (ppscmd == NULL) { @@ -1937,7 +1828,6 @@ _func_enter_; exit: -_func_exit_; return res; } @@ -2084,12 +1974,16 @@ static void c2h_wk_callback(struct work_struct *work) evtpriv->c2h_wk_alive = true; while (!rtw_cbuf_empty(evtpriv->c2h_queue)) { - if ((c2h_evt = (struct c2h_evt_hdr *)rtw_cbuf_pop(evtpriv->c2h_queue)) != NULL) { + c2h_evt = (struct c2h_evt_hdr *) + rtw_cbuf_pop(evtpriv->c2h_queue); + if (c2h_evt != NULL) /* This C2H event is read, clear it */ c2h_evt_clear(adapter); - } else if ((c2h_evt = (struct c2h_evt_hdr *)rtw_malloc(16)) != NULL) { + else { + c2h_evt = (struct c2h_evt_hdr *)rtw_malloc(16); /* This C2H event is not read, read & clear now */ - if (c2h_evt_read(adapter, (u8 *)c2h_evt) != _SUCCESS) + if (c2h_evt != NULL && + c2h_evt_read(adapter, (u8 *)c2h_evt) != _SUCCESS) continue; } @@ -2147,8 +2041,10 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf) p2p_ps_wk_hdl(padapter, pdrvextra_cmd->type_size); break; case P2P_PROTO_WK_CID: - /* Commented by Albert 2011/07/01 */ - /* I used the type_size as the type command */ + /* + * Commented by Albert 2011/07/01 + * I used the type_size as the type command + */ p2p_protocol_wk_hdl(padapter, pdrvextra_cmd->type_size); break; #endif @@ -2174,13 +2070,12 @@ void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -_func_enter_; if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ /* need to make timeout handlerOS independent */ _set_timer(&pmlmepriv->scan_to_timer, 1); - } else if (pcmd->res != H2C_SUCCESS) { + } else if (pcmd->res != H2C_SUCCESS) { _set_timer(&pmlmepriv->scan_to_timer, 1); RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: MgntActrtw_set_802_11_bssid_LIST_SCAN Fail ************\n\n.")); } @@ -2188,13 +2083,11 @@ _func_enter_; /* free cmd */ rtw_free_cmd_obj(pcmd); -_func_exit_; } void rtw_disassoc_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -_func_enter_; if (pcmd->res != H2C_SUCCESS) { spin_lock_bh(&pmlmepriv->lock); @@ -2202,24 +2095,18 @@ _func_enter_; spin_unlock_bh(&pmlmepriv->lock); RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ***Error: disconnect_cmd_callback Fail ***\n.")); - - goto exit; + return; } else /* clear bridge database */ nat25_db_cleanup(padapter); /* free cmd */ rtw_free_cmd_obj(pcmd); - -exit: - -_func_exit_; } void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -_func_enter_; if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ @@ -2232,7 +2119,6 @@ _func_enter_; rtw_free_cmd_obj(pcmd); -_func_exit_; } void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) @@ -2244,9 +2130,8 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)pcmd->parmbuf; struct wlan_network *tgt_network = &(pmlmepriv->cur_network); -_func_enter_; - if ((pcmd->res != H2C_SUCCESS)) { + if (pcmd->res != H2C_SUCCESS) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n.")); _set_timer(&pmlmepriv->assoc_timer, 1); } @@ -2261,7 +2146,7 @@ _func_enter_; psta = rtw_alloc_stainfo(&padapter->stapriv, pnetwork->MacAddress); if (psta == NULL) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nCan't alloc sta_info when createbss_cmd_callback\n")); - goto createbss_cmd_fail ; + goto createbss_cmd_fail; } } @@ -2298,7 +2183,6 @@ createbss_cmd_fail: rtw_free_cmd_obj(pcmd); -_func_exit_; } void rtw_setstaKey_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) @@ -2307,7 +2191,6 @@ void rtw_setstaKey_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pc struct set_stakey_rsp *psetstakey_rsp = (struct set_stakey_rsp *)(pcmd->rsp); struct sta_info *psta = rtw_get_stainfo(pstapriv, psetstakey_rsp->addr); -_func_enter_; if (psta == NULL) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: rtw_setstaKey_cmdrsp_callback => can't get sta_info\n\n")); @@ -2315,7 +2198,6 @@ _func_enter_; } exit: rtw_free_cmd_obj(pcmd); -_func_exit_; } void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) @@ -2326,7 +2208,6 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj * struct set_assocsta_rsp *passocsta_rsp = (struct set_assocsta_rsp *)(pcmd->rsp); struct sta_info *psta = rtw_get_stainfo(pstapriv, passocsta_parm->addr); -_func_enter_; if (psta == NULL) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: setassocsta_cmdrsp_callbac => can't get sta_info\n\n")); @@ -2347,5 +2228,4 @@ _func_enter_; exit: rtw_free_cmd_obj(pcmd); -_func_exit_; } |