diff options
author | 2016-04-11 10:41:07 +0300 | |
---|---|---|
committer | 2016-04-13 08:17:18 +0300 | |
commit | e09b41010ba33a20a87472ee821fa407a5b8da36 (patch) | |
tree | d10dc367189862e7ca5c592f033dc3726e1df4e3 /kernel/drivers/staging/rtl8723au | |
parent | f93b97fd65072de626c074dbe099a1fff05ce060 (diff) |
These changes are the raw update to linux-4.4.6-rt14. Kernel sources
are taken from kernel.org, and rt patch from the rt wiki download page.
During the rebasing, the following patch collided:
Force tick interrupt and get rid of softirq magic(I70131fb85).
Collisions have been removed because its logic was found on the
source already.
Change-Id: I7f57a4081d9deaa0d9ccfc41a6c8daccdee3b769
Signed-off-by: José Pekkarinen <jose.pekkarinen@nokia.com>
Diffstat (limited to 'kernel/drivers/staging/rtl8723au')
26 files changed, 378 insertions, 610 deletions
diff --git a/kernel/drivers/staging/rtl8723au/core/rtw_ap.c b/kernel/drivers/staging/rtl8723au/core/rtw_ap.c index 645668950..1aa9b267c 100644 --- a/kernel/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/kernel/drivers/staging/rtl8723au/core/rtw_ap.c @@ -21,10 +21,7 @@ #include <rtl8723a_cmd.h> #include <rtl8723a_hal.h> #include <asm/unaligned.h> - -extern unsigned char WMM_OUI23A[]; -extern unsigned char WPS_OUI23A[]; -extern unsigned char P2P_OUI23A[]; +#include <rtw_mlme_ext.h> void init_mlme_ap_info23a(struct rtw_adapter *padapter) { @@ -132,11 +129,11 @@ static void update_BCNTIM(struct rtw_adapter *padapter) *dst_ie++ = tim_ielen; - *dst_ie++ = 0;/* DTIM count */ - *dst_ie++ = 1;/* DTIM period */ + *dst_ie++ = 0; /* DTIM count */ + *dst_ie++ = 1; /* DTIM period */ - if (pstapriv->tim_bitmap & BIT(0))/* for bc/mc frames */ - *dst_ie++ = BIT(0);/* bitmap ctrl */ + if (pstapriv->tim_bitmap & BIT(0)) /* for bc/mc frames */ + *dst_ie++ = BIT(0); /* bitmap ctrl */ else *dst_ie++ = 0; @@ -239,11 +236,16 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) if (psta->state & WIFI_SLEEP_STATE) { if (!(psta->state & WIFI_STA_ALIVE_CHK_STATE)) { - /* to check if alive by another methods if station is at ps mode. */ + /* + * check if alive by another method + * if station is at ps mode. + */ psta->expire_to = pstapriv->expire_to; psta->state |= WIFI_STA_ALIVE_CHK_STATE; - - /* to update bcn with tim_bitmap for this station */ + /* + * update bcn with tim_bitmap + * for this station + */ pstapriv->tim_bitmap |= CHKBIT(psta->aid); update_beacon23a(padapter, WLAN_EID_TIM, NULL, false); @@ -264,7 +266,10 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) psta->hwaddr, psta->state); updated = ap_free_sta23a(padapter, psta, false, WLAN_REASON_DEAUTH_LEAVING); } else { - /* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */ + /* + * TODO: Aging mechanism to digest frames in + * sleep_q to avoid running out of xmitframe + */ if (psta->sleepq_len > (NR_XMITFRAME/pstapriv->asoc_list_cnt) && padapter->xmitpriv.free_xmitframe_cnt < ((NR_XMITFRAME/pstapriv->asoc_list_cnt)/2) ) { @@ -285,13 +290,16 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) u8 backup_oper_channel = 0; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - /* switch to correct channel of current network before issue keep-alive frames */ + /* + * switch to correct channel of current + * network before issue keep-alive frames + */ if (rtw_get_oper_ch23a(padapter) != pmlmeext->cur_channel) { backup_oper_channel = rtw_get_oper_ch23a(padapter); SelectChannel23a(padapter, pmlmeext->cur_channel); } - /* issue null data to check sta alive*/ + /* issue null data to check sta alive */ for (i = 0; i < chk_alive_num; i++) { int ret = _FAIL; @@ -332,7 +340,7 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) } - if (backup_oper_channel > 0) /* back to the original operation channel */ + if (backup_oper_channel > 0) /* back to original operation channel */ SelectChannel23a(padapter, backup_oper_channel); } @@ -369,9 +377,9 @@ void add_RATid23a(struct rtw_adapter *padapter, struct sta_info *psta, u8 rssi_l rf_type = rtl8723a_get_rf_type(padapter); if (rf_type == RF_2T2R) - limit = 16;/* 2R */ + limit = 16; /* 2R */ else - limit = 8;/* 1R */ + limit = 8; /* 1R */ for (i = 0; i < limit; i++) { if (psta_ht->ht_cap.mcs.rx_mask[i / 8] & BIT(i % 8)) @@ -403,11 +411,11 @@ void add_RATid23a(struct rtw_adapter *padapter, struct sta_info *psta, u8 rssi_l init_rate = get_highest_rate_idx23a(tx_ra_bitmap&0x0fffffff)&0x3f; if (psta->aid < NUM_STA) { - u8 arg = 0; + u8 arg; arg = psta->mac_id&0x1f; - arg |= BIT(7);/* support entry 2~31 */ + arg |= BIT(7); /* support entry 2~31 */ if (shortGIrate == true) arg |= BIT(5); @@ -446,7 +454,7 @@ static void update_bmc_sta(struct rtw_adapter *padapter) struct sta_info *psta = rtw_get_bcmc_stainfo23a(padapter); if (psta) { - psta->aid = 0;/* default set to 0 */ + psta->aid = 0; /* default set to 0 */ psta->mac_id = psta->aid + 1; psta->qos_option = 0; @@ -473,7 +481,7 @@ static void update_bmc_sta(struct rtw_adapter *padapter) if (pcur_network->DSConfig > 14) { /* force to A mode. 5G doesn't support CCK rates */ network_type = WIRELESS_11A; - tx_ra_bitmap = 0x150; /* 6, 12, 24 Mbps */ + tx_ra_bitmap = 0x150; /* 6, 12, 24 Mbps */ } else { /* force to b mode */ network_type = WIRELESS_11B; @@ -487,7 +495,7 @@ static void update_bmc_sta(struct rtw_adapter *padapter) rtl8723a_SetHalODMVar(padapter, HAL_ODM_STA_INFO, psta, true); { - u8 arg = 0; + u8 arg; arg = psta->mac_id&0x1f; @@ -516,13 +524,13 @@ static void update_bmc_sta(struct rtw_adapter *padapter) DBG_8723A("add_RATid23a_bmc_sta error!\n"); } -/* notes: */ -/* AID: 1~MAX for sta and 0 for bc/mc in ap/adhoc mode */ -/* MAC_ID = AID+1 for sta in ap/adhoc mode */ -/* MAC_ID = 1 for bc/mc for sta/ap/adhoc */ -/* MAC_ID = 0 for bssid for sta/ap/adhoc */ -/* CAM_ID = 0~3 for default key, cmd_id = macid + 3, macid = aid+1; */ - +/* + * AID: 1~MAX for sta and 0 for bc/mc in ap/adhoc mode + * MAC_ID = AID+1 for sta in ap/adhoc mode + * MAC_ID = 1 for bc/mc for sta/ap/adhoc + * MAC_ID = 0 for bssid for sta/ap/adhoc + * CAM_ID = 0~3 for default key, cmd_id = macid + 3, macid = aid + 1; + */ void update_sta_info23a_apmode23a(struct rtw_adapter *padapter, struct sta_info *psta) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -556,7 +564,7 @@ void update_sta_info23a_apmode23a(struct rtw_adapter *padapter, struct sta_info if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) phtpriv_sta->sgi = true; - /* bwmode */ + /* bwmode */ if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40)) { /* phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_40; */ phtpriv_sta->bwmode = pmlmeext->cur_bwmode; @@ -575,10 +583,10 @@ void update_sta_info23a_apmode23a(struct rtw_adapter *padapter, struct sta_info } /* Rx AMPDU */ - send_delba23a(padapter, 0, psta->hwaddr);/* recipient */ + send_delba23a(padapter, 0, psta->hwaddr); /* recipient */ /* TX AMPDU */ - send_delba23a(padapter, 1, psta->hwaddr);/* originator */ + send_delba23a(padapter, 1, psta->hwaddr); /* originator */ phtpriv_sta->agg_enable_bitmap = 0x0;/* reset */ phtpriv_sta->candidate_tid_bitmap = 0x0;/* reset */ @@ -599,11 +607,10 @@ static void update_hw_ht_param(struct rtw_adapter *padapter) struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; DBG_8723A("%s\n", __func__); - - /* handle A-MPDU parameter field */ /* - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k - AMPDU_para [4:2]:Min MPDU Start Spacing + * handle A-MPDU parameter field + * AMPDU_para [1:0]:Max AMPDU Len => 0:8k, 1:16k, 2:32k, 3:64k + * AMPDU_para [4:2]:Min MPDU Start Spacing */ max_AMPDU_len = pmlmeinfo->ht_cap.ampdu_params_info & IEEE80211_HT_AMPDU_PARM_FACTOR; @@ -614,7 +621,7 @@ static void update_hw_ht_param(struct rtw_adapter *padapter) rtl8723a_set_ampdu_min_space(padapter, min_MPDU_spacing); rtl8723a_set_ampdu_factor(padapter, max_AMPDU_len); - /* Config SM Power Save setting */ + /* Config SM Power Save setting */ pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->ht_cap.cap_info) & IEEE80211_HT_CAP_SM_PS) >> 2; if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) @@ -641,13 +648,17 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf) cur_bwmode = HT_CHANNEL_WIDTH_20; cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - /* check if there is wps ie, */ - /* if there is wpsie in beacon, the hostapd will update beacon twice when stating hostapd, */ - /* and at first time the security ie (RSN/WPA IE) will not include in beacon. */ - if (NULL == cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, - WLAN_OUI_TYPE_MICROSOFT_WPS, - pnetwork->IEs, - pnetwork->IELength)) + /* + * check if there is wps ie + * if there is wpsie in beacon the hostapd will + * update beacon twice when stating hostapd + * and at first time the security + * ie (RSN/WPA IE) will not include in beacon + */ + if (!cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, + WLAN_OUI_TYPE_MICROSOFT_WPS, + pnetwork->IEs, + pnetwork->IELength)) pmlmeext->bstart_bss = true; /* todo: update wmm, ht cap */ @@ -663,8 +674,11 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf) } if (pmlmepriv->cur_network.join_res != true) { - /* setting only at first time */ - /* WEP Key will be set before this function, do not clear CAM. */ + /* + * setting only at first time + * WEP Key will be set before this + * function, do not clear CAM. + */ if (psecuritypriv->dot11PrivacyAlgrthm != WLAN_CIPHER_SUITE_WEP40 && psecuritypriv->dot11PrivacyAlgrthm != @@ -679,13 +693,13 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf) hw_var_set_bssid(padapter, pnetwork->MacAddress); /* Set EDCA param reg */ - acparm = 0x002F3217; /* VO */ + acparm = 0x002F3217; /* VO */ rtl8723a_set_ac_param_vo(padapter, acparm); - acparm = 0x005E4317; /* VI */ + acparm = 0x005E4317; /* VI */ rtl8723a_set_ac_param_vi(padapter, acparm); acparm = 0x005ea42b; rtl8723a_set_ac_param_be(padapter, acparm); - acparm = 0x0000A444; /* BK */ + acparm = 0x0000A444; /* BK */ rtl8723a_set_ac_param_bk(padapter, acparm); /* Set Security */ @@ -722,8 +736,10 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf) switch (pht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: - /* pmlmeext->cur_ch_offset = - HAL_PRIME_CHNL_OFFSET_LOWER; */ + /* + * pmlmeext->cur_ch_offset = + * HAL_PRIME_CHNL_OFFSET_LOWER; + */ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; break; case IEEE80211_HT_PARAM_CHA_SEC_BELOW: @@ -735,7 +751,10 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf) } } } - /* TODO: need to judge the phy parameters on concurrent mode for single phy */ + /* + * TODO: need to judge the phy parameters + * on concurrent mode for single phy + */ set_channel_bwmode23a(padapter, cur_channel, cur_ch_offset, cur_bwmode); DBG_8723A("CH =%d, BW =%d, offset =%d\n", cur_channel, cur_bwmode, @@ -886,7 +905,7 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, &pairwise_cipher, NULL) == _SUCCESS) { psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; - psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */ + psecuritypriv->dot8021xalg = 1; /* psk, todo:802.1x */ psecuritypriv->wpa_psk |= BIT(1); psecuritypriv->wpa2_group_cipher = group_cipher; @@ -919,8 +938,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, break; } - if ((p == NULL) || (ie_len == 0)) - break; + if (!p || !ie_len) + break; } /* wmm */ @@ -934,7 +953,7 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, if ((p) && !memcmp(p+2, WMM_PARA_IE, 6)) { pmlmepriv->qos_option = 1; - *(p+8) |= BIT(7);/* QoS Info, support U-APSD */ + *(p + 8) |= BIT(7);/* QoS Info:support U-APSD */ /* disable all ACM bits since the WMM admission * control is not supported @@ -1135,11 +1154,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) return 0; } -static void update_bcn_fixed_ie(struct rtw_adapter *padapter) -{ - DBG_8723A("%s\n", __func__); -} - static void update_bcn_erpinfo_ie(struct rtw_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1173,21 +1187,6 @@ static void update_bcn_erpinfo_ie(struct rtw_adapter *padapter) } } -static void update_bcn_htcap_ie(struct rtw_adapter *padapter) -{ - DBG_8723A("%s\n", __func__); -} - -static void update_bcn_htinfo_ie(struct rtw_adapter *padapter) -{ - DBG_8723A("%s\n", __func__); -} - -static void update_bcn_rsn_ie(struct rtw_adapter *padapter) -{ - DBG_8723A("%s\n", __func__); -} - static void update_bcn_wpa_ie(struct rtw_adapter *padapter) { DBG_8723A("%s\n", __func__); @@ -1244,11 +1243,6 @@ void update_beacon23a(struct rtw_adapter *padapter, u8 ie_id, u8 *oui, u8 tx) spin_lock_bh(&pmlmepriv->bcn_update_lock); switch (ie_id) { - case 0xFF: - /* 8: TimeStamp, 2: Beacon Interval 2:Capability */ - update_bcn_fixed_ie(padapter); - break; - case WLAN_EID_TIM: update_BCNTIM(padapter); break; @@ -1257,18 +1251,6 @@ void update_beacon23a(struct rtw_adapter *padapter, u8 ie_id, u8 *oui, u8 tx) update_bcn_erpinfo_ie(padapter); break; - case WLAN_EID_HT_CAPABILITY: - update_bcn_htcap_ie(padapter); - break; - - case WLAN_EID_RSN: - update_bcn_rsn_ie(padapter); - break; - - case WLAN_EID_HT_OPERATION: - update_bcn_htinfo_ie(padapter); - break; - case WLAN_EID_VENDOR_SPECIFIC: update_bcn_vendor_spec_ie(padapter, oui); break; @@ -1286,16 +1268,16 @@ void update_beacon23a(struct rtw_adapter *padapter, u8 ie_id, u8 *oui, u8 tx) } /* -op_mode -Set to 0 (HT pure) under the following conditions - - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or - - all STAs in the BSS are 20 MHz HT in 20 MHz BSS -Set to 1 (HT non-member protection) if there may be non-HT STAs - in both the primary and the secondary channel -Set to 2 if only HT STAs are associated in BSS, - however and at least one 20 MHz HT STA is associated -Set to 3 (HT mixed mode) when one or more non-HT STAs are associated - (currently non-GF HT station is considered as non-HT STA also) + * op_mode + * Set to 0 (HT pure) under the following conditions + * - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or + * - all STAs in the BSS are 20 MHz HT in 20 MHz BSS + * Set to 1 (HT non-member protection) if there may be non-HT STAs + * in both the primary and the secondary channel + * Set to 2 if only HT STAs are associated in BSS, + * however and at least one 20 MHz HT STA is associated + * Set to 3 (HT mixed mode) when one or more non-HT STAs are associated + * (currently non-GF HT station is considered as non-HT STA also) */ static int rtw_ht_operation_update(struct rtw_adapter *padapter) { @@ -1338,7 +1320,8 @@ static int rtw_ht_operation_update(struct rtw_adapter *padapter) op_mode_changes++; } - /* Note: currently we switch to the MIXED op mode if HT non-greenfield + /* + * Note: currently we switch to the MIXED op mode if HT non-greenfield * station is associated. Probably it's a theoretical case, since * it looks like all known HT STAs support greenfield. */ @@ -1389,7 +1372,7 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated) } } -/* called > TSR LEVEL for USB or SDIO Interface*/ +/* called > TSR LEVEL for USB or SDIO Interface */ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info *psta) { u8 beacon_updated = false; @@ -1607,16 +1590,16 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti if (active) { /* tear down Rx AMPDU */ - send_delba23a(padapter, 0, psta->hwaddr);/* recipient */ + send_delba23a(padapter, 0, psta->hwaddr); /* recipient */ /* tear down TX AMPDU */ - send_delba23a(padapter, 1, psta->hwaddr);/* originator */ + send_delba23a(padapter, 1, psta->hwaddr); /* originator */ issue_deauth23a(padapter, psta->hwaddr, reason); } - psta->htpriv.agg_enable_bitmap = 0x0;/* reset */ - psta->htpriv.candidate_tid_bitmap = 0x0;/* reset */ + psta->htpriv.agg_enable_bitmap = 0x0; /* reset */ + psta->htpriv.candidate_tid_bitmap = 0x0; /* reset */ /* report_del_sta_event23a(padapter, psta->hwaddr, reason); */ @@ -1642,7 +1625,7 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti return beacon_updated; } -int rtw_ap_inform_ch_switch23a (struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset) +int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset) { struct list_head *phead, *plist; struct sta_info *psta = NULL; @@ -1663,12 +1646,12 @@ int rtw_ap_inform_ch_switch23a (struct rtw_adapter *padapter, u8 new_ch, u8 ch_o list_for_each(plist, phead) { psta = container_of(plist, struct sta_info, asoc_list); - issue_action_spct_ch_switch23a (padapter, psta->hwaddr, new_ch, ch_offset); + issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset); psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2); } spin_unlock_bh(&pstapriv->asoc_list_lock); - issue_action_spct_ch_switch23a (padapter, bc_addr, new_ch, ch_offset); + issue_action_spct_ch_switch23a(padapter, bc_addr, new_ch, ch_offset); return 0; } @@ -1717,7 +1700,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter) return 0; } -/* called > TSR LEVEL for USB or SDIO Interface*/ +/* called > TSR LEVEL for USB or SDIO Interface */ void sta_info_update23a(struct rtw_adapter *padapter, struct sta_info *psta) { int flags = psta->flags; @@ -1746,7 +1729,7 @@ void sta_info_update23a(struct rtw_adapter *padapter, struct sta_info *psta) update_sta_info23a_apmode23a(padapter, psta); } -/* called >= TSR LEVEL for USB or SDIO Interface*/ +/* called >= TSR LEVEL for USB or SDIO Interface */ void ap_sta_info_defer_update23a(struct rtw_adapter *padapter, struct sta_info *psta) { if (psta->state & _FW_LINKED) { @@ -1870,8 +1853,11 @@ void stop_ap_mode23a(struct rtw_adapter *padapter) pmlmepriv->update_bcn = false; pmlmeext->bstart_bss = false; - /* reset and init security priv , this can refine with rtw_reset_securitypriv23a */ - memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); + /* + * reset and init security priv , this can + * refine with rtw_reset_securitypriv23a + */ + memset((unsigned char *)&padapter->securitypriv, 0, sizeof(struct security_priv)); padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled; diff --git a/kernel/drivers/staging/rtl8723au/core/rtw_cmd.c b/kernel/drivers/staging/rtl8723au/core/rtw_cmd.c index 46aea16cb..3035bb864 100644 --- a/kernel/drivers/staging/rtl8723au/core/rtw_cmd.c +++ b/kernel/drivers/staging/rtl8723au/core/rtw_cmd.c @@ -236,7 +236,8 @@ int rtw_enqueue_cmd23a(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) res = queue_work(pcmdpriv->wq, &cmd_obj->work); if (!res) { - printk(KERN_ERR "%s: Call to queue_work() failed\n", __func__); + netdev_err(pcmdpriv->padapter->pnetdev, + "%s: Call to queue_work() failed\n", __func__); res = _FAIL; } else res = _SUCCESS; @@ -620,7 +621,7 @@ int rtw_disassoc_cmd23a(struct rtw_adapter *padapter, u32 deauth_timeout_ms, } else { /* no need to enqueue, do the cmd hdl directly and free cmd parameter */ - if (H2C_SUCCESS != disconnect_hdl23a(padapter, (u8 *)param)) + if (disconnect_hdl23a(padapter, (u8 *)param) != H2C_SUCCESS) res = _FAIL; kfree(param); } @@ -1342,6 +1343,7 @@ void rtw_createbss_cmd23a_callback(struct rtw_adapter *padapter, struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)pcmd->parmbuf; struct wlan_network *tgt_network = &pmlmepriv->cur_network; + struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue; if (pcmd->res != H2C_SUCCESS) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, @@ -1371,19 +1373,19 @@ void rtw_createbss_cmd23a_callback(struct rtw_adapter *padapter, spin_unlock_bh(&pmlmepriv->lock); } else { pwlan = rtw_alloc_network(pmlmepriv, GFP_KERNEL); - spin_lock_bh(&pmlmepriv->scanned_queue.lock); + spin_lock_bh(&scanned_queue->lock); if (!pwlan) { - pwlan = rtw_get_oldest_wlan_network23a(&pmlmepriv->scanned_queue); + pwlan = rtw_get_oldest_wlan_network23a(scanned_queue); if (!pwlan) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, "Error: can't get pwlan in rtw23a_joinbss_event_cb\n"); - spin_unlock_bh(&pmlmepriv->scanned_queue.lock); + spin_unlock_bh(&scanned_queue->lock); goto createbss_cmd_fail; } pwlan->last_scanned = jiffies; } else { list_add_tail(&pwlan->list, - &pmlmepriv->scanned_queue.queue); + &scanned_queue->queue); } pnetwork->Length = get_wlan_bssid_ex_sz(pnetwork); @@ -1402,9 +1404,9 @@ void rtw_createbss_cmd23a_callback(struct rtw_adapter *padapter, clr_fwstate(pmlmepriv, _FW_UNDER_LINKING); - spin_unlock_bh(&pmlmepriv->scanned_queue.lock); /* we will set _FW_LINKED when there is one more sat to join us (rtw_stassoc_event_callback23a) */ + spin_unlock_bh(&scanned_queue->lock); } createbss_cmd_fail: diff --git a/kernel/drivers/staging/rtl8723au/core/rtw_efuse.c b/kernel/drivers/staging/rtl8723au/core/rtw_efuse.c index 92a34db3b..906b5782d 100644 --- a/kernel/drivers/staging/rtl8723au/core/rtw_efuse.c +++ b/kernel/drivers/staging/rtl8723au/core/rtw_efuse.c @@ -21,34 +21,17 @@ #include <rtl8723a_hal.h> #include <usb_ops_linux.h> -/*------------------------Define local variable------------------------------*/ - -/* */ #define REG_EFUSE_CTRL 0x0030 -#define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control. */ -/* */ +#define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control */ #define VOLTAGE_V25 0x03 #define LDOE25_SHIFT 28 -/*----------------------------------------------------------------------------- - * Function: Efuse_PowerSwitch - * - * Overview: When we want to enable write operation, we should change to - * pwr on state. When we stop write, we should switch to 500k mode - * and disable LDO 2.5V. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/17/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ +/* + * When we want to enable write operation, we should change to + * pwr on state. When we stop write, we should switch to 500k mode + * and disable LDO 2.5V. + */ static void Efuse_PowerSwitch(struct rtw_adapter *padapter, u8 bWrite, u8 PwrState) { @@ -58,22 +41,26 @@ static void Efuse_PowerSwitch(struct rtw_adapter *padapter, if (PwrState == true) { rtl8723au_write8(padapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON); - /* 1.2V Power: From VDDON with Power - Cut(0x0000h[15]), default valid */ + /* + * 1.2V Power: From VDDON with Power + * Cut(0x0000h[15]), default valid + */ tmpV16 = rtl8723au_read16(padapter, REG_SYS_ISO_CTRL); if (!(tmpV16 & PWC_EV12V)) { tmpV16 |= PWC_EV12V; rtl8723au_write16(padapter, REG_SYS_ISO_CTRL, tmpV16); } - /* Reset: 0x0000h[28], default valid */ + /* Reset: 0x0000h[28], default valid */ tmpV16 = rtl8723au_read16(padapter, REG_SYS_FUNC_EN); if (!(tmpV16 & FEN_ELDR)) { tmpV16 |= FEN_ELDR; rtl8723au_write16(padapter, REG_SYS_FUNC_EN, tmpV16); } - /* Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock - from ANA, default valid */ + /* + * Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) + * clock from ANA, default valid + */ tmpV16 = rtl8723au_read16(padapter, REG_SYS_CLKR); if ((!(tmpV16 & LOADER_CLK_EN)) || (!(tmpV16 & ANA8M))) { tmpV16 |= (LOADER_CLK_EN | ANA8M); @@ -100,8 +87,7 @@ static void Efuse_PowerSwitch(struct rtw_adapter *padapter, } } -u16 -Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType) +u16 Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType) { u16 ret = 0; @@ -113,26 +99,19 @@ Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType) return ret; } -/* 11/16/2008 MH Add description. Get current efuse area enabled word!!. */ -u8 -Efuse_CalculateWordCnts23a(u8 word_en) +/* Get current efuse area enabled word */ +u8 Efuse_CalculateWordCnts23a(u8 word_en) { return hweight8((~word_en) & 0xf); } -/* */ -/* Description: */ -/* Execute E-Fuse read byte operation. */ -/* Referred from SD1 Richard. */ -/* */ -/* Assumption: */ -/* 1. Boot from E-Fuse and successfully auto-load. */ -/* 2. PASSIVE_LEVEL (USB interface) */ -/* */ -/* Created by Roger, 2008.10.21. */ -/* */ -void -ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf) +/* + * Description: Execute E-Fuse read byte operation. + * + * Assumptions: 1. Boot from E-Fuse and successfully auto-load. + * 2. PASSIVE_LEVEL (USB interface) + */ +void ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf) { u32 value32; u8 readbyte; @@ -156,19 +135,21 @@ ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf) retry++; } - /* 20100205 Joseph: Add delay suggested by SD1 Victor. */ - /* This fix the problem that Efuse read error in high temperature condition. */ - /* Designer says that there shall be some delay after ready bit is set, or the */ - /* result will always stay on last data we read. */ + /* + * Added suggested delay. This fixes the problem that + * Efuse read error in high temperature condition. + * Designer says that there shall be some delay after + * ready bit is set, or the result will always stay + * on last data we read. + */ udelay(50); value32 = rtl8723au_read32(Adapter, EFUSE_CTRL); *pbuf = (u8)(value32 & 0xff); } -void -EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, - u8 type, void *pOut) +void EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, + u8 type, void *pOut) { u8 *pu1Tmp; u16 *pu2Tmp; @@ -249,24 +230,8 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, } } -/*----------------------------------------------------------------------------- - * Function: EFUSE_Read1Byte23a - * - * Overview: Copy from WMAC fot EFUSE read 1 byte. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 09/23/2008 MHC Copy from WMAC. - * - *---------------------------------------------------------------------------*/ -u8 -EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address) +/* Copy from WMAC for EFUSE read 1 byte. */ +u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address) { u8 data; u8 Bytetemp = {0x00}; @@ -306,29 +271,10 @@ EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address) return data; } else return 0xFF; -}/* EFUSE_Read1Byte23a */ - -/*----------------------------------------------------------------------------- - * Function: EFUSE_Write1Byte - * - * Overview: Copy from WMAC fot EFUSE write 1 byte. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 09/23/2008 MHC Copy from WMAC. - * - *---------------------------------------------------------------------------*/ +} -void -EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value); -void -EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value) +/* Copy from WMAC fot EFUSE write 1 byte. */ +void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value) { u8 Bytetemp = {0x00}; u8 temp = {0x00}; @@ -367,24 +313,25 @@ EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value) } } } -}/* EFUSE_Write1Byte */ +} -/* 11/16/2008 MH Read one byte from real Efuse. */ -int -efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data) +/* Read one byte from real Efuse. */ +int efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data) { u8 tmpidx = 0; int bResult; - /* -----------------e-fuse reg ctrl --------------------------------- */ + /* -----------------e-fuse reg ctrl ---------------------------- */ /* address */ - rtl8723au_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff)); - rtl8723au_write8(pAdapter, EFUSE_CTRL+2, ((u8)((addr>>8) &0x03)) | - (rtl8723au_read8(pAdapter, EFUSE_CTRL+2)&0xFC)); + rtl8723au_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff)); + rtl8723au_write8(pAdapter, EFUSE_CTRL + 2, + ((u8)((addr >> 8) & 0x03)) | + (rtl8723au_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC)); - rtl8723au_write8(pAdapter, EFUSE_CTRL+3, 0x72);/* read cmd */ + rtl8723au_write8(pAdapter, EFUSE_CTRL + 3, 0x72); /* read cmd */ - while(!(0x80 &rtl8723au_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx<100)) + while (!(0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL + 3)) && + (tmpidx < 100)) tmpidx++; if (tmpidx < 100) { *data = rtl8723au_read8(pAdapter, EFUSE_CTRL); @@ -396,26 +343,26 @@ efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data) return bResult; } -/* 11/16/2008 MH Write one byte to reald Efuse. */ -int -efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data) +/* Write one byte to reald Efuse. */ +int efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data) { u8 tmpidx = 0; int bResult; /* return 0; */ - /* -----------------e-fuse reg ctrl --------------------------------- */ + /* -----------------e-fuse reg ctrl ------------------------- */ /* address */ - rtl8723au_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff)); - rtl8723au_write8(pAdapter, EFUSE_CTRL+2, - (rtl8723au_read8(pAdapter, EFUSE_CTRL+2)&0xFC)|(u8)((addr>>8)&0x03)); - rtl8723au_write8(pAdapter, EFUSE_CTRL, data);/* data */ + rtl8723au_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff)); + rtl8723au_write8(pAdapter, EFUSE_CTRL + 2, + (rtl8723au_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC) | + (u8)((addr >> 8) & 0x03)); + rtl8723au_write8(pAdapter, EFUSE_CTRL, data); /* data */ - rtl8723au_write8(pAdapter, EFUSE_CTRL+3, 0xF2);/* write cmd */ + rtl8723au_write8(pAdapter, EFUSE_CTRL + 3, 0xF2); /* write cmd */ - while((0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL+3)) && - (tmpidx<100)) { + while ((0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL + 3)) && + (tmpidx < 100)) { tmpidx++; } @@ -427,27 +374,8 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data) return bResult; } -/*----------------------------------------------------------------------------- - * Function: efuse_WordEnableDataRead23a - * - * Overview: Read allowed word in current efuse section data. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/16/2008 MHC Create Version 0. - * 11/21/2008 MHC Fix Write bug when we only enable late word. - * - *---------------------------------------------------------------------------*/ -void -efuse_WordEnableDataRead23a(u8 word_en, - u8 *sourdata, - u8 *targetdata) +/* Read allowed word in current efuse section data. */ +void efuse_WordEnableDataRead23a(u8 word_en, u8 *sourdata, u8 *targetdata) { if (!(word_en&BIT(0))) { targetdata[0] = sourdata[0]; @@ -477,15 +405,13 @@ static int efuse_write8(struct rtw_adapter *padapter, u16 address, u8 *value) return efuse_OneByteWrite23a(padapter, address, *value); } -/* - * read/write raw efuse data - */ +/* read/write raw efuse data */ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr, u16 cnts, u8 *data) { int i = 0; u16 real_content_len = 0, max_available_size = 0; - int res = _FAIL ; + int res = _FAIL; int (*rw8)(struct rtw_adapter *, u16, u8*); EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI, @@ -507,7 +433,7 @@ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr, Efuse_PowerSwitch(padapter, bWrite, true); - /* e-fuse one byte read / write */ + /* e-fuse one byte read/write */ for (i = 0; i < cnts; i++) { if (start_addr >= real_content_len) { res = _FAIL; @@ -523,16 +449,17 @@ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr, return res; } -/* */ + u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter) { u16 max_size; + EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_size); return max_size; } -/* */ + int rtw_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data) { @@ -573,26 +500,8 @@ int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter, return _SUCCESS; } -/*----------------------------------------------------------------------------- - * Function: Efuse_ReadAllMap - * - * Overview: Read All Efuse content - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/11/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -void -Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse); -void -Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse) +/* Read All Efuse content */ +void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse) { u16 mapLen = 0; @@ -606,45 +515,32 @@ Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse) Efuse_PowerSwitch(pAdapter, false, false); } -/*----------------------------------------------------------------------------- - * Function: efuse_ShadowRead1Byte - * efuse_ShadowRead2Byte - * efuse_ShadowRead4Byte - * - * Overview: Read from efuse init map by one/two/four bytes !!!!! - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/12/2008 MHC Create Version 0. +/* + * Functions: efuse_ShadowRead1Byte + * efuse_ShadowRead2Byte + * efuse_ShadowRead4Byte * - *---------------------------------------------------------------------------*/ -static void -efuse_ShadowRead1Byte(struct rtw_adapter *pAdapter, u16 Offset, u8 *Value) + * Read from efuse init map by one/two/four bytes + */ +static void efuse_ShadowRead1Byte(struct rtw_adapter *pAdapter, u16 Offset, + u8 *Value) { struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter); *Value = pEEPROM->efuse_eeprom_data[Offset]; -} /* EFUSE_ShadowRead23a1Byte */ +} -/* Read Two Bytes */ -static void -efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset, u16 *Value) +static void efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset, + u16 *Value) { struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter); *Value = pEEPROM->efuse_eeprom_data[Offset]; *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8; -} /* EFUSE_ShadowRead23a2Byte */ +} -/* Read Four Bytes */ -static void -efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, u32 *Value) +static void efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, + u32 *Value) { struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter); @@ -652,24 +548,9 @@ efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, u32 *Value) *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8; *Value |= pEEPROM->efuse_eeprom_data[Offset+2]<<16; *Value |= pEEPROM->efuse_eeprom_data[Offset+3]<<24; -} /* efuse_ShadowRead4Byte */ +} -/*----------------------------------------------------------------------------- - * Function: EFUSE_ShadowMapUpdate23a - * - * Overview: Transfer current EFUSE content to shadow init and modify map. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/13/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ +/* Transfer current EFUSE content to shadow init and modify map. */ void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType) { struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter); @@ -683,28 +564,11 @@ void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType) else Efuse_ReadAllMap(pAdapter, efuseType, pEEPROM->efuse_eeprom_data); +} -}/* EFUSE_ShadowMapUpdate23a */ - -/*----------------------------------------------------------------------------- - * Function: EFUSE_ShadowRead23a - * - * Overview: Read from efuse init map !!!!! - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 11/12/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -void -EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter, - u8 Type, u16 Offset, u32 *Value) +/* Read from efuse init map */ +void EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter, u8 Type, + u16 Offset, u32 *Value) { if (Type == 1) efuse_ShadowRead1Byte(pAdapter, Offset, (u8 *)Value); @@ -712,4 +576,4 @@ EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter, efuse_ShadowRead2Byte(pAdapter, Offset, (u16 *)Value); else if (Type == 4) efuse_ShadowRead4Byte(pAdapter, Offset, (u32 *)Value); -} /* EFUSE_ShadowRead23a */ +} diff --git a/kernel/drivers/staging/rtl8723au/core/rtw_ieee80211.c b/kernel/drivers/staging/rtl8723au/core/rtw_ieee80211.c index cdd7bc402..07a6490a8 100644 --- a/kernel/drivers/staging/rtl8723au/core/rtw_ieee80211.c +++ b/kernel/drivers/staging/rtl8723au/core/rtw_ieee80211.c @@ -348,9 +348,9 @@ int rtw_generate_ie23a(struct registry_priv *pregistrypriv) { u8 wireless_mode; int sz = 0, rateLen; - struct wlan_bssid_ex* pdev_network = &pregistrypriv->dev_network; - u8* ie = pdev_network->IEs; - u16 cap; + struct wlan_bssid_ex *pdev_network = &pregistrypriv->dev_network; + u8 *ie = pdev_network->IEs; + u16 cap; pdev_network->tsf = 0; @@ -444,7 +444,8 @@ static int rtw_get_wpa2_cipher_suite(const u8 *s) return 0; } -int rtw_parse_wpa_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher, int *is_8021x) +int rtw_parse_wpa_ie23a(const u8 *wpa_ie, int wpa_ie_len, int *group_cipher, + int *pairwise_cipher, int *is_8021x) { int i, ret = _SUCCESS; int left, count; diff --git a/kernel/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/kernel/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 196beafde..d28f29a93 100644 --- a/kernel/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/kernel/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -51,8 +51,7 @@ static void issue_probereq(struct rtw_adapter *padapter, static int issue_probereq_ex(struct rtw_adapter *padapter, struct cfg80211_ssid *pssid, u8 *da, int try_cnt, int wait_ms); -static void issue_probersp(struct rtw_adapter *padapter, unsigned char *da, - u8 is_valid_p2p_probereq); +static void issue_probersp(struct rtw_adapter *padapter, unsigned char *da); static void issue_auth(struct rtw_adapter *padapter, struct sta_info *psta, unsigned short status); static int issue_deauth_ex(struct rtw_adapter *padapter, u8 *da, @@ -760,7 +759,7 @@ OnProbeReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) if (check_fwstate(pmlmepriv, _FW_LINKED) && pmlmepriv->cur_network.join_res) - issue_probersp(padapter, mgmt->sa, false); + issue_probersp(padapter, mgmt->sa); out: return _SUCCESS; @@ -1716,9 +1715,8 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) spin_unlock_bh(&pstapriv->asoc_list_lock); /* now the station is qualified to join our BSS... */ - if (pstat && pstat->state & WIFI_FW_ASSOC_SUCCESS && + if (pstat->state & WIFI_FW_ASSOC_SUCCESS && status == WLAN_STATUS_SUCCESS) { -#ifdef CONFIG_8723AU_AP_MODE /* 1 bss_cap_update & sta_info_update23a */ bss_cap_update_on_sta_join23a(padapter, pstat); sta_info_update23a(padapter, pstat); @@ -1737,21 +1735,17 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) /* 3-(1) report sta add event */ report_add_sta_event23a(padapter, pstat->hwaddr, pstat->aid); -#endif } return _SUCCESS; asoc_class2_error: -#ifdef CONFIG_8723AU_AP_MODE issue_deauth23a(padapter, mgmt->sa, status); -#endif return _FAIL; OnAssocReq23aFail: -#ifdef CONFIG_8723AU_AP_MODE pstat->aid = 0; if (ieee80211_is_assoc_req(mgmt->frame_control)) issue_assocrsp(padapter, status, pstat, @@ -1759,7 +1753,6 @@ OnAssocReq23aFail: else issue_assocrsp(padapter, status, pstat, IEEE80211_STYPE_REASSOC_RESP); -#endif #endif /* CONFIG_8723AU_AP_MODE */ @@ -2503,8 +2496,7 @@ _issue_bcn: dump_mgntframe23a(padapter, pmgntframe); } -static void issue_probersp(struct rtw_adapter *padapter, unsigned char *da, - u8 is_valid_p2p_probereq) +static void issue_probersp(struct rtw_adapter *padapter, unsigned char *da) { struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; @@ -3803,8 +3795,6 @@ void issue_action_BA23a(struct rtw_adapter *padapter, pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr) + 1; - status = cpu_to_le16(status); - switch (action) { case WLAN_ACTION_ADDBA_REQ: pattrib->pktlen += sizeof(mgmt->u.action.u.addba_req); @@ -3908,8 +3898,8 @@ void issue_action_BA23a(struct rtw_adapter *padapter, put_unaligned_le16(BA_para_set, &mgmt->u.action.u.addba_resp.capab); - put_unaligned_le16(pmlmeinfo->ADDBA_req.BA_timeout_value, - &mgmt->u.action.u.addba_resp.timeout); + mgmt->u.action.u.addba_resp.timeout + = pmlmeinfo->ADDBA_req.BA_timeout_value; pattrib->pktlen += 8; break; @@ -5944,11 +5934,8 @@ int set_stakey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) macid = aid+1; */ cam_id = psta->mac_id + 3; - DBG_8723A("Write CAM, mac_addr =%x:%x:%x:%x:%x:%x, " - "cam_entry =%d\n", pparm->addr[0], - pparm->addr[1], pparm->addr[2], - pparm->addr[3], pparm->addr[4], - pparm->addr[5], cam_id); + DBG_8723A("Write CAM, mac_addr =%pM, " + "cam_entry =%d\n", pparm->addr, cam_id); rtl8723a_cam_write(padapter, cam_id, ctrl, pparm->addr, pparm->key); diff --git a/kernel/drivers/staging/rtl8723au/core/rtw_recv.c b/kernel/drivers/staging/rtl8723au/core/rtw_recv.c index 274a4b65c..404b61898 100644 --- a/kernel/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/kernel/drivers/staging/rtl8723au/core/rtw_recv.c @@ -626,7 +626,7 @@ void process23a_pwrbit_data(struct rtw_adapter *padapter, struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *psta = NULL; + struct sta_info *psta; psta = rtw_get_stainfo23a(pstapriv, pattrib->src); @@ -653,7 +653,7 @@ void process_wmmps_data(struct rtw_adapter *padapter, #ifdef CONFIG_8723AU_AP_MODE struct rx_pkt_attrib *pattrib = &precv_frame->attrib; struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *psta = NULL; + struct sta_info *psta; psta = rtw_get_stainfo23a(pstapriv, pattrib->src); @@ -1554,8 +1554,7 @@ static int wlanhdr_to_ethhdr (struct recv_frame *precvframe) ether_addr_copy(ptr + ETH_ALEN, pattrib->src); if (!bsnaphdr) { - len = htons(len); - memcpy(ptr + 12, &len, 2); + put_unaligned_be16(len, ptr + 12); } @@ -2152,7 +2151,7 @@ int process_recv_indicatepkts(struct rtw_adapter *padapter, static int recv_func_prehandle(struct rtw_adapter *padapter, struct recv_frame *rframe) { - int ret = _SUCCESS; + int ret; /* check the frame crtl field and decache */ ret = validate_recv_frame(padapter, rframe); diff --git a/kernel/drivers/staging/rtl8723au/core/rtw_security.c b/kernel/drivers/staging/rtl8723au/core/rtw_security.c index af53c92fc..038b57b3a 100644 --- a/kernel/drivers/staging/rtl8723au/core/rtw_security.c +++ b/kernel/drivers/staging/rtl8723au/core/rtw_security.c @@ -148,7 +148,7 @@ void rtw_wep_encrypt23a(struct rtw_adapter *padapter, struct xmit_frame *pxmitframe) { /* exclude ICV */ - unsigned char crc[4]; + __le32 crc; struct arc4context mycontext; int curfragnum, length, index; u32 keylength; @@ -186,18 +186,20 @@ void rtw_wep_encrypt23a(struct rtw_adapter *padapter, length = pattrib->last_txcmdsz - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); + crc = cpu_to_le32(getcrc32(payload, length)); arcfour_init(&mycontext, wepkey, 3 + keylength); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload + length, crc, 4); + arcfour_encrypt(&mycontext, payload + length, + (char *)&crc, 4); } else { length = pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); + crc = cpu_to_le32(getcrc32(payload, length)); arcfour_init(&mycontext, wepkey, 3 + keylength); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload + length, crc, 4); + arcfour_encrypt(&mycontext, payload + length, + (char *)&crc, 4); pframe += pxmitpriv->frag_len; pframe = PTR_ALIGN(pframe, 4); @@ -243,8 +245,8 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter, arcfour_encrypt(&mycontext, payload, payload, length); /* calculate icv and compare the icv */ - actual_crc = le32_to_cpu(getcrc32(payload, length - 4)); - expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4])); + actual_crc = getcrc32(payload, length - 4); + expected_crc = get_unaligned_le32(&payload[length - 4]); if (actual_crc != expected_crc) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, @@ -602,11 +604,10 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, u32 pnh; u8 rc4key[16]; u8 ttkey[16]; - u8 crc[4]; + __le32 crc; u8 hw_hdr_offset = 0; struct arc4context mycontext; int curfragnum, length; - u32 prwskeylen; u8 *pframe, *payload, *iv, *prwskey; union pn48 dot11txpn; struct sta_info *stainfo; @@ -653,8 +654,6 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, else prwskey = &stainfo->dot118021x_UncstKey.skey[0]; - prwskeylen = 16; - /* 4 start to encrypt each fragment */ for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) { iv = pframe + pattrib->hdrlen; @@ -679,11 +678,12 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, "pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len, pattrib->icv_len); - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); + crc = cpu_to_le32(getcrc32(payload, length)); arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload + length, crc, 4); + arcfour_encrypt(&mycontext, payload + length, + (char *)&crc, 4); } else { length = (pxmitpriv->frag_len - @@ -691,10 +691,11 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, pattrib->iv_len - pattrib->icv_len); - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); + crc = cpu_to_le32(getcrc32(payload, length)); arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload + length, crc, 4); + arcfour_encrypt(&mycontext, payload + length, + (char *)&crc, 4); pframe += pxmitpriv->frag_len; pframe = PTR_ALIGN(pframe, 4); @@ -715,7 +716,6 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, u32 actual_crc, expected_crc; struct arc4context mycontext; int length; - u32 prwskeylen; u8 *pframe, *payload, *iv, *prwskey; union pn48 dot11txpn; struct sta_info *stainfo; @@ -745,12 +745,10 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, goto exit; } prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey; - prwskeylen = 16; } else { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, "%s: stainfo!= NULL!!!\n", __func__); prwskey = &stainfo->dot118021x_UncstKey.skey[0]; - prwskeylen = 16; } iv = pframe + prxattrib->hdrlen; @@ -769,8 +767,8 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); - actual_crc = le32_to_cpu(getcrc32(payload, length - 4)); - expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4])); + actual_crc = getcrc32(payload, length - 4); + expected_crc = get_unaligned_le32(&payload[length - 4]); if (actual_crc != expected_crc) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, @@ -1284,7 +1282,6 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter, { /* exclude ICV */ /* Intermediate Buffers */ int curfragnum, length; - u32 prwskeylen; u8 *pframe, *prwskey; u8 hw_hdr_offset = 0; struct sta_info *stainfo; @@ -1331,8 +1328,6 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter, else prwskey = &stainfo->dot118021x_UncstKey.skey[0]; - prwskeylen = 16; - for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) { /* 4 the last fragment */ if ((curfragnum + 1) == pattrib->nr_frags) { diff --git a/kernel/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/kernel/drivers/staging/rtl8723au/core/rtw_wlan_util.c index 5280338aa..cc2b84be9 100644 --- a/kernel/drivers/staging/rtl8723au/core/rtw_wlan_util.c +++ b/kernel/drivers/staging/rtl8723au/core/rtw_wlan_util.c @@ -525,7 +525,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter) else aSifsTime = 16; - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { ACI = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 5) & 0x03; ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 4) & 0x01; @@ -573,7 +573,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter) inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3; if (pregpriv->wifi_spec == 1) { - u32 j, tmp, change_inx = false; + u32 j, change_inx = false; /* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */ for (i = 0; i < 4; i++) { @@ -589,14 +589,8 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter) } if (change_inx) { - tmp = edca[i]; - edca[i] = edca[j]; - edca[j] = tmp; - - tmp = inx[i]; - inx[i] = inx[j]; - inx[j] = tmp; - + swap(edca[i], edca[j]); + swap(inx[i], inx[j]); change_inx = false; } } @@ -1218,7 +1212,7 @@ unsigned int update_supported_rate23a(unsigned char *ptn, unsigned int ptn_sz) unsigned int update_MSC_rate23a(struct ieee80211_ht_cap *pHT_caps) { - unsigned int mask = 0; + unsigned int mask; mask = pHT_caps->mcs.rx_mask[0] << 12 | pHT_caps->mcs.rx_mask[1] << 20; diff --git a/kernel/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c b/kernel/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c index ae090ab11..0a3d96e84 100644 --- a/kernel/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c +++ b/kernel/drivers/staging/rtl8723au/hal/HalPwrSeqCmd.c @@ -92,7 +92,7 @@ u8 HalPwrSeqCmdParsing23a(struct rtw_adapter *padapter, u8 CutVersion, value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)); - /* Write the value back to sytem register */ + /* Write the value back to system register */ rtl8723au_write8(padapter, offset, value); break; diff --git a/kernel/drivers/staging/rtl8723au/hal/odm.c b/kernel/drivers/staging/rtl8723au/hal/odm.c index ec543cfe1..6b9dbeffa 100644 --- a/kernel/drivers/staging/rtl8723au/hal/odm.c +++ b/kernel/drivers/staging/rtl8723au/hal/odm.c @@ -40,7 +40,7 @@ static u32 EDCAParam[HT_IOT_PEER_MAX][3] = { /* UL DL */ {0x5ea42b, 0xa630, 0x5e431c}, /* 11:airgocap AP */ }; -/* EDCA Paramter for AP/ADSL by Mingzhi 2011-11-22 */ +/* EDCA Parameter for AP/ADSL by Mingzhi 2011-11-22 */ /* Global var */ u32 OFDMSwingTable23A[OFDM_TABLE_SIZE_92D] = { @@ -388,7 +388,7 @@ void odm_CommonInfoSelfInit23a(struct dm_odm_t *pDM_Odm) pDM_Odm->bCckHighPower = true; else pDM_Odm->bCckHighPower = false; - + pDM_Odm->RFPathRxEnable = rtl8723au_read32(pDM_Odm->Adapter, rOFDM0_TRxPathEnable) & 0x0F; @@ -985,7 +985,7 @@ void ODM_RF_Saving23a(struct dm_odm_t *pDM_Odm, u8 bForceInNormal) val32 = rtl8723au_read32(adapter, 0x874); val32 |= pDM_PSTable->Reg874; rtl8723au_write32(adapter, 0x874, val32); - + val32 = rtl8723au_read32(adapter, 0xc70); val32 |= pDM_PSTable->RegC70; rtl8723au_write32(adapter, 0xc70, val32); diff --git a/kernel/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c b/kernel/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c index 342dec3e9..a63c6cb88 100644 --- a/kernel/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c +++ b/kernel/drivers/staging/rtl8723au/hal/odm_RegConfig8723A.c @@ -21,7 +21,7 @@ odm_ConfigRFReg_8723A( struct dm_odm_t *pDM_Odm, u32 Addr, u32 Data, - enum RF_RADIO_PATH RF_PATH, + enum RF_RADIO_PATH RF_PATH, u32 RegAddr ) { diff --git a/kernel/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/kernel/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c index cf15f8083..d5c48a56d 100644 --- a/kernel/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c +++ b/kernel/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c @@ -72,7 +72,6 @@ if ((BTCoexDbgLevel == _bt_dbg_on_)) {\ #define DCMD_Printf(...) #define RT_ASSERT(...) -#define rsprintf snprintf #define GetDefaultAdapter(padapter) padapter @@ -1455,7 +1454,7 @@ bthci_StartBeaconAndConnect( } if (pBTInfo->BtAsocEntry[CurrentAssocNum].AMPRole == AMP_BTAP_CREATOR) { - rsprintf((char *)pBTInfo->BtAsocEntry[CurrentAssocNum].BTSsidBuf, 32, "AMP-%02x-%02x-%02x-%02x-%02x-%02x", + snprintf((char *)pBTInfo->BtAsocEntry[CurrentAssocNum].BTSsidBuf, 32, "AMP-%02x-%02x-%02x-%02x-%02x-%02x", padapter->eeprompriv.mac_addr[0], padapter->eeprompriv.mac_addr[1], padapter->eeprompriv.mac_addr[2], @@ -1463,7 +1462,7 @@ bthci_StartBeaconAndConnect( padapter->eeprompriv.mac_addr[4], padapter->eeprompriv.mac_addr[5]); } else if (pBTInfo->BtAsocEntry[CurrentAssocNum].AMPRole == AMP_BTAP_JOINER) { - rsprintf((char *)pBTInfo->BtAsocEntry[CurrentAssocNum].BTSsidBuf, 32, "AMP-%02x-%02x-%02x-%02x-%02x-%02x", + snprintf((char *)pBTInfo->BtAsocEntry[CurrentAssocNum].BTSsidBuf, 32, "AMP-%02x-%02x-%02x-%02x-%02x-%02x", pBTInfo->BtAsocEntry[CurrentAssocNum].BTRemoteMACAddr[0], pBTInfo->BtAsocEntry[CurrentAssocNum].BTRemoteMACAddr[1], pBTInfo->BtAsocEntry[CurrentAssocNum].BTRemoteMACAddr[2], @@ -5550,7 +5549,7 @@ static s8 btdm_1AntTdmaJudgement(struct rtw_adapter *padapter, u8 retry) { struct hal_data_8723a *pHalData; struct btdm_8723a_1ant *pBtdm8723; - static s8 up, dn, m = 1, n = 3, WaitCount; + static s8 up, dn, m = 1, WaitCount; s8 ret; pHalData = GET_HAL_DATA(padapter); @@ -5561,7 +5560,6 @@ static s8 btdm_1AntTdmaJudgement(struct rtw_adapter *padapter, u8 retry) up = 0; dn = 0; m = 1; - n = 3; WaitCount = 0; } else { WaitCount++; @@ -5576,8 +5574,6 @@ static s8 btdm_1AntTdmaJudgement(struct rtw_adapter *padapter, u8 retry) if (up >= 3*m) { /* retry = 0 in consecutive 3m*(2s), add WiFi duration */ ret = 1; - - n = 3; up = 0; dn = 0; WaitCount = 0; @@ -5648,7 +5644,7 @@ static void btdm_1AntTdmaDurationAdjustForACL(struct rtw_adapter *padapter) (pBtdm8723->curPsTdma != 11)) { btdm_1AntSetPSTDMA(padapter, true, 0, true, pBtdm8723->psTdmaDuAdjType); } else { - s32 judge = 0; + s32 judge; judge = btdm_1AntTdmaJudgement(padapter, pHalData->bt_coexist.halCoex8723.btRetryCnt); if (judge == -1) { @@ -9079,7 +9075,7 @@ static void btdm_BTCoexist8723AHandler(struct rtw_adapter *padapter) u32 BTDM_BtTxRxCounterH(struct rtw_adapter *padapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); - u32 counters = 0; + u32 counters; counters = pHalData->bt_coexist.halCoex8723.highPriorityTx+ pHalData->bt_coexist.halCoex8723.highPriorityRx; @@ -9089,7 +9085,7 @@ u32 BTDM_BtTxRxCounterH(struct rtw_adapter *padapter) u32 BTDM_BtTxRxCounterL(struct rtw_adapter *padapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); - u32 counters = 0; + u32 counters; counters = pHalData->bt_coexist.halCoex8723.lowPriorityTx+ pHalData->bt_coexist.halCoex8723.lowPriorityRx; @@ -9301,7 +9297,7 @@ static void BTDM_AdjustForBtOperation8723A(struct rtw_adapter *padapter) static void BTDM_FwC2hBtRssi8723A(struct rtw_adapter *padapter, u8 *tmpBuf) { struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); - u8 percent = 0, u1tmp = 0; + u8 percent, u1tmp; u1tmp = tmpBuf[0]; percent = u1tmp*2+10; @@ -9377,47 +9373,47 @@ static void BTDM_Display8723ABtCoexInfo(struct rtw_adapter *padapter) u32 u4Tmp[4]; u8 antNum = Ant_x2; - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); DCMD_Printf(btCoexDbgBuf); if (!rtl8723a_BT_coexist(padapter)) { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); DCMD_Printf(btCoexDbgBuf); return; } antNum = btdm_BtWifiAntNum(padapter); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/%d ", "Ant mechanism PG/Now run :", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/%d ", "Ant mechanism PG/Now run :", \ ((pHalData->bt_coexist.BT_Ant_Num == Ant_x2) ? 2 : 1), ((antNum == Ant_x2) ? 2 : 1)); DCMD_Printf(btCoexDbgBuf); if (pBtMgnt->ExtConfig.bManualControl) { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "[Action Manual control]!!"); + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "[Action Manual control]!!"); DCMD_Printf(btCoexDbgBuf); } else { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %d", "BT stack/ hci ext ver", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %d", "BT stack/ hci ext ver", \ ((pBtMgnt->bSupportProfile) ? "Yes" : "No"), pBtMgnt->ExtConfig.HCIExtensionVer); DCMD_Printf(btCoexDbgBuf); } - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\n %-35s = / %d", "Dot11 channel / BT channel", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\n %-35s = / %d", "Dot11 channel / BT channel", \ pBtMgnt->BTChannel); DCMD_Printf(btCoexDbgBuf); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\n %-35s = %d / %d / %d", "Wifi/BT/HS rssi", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\n %-35s = %d / %d / %d", "Wifi/BT/HS rssi", \ BTDM_GetRxSS(padapter), pHalData->bt_coexist.halCoex8723.btRssi, pHalData->dmpriv.EntryMinUndecoratedSmoothedPWDB); DCMD_Printf(btCoexDbgBuf); if (!pBtMgnt->ExtConfig.bManualControl) { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\n %-35s = %s / %s ", "WIfi status", + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\n %-35s = %s / %s ", "WIfi status", ((BTDM_Legacy(padapter)) ? "Legacy" : (((BTDM_IsHT40(padapter)) ? "HT40" : "HT20"))), ((!BTDM_IsWifiBusy(padapter)) ? "idle" : ((BTDM_IsWifiUplink(padapter)) ? "uplink" : "downlink"))); DCMD_Printf(btCoexDbgBuf); if (pBtMgnt->bSupportProfile) { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", ((BTHCI_CheckProfileExist(padapter, BT_PROFILE_SCO)) ? 1 : 0), ((BTHCI_CheckProfileExist(padapter, BT_PROFILE_HID)) ? 1 : 0), ((BTHCI_CheckProfileExist(padapter, BT_PROFILE_PAN)) ? 1 : 0), @@ -9426,19 +9422,19 @@ static void BTDM_Display8723ABtCoexInfo(struct rtw_adapter *padapter) for (i = 0; i < pBtMgnt->ExtConfig.NumberOfHandle; i++) { if (pBtMgnt->ExtConfig.HCIExtensionVer >= 1) { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/ %s/ %s", "Bt link type/spec/role", + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/ %s/ %s", "Bt link type/spec/role", BtProfileString[pBtMgnt->ExtConfig.linkInfo[i].BTProfile], BtSpecString[pBtMgnt->ExtConfig.linkInfo[i].BTCoreSpec], BtLinkRoleString[pBtMgnt->ExtConfig.linkInfo[i].linkRole]); DCMD_Printf(btCoexDbgBuf); btInfoExt = pHalData->bt_coexist.halCoex8723.btInfoExt; - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s", "A2DP rate", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s", "A2DP rate", \ (btInfoExt & BIT(0)) ? "Basic rate" : "EDR rate"); DCMD_Printf(btCoexDbgBuf); } else { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/ %s", "Bt link type/spec", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/ %s", "Bt link type/spec", \ BtProfileString[pBtMgnt->ExtConfig.linkInfo[i].BTProfile], BtSpecString[pBtMgnt->ExtConfig.linkInfo[i].BTCoreSpec]); DCMD_Printf(btCoexDbgBuf); @@ -9449,29 +9445,29 @@ static void BTDM_Display8723ABtCoexInfo(struct rtw_adapter *padapter) /* Sw mechanism */ if (!pBtMgnt->ExtConfig.bManualControl) { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Sw BT Coex mechanism]============"); + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Sw BT Coex mechanism]============"); DCMD_Printf(btCoexDbgBuf); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "AGC Table", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "AGC Table", \ pBtCoex->btdm2Ant.bCurAgcTableEn); DCMD_Printf(btCoexDbgBuf); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "ADC Backoff", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "ADC Backoff", \ pBtCoex->btdm2Ant.bCurAdcBackOff); DCMD_Printf(btCoexDbgBuf); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "Low penalty RA", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "Low penalty RA", \ pBtCoex->btdm2Ant.bCurLowPenaltyRa); DCMD_Printf(btCoexDbgBuf); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "RF Rx LPF Shrink", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "RF Rx LPF Shrink", \ pBtCoex->btdm2Ant.bCurRfRxLpfShrink); DCMD_Printf(btCoexDbgBuf); } u4Tmp[0] = PHY_QueryRFReg(padapter, PathA, 0x1e, 0xff0); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "RF-A, 0x1e[11:4]/original val", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "RF-A, 0x1e[11:4]/original val", \ u4Tmp[0], pHalData->bt_coexist.BtRfRegOrigin1E); DCMD_Printf(btCoexDbgBuf); /* Fw mechanism */ if (!pBtMgnt->ExtConfig.bManualControl) { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw BT Coex mechanism]============"); + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw BT Coex mechanism]============"); DCMD_Printf(btCoexDbgBuf); } if (!pBtMgnt->ExtConfig.bManualControl) { @@ -9479,57 +9475,57 @@ static void BTDM_Display8723ABtCoexInfo(struct rtw_adapter *padapter) psTdmaCase = pHalData->bt_coexist.halCoex8723.btdm1Ant.curPsTdma; else psTdmaCase = pHalData->bt_coexist.halCoex8723.btdm2Ant.curPsTdma; - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d", "PS TDMA(0x3a)", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d", "PS TDMA(0x3a)", \ pHalData->bt_coexist.fw3aVal[0], pHalData->bt_coexist.fw3aVal[1], pHalData->bt_coexist.fw3aVal[2], pHalData->bt_coexist.fw3aVal[3], pHalData->bt_coexist.fw3aVal[4], psTdmaCase); DCMD_Printf(btCoexDbgBuf); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "Decrease Bt Power", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "Decrease Bt Power", \ pBtCoex->btdm2Ant.bCurDecBtPwr); DCMD_Printf(btCoexDbgBuf); } u1Tmp = rtl8723au_read8(padapter, 0x778); u1Tmp1 = rtl8723au_read8(padapter, 0x783); u1Tmp2 = rtl8723au_read8(padapter, 0x796); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/ 0x783/ 0x796", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x778/ 0x783/ 0x796", \ u1Tmp, u1Tmp1, u1Tmp2); DCMD_Printf(btCoexDbgBuf); if (!pBtMgnt->ExtConfig.bManualControl) { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x / 0x%x", "Sw DacSwing Ctrl/Val", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x / 0x%x", "Sw DacSwing Ctrl/Val", \ pBtCoex->btdm2Ant.bCurDacSwingOn, pBtCoex->btdm2Ant.curDacSwingLvl); DCMD_Printf(btCoexDbgBuf); } u4Tmp[0] = rtl8723au_read32(padapter, 0x880); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x880", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x880", \ u4Tmp[0]); DCMD_Printf(btCoexDbgBuf); /* Hw mechanism */ if (!pBtMgnt->ExtConfig.bManualControl) { - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw BT Coex mechanism]============"); + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw BT Coex mechanism]============"); DCMD_Printf(btCoexDbgBuf); } u1Tmp = rtl8723au_read8(padapter, 0x40); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x40", \ u1Tmp); DCMD_Printf(btCoexDbgBuf); u4Tmp[0] = rtl8723au_read32(padapter, 0x550); u1Tmp = rtl8723au_read8(padapter, 0x522); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x", "0x550(bcn contrl)/0x522", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/0x%x", "0x550(bcn contrl)/0x522", \ u4Tmp[0], u1Tmp); DCMD_Printf(btCoexDbgBuf); u4Tmp[0] = rtl8723au_read32(padapter, 0x484); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x484(rate adaptive)", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x484(rate adaptive)", \ u4Tmp[0]); DCMD_Printf(btCoexDbgBuf); u4Tmp[0] = rtl8723au_read32(padapter, 0x50); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \ u4Tmp[0]); DCMD_Printf(btCoexDbgBuf); @@ -9537,7 +9533,7 @@ static void BTDM_Display8723ABtCoexInfo(struct rtw_adapter *padapter) u4Tmp[1] = rtl8723au_read32(padapter, 0xda4); u4Tmp[2] = rtl8723au_read32(padapter, 0xda8); u4Tmp[3] = rtl8723au_read32(padapter, 0xdac); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0xda0/0xda4/0xda8/0xdac(FA cnt)", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0xda0/0xda4/0xda8/0xdac(FA cnt)", \ u4Tmp[0], u4Tmp[1], u4Tmp[2], u4Tmp[3]); DCMD_Printf(btCoexDbgBuf); @@ -9545,27 +9541,27 @@ static void BTDM_Display8723ABtCoexInfo(struct rtw_adapter *padapter) u4Tmp[1] = rtl8723au_read32(padapter, 0x6c4); u4Tmp[2] = rtl8723au_read32(padapter, 0x6c8); u1Tmp = rtl8723au_read8(padapter, 0x6cc); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)", \ u4Tmp[0], u4Tmp[1], u4Tmp[2], u1Tmp); DCMD_Printf(btCoexDbgBuf); /* u4Tmp = rtl8723au_read32(padapter, 0x770); */ - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d", "0x770(Hi pri Rx[31:16]/Tx[15:0])", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d", "0x770(Hi pri Rx[31:16]/Tx[15:0])", \ pHalData->bt_coexist.halCoex8723.highPriorityRx, pHalData->bt_coexist.halCoex8723.highPriorityTx); DCMD_Printf(btCoexDbgBuf); /* u4Tmp = rtl8723au_read32(padapter, 0x774); */ - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d", "0x774(Lo pri Rx[31:16]/Tx[15:0])", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d", "0x774(Lo pri Rx[31:16]/Tx[15:0])", \ pHalData->bt_coexist.halCoex8723.lowPriorityRx, pHalData->bt_coexist.halCoex8723.lowPriorityTx); DCMD_Printf(btCoexDbgBuf); /* Tx mgnt queue hang or not, 0x41b should = 0xf, ex: 0xd ==>hang */ u1Tmp = rtl8723au_read8(padapter, 0x41b); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x41b (hang chk == 0xf)", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x41b (hang chk == 0xf)", \ u1Tmp); DCMD_Printf(btCoexDbgBuf); - rsprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "lastHMEBoxNum", \ + snprintf(btCoexDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "lastHMEBoxNum", \ pHalData->LastHMEBoxNum); DCMD_Printf(btCoexDbgBuf); } diff --git a/kernel/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c b/kernel/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c index 11e1108d0..1662c03c1 100644 --- a/kernel/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c +++ b/kernel/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c @@ -55,7 +55,7 @@ int FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, u8 h2c_box_num; u32 msgbox_addr; u32 msgbox_ex_addr; - struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); + struct hal_data_8723a *pHalData; u32 h2c_cmd = 0; u16 h2c_cmd_ex = 0; int ret = _FAIL; @@ -127,8 +127,7 @@ int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg) u8 buf[5]; memset(buf, 0, 5); - mask = cpu_to_le32(mask); - memcpy(buf, &mask, 4); + put_unaligned_le32(mask, buf); buf[4] = arg; FillH2CCmd(padapter, MACID_CONFIG_EID, 5, buf); diff --git a/kernel/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/kernel/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index 04d01833d..ecf54ee47 100644 --- a/kernel/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/kernel/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -249,13 +249,13 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter *padapter) goto Exit; } firmware_buf = kmemdup(fw->data, fw->size, GFP_KERNEL); + fw_size = fw->size; + release_firmware(fw); if (!firmware_buf) { rtStatus = _FAIL; goto Exit; } buf = firmware_buf; - fw_size = fw->size; - release_firmware(fw); /* To Check Fw header. Added by tynli. 2009.12.04. */ pFwHdr = (struct rt_8723a_firmware_hdr *)firmware_buf; @@ -1396,7 +1396,7 @@ static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM) /* value16 |= (APDM_HOST | FSM_HSUS |/PFM_ALDN); */ /* 2010/08/31 According to Filen description, we need to use HW to shut down 8051 automatically. */ - /* Becasue suspend operatione need the asistance of 8051 + /* Because suspend operation need the asistance of 8051 to wait for 3ms. */ value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN; } else { @@ -1485,7 +1485,7 @@ void Hal_EfuseParseIDCode(struct rtw_adapter *padapter, u8 *hwinfo) u16 EEPROMId; /* Checl 0x8129 again for making sure autoload status!! */ - EEPROMId = le16_to_cpu(*((u16 *) hwinfo)); + EEPROMId = le16_to_cpu(*((__le16 *) hwinfo)); if (EEPROMId != RTL_EEPROM_ID) { DBG_8723A("EEPROM ID(%#x) is invalid!!\n", EEPROMId); pEEPROM->bautoload_fail_flag = true; @@ -1497,29 +1497,6 @@ void Hal_EfuseParseIDCode(struct rtw_adapter *padapter, u8 *hwinfo) "EEPROM ID = 0x%04x\n", EEPROMId); } -static void Hal_EEValueCheck(u8 EEType, void *pInValue, void *pOutValue) -{ - switch (EEType) { - case EETYPE_TX_PWR: - { - u8 *pIn, *pOut; - pIn = (u8 *) pInValue; - pOut = (u8 *) pOutValue; - if (*pIn <= 63) - *pOut = *pIn; - else { - RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - "EETYPE_TX_PWR, value =%d is invalid, set to default = 0x%x\n", - *pIn, EEPROM_Default_TxPowerLevel); - *pOut = EEPROM_Default_TxPowerLevel; - } - } - break; - default: - break; - } -} - static void Hal_ReadPowerValueFromPROM_8723A(struct txpowerinfo *pwrInfo, u8 *PROMContent, bool AutoLoadFail) @@ -1555,16 +1532,19 @@ Hal_ReadPowerValueFromPROM_8723A(struct txpowerinfo *pwrInfo, for (group = 0; group < MAX_CHNL_GROUP; group++) { eeAddr = EEPROM_CCK_TX_PWR_INX_8723A + (rfPath * 3) + group; - /* pwrInfo->CCKIndex[rfPath][group] = - PROMContent[eeAddr]; */ - Hal_EEValueCheck(EETYPE_TX_PWR, &PROMContent[eeAddr], - &pwrInfo->CCKIndex[rfPath][group]); + + pwrInfo->CCKIndex[rfPath][group] = PROMContent[eeAddr]; + if (pwrInfo->CCKIndex[rfPath][group] > 63) + pwrInfo->CCKIndex[rfPath][group] = + EEPROM_Default_TxPowerLevel; + eeAddr = EEPROM_HT40_1S_TX_PWR_INX_8723A + (rfPath * 3) + group; - /* pwrInfo->HT40_1SIndex[rfPath][group] = - PROMContent[eeAddr]; */ - Hal_EEValueCheck(EETYPE_TX_PWR, &PROMContent[eeAddr], - &pwrInfo->HT40_1SIndex[rfPath][group]); + pwrInfo->HT40_1SIndex[rfPath][group] = + PROMContent[eeAddr]; + if (pwrInfo->HT40_1SIndex[rfPath][group] > 63) + pwrInfo->HT40_1SIndex[rfPath][group] = + EEPROM_Default_TxPowerLevel; } } @@ -1838,7 +1818,7 @@ Hal_EfuseParseThermalMeter_8723A(struct rtw_adapter *padapter, static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc) { - u16 *usPtr = (u16 *) ptxdesc; + __le16 *usPtr = (__le16 *)ptxdesc; u32 count = 16; /* (32 bytes / 2 bytes per XOR) => 16 times */ u32 index; u16 checksum = 0; @@ -1847,7 +1827,7 @@ static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc) ptxdesc->txdw7 &= cpu_to_le32(0xffff0000); for (index = 0; index < count; index++) - checksum ^= le16_to_cpu(*(usPtr + index)); + checksum ^= le16_to_cpu(usPtr[index]); ptxdesc->txdw7 |= cpu_to_le32(checksum & 0x0000ffff); } diff --git a/kernel/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c b/kernel/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c index 46a30659c..06a6c3eee 100644 --- a/kernel/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c +++ b/kernel/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c @@ -660,7 +660,7 @@ phy_BB8723a_Config_ParaFile(struct rtw_adapter *Adapter) /* */ /* 1. Read PHY_REG.TXT BB INIT!! */ - /* We will seperate as 88C / 92C according to chip version */ + /* We will separate as 88C / 92C according to chip version */ /* */ ODM_ReadAndConfig_PHY_REG_1T_8723A(&pHalData->odmpriv); @@ -748,36 +748,6 @@ PHY_BBConfig8723A(struct rtw_adapter *Adapter) return rtStatus; } -static void getTxPowerIndex(struct rtw_adapter *Adapter, - u8 channel, u8 *cckPowerLevel, u8 *ofdmPowerLevel) -{ - struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - u8 index = (channel - 1); - /* 1. CCK */ - cckPowerLevel[RF_PATH_A] = pHalData->TxPwrLevelCck[RF_PATH_A][index]; - cckPowerLevel[RF_PATH_B] = pHalData->TxPwrLevelCck[RF_PATH_B][index]; - - /* 2. OFDM for 1S or 2S */ - if (GET_RF_TYPE(Adapter) == RF_1T2R || GET_RF_TYPE(Adapter) == RF_1T1R) { - /* Read HT 40 OFDM TX power */ - ofdmPowerLevel[RF_PATH_A] = - pHalData->TxPwrLevelHT40_1S[RF_PATH_A][index]; - ofdmPowerLevel[RF_PATH_B] = - pHalData->TxPwrLevelHT40_1S[RF_PATH_B][index]; - } else if (GET_RF_TYPE(Adapter) == RF_2T2R) { - /* Read HT 40 OFDM TX power */ - ofdmPowerLevel[RF_PATH_A] = - pHalData->TxPwrLevelHT40_2S[RF_PATH_A][index]; - ofdmPowerLevel[RF_PATH_B] = - pHalData->TxPwrLevelHT40_2S[RF_PATH_B][index]; - } -} - -static void ccxPowerIndexCheck(struct rtw_adapter *Adapter, u8 channel, - u8 *cckPowerLevel, u8 *ofdmPowerLevel) -{ -} - /*----------------------------------------------------------------------------- * Function: SetTxPowerLevel8723A() * @@ -795,19 +765,30 @@ static void ccxPowerIndexCheck(struct rtw_adapter *Adapter, u8 channel, void PHY_SetTxPowerLevel8723A(struct rtw_adapter *Adapter, u8 channel) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - u8 cckPowerLevel[2], ofdmPowerLevel[2]; /* [0]:RF-A, [1]:RF-B */ + u8 cckpwr[2], ofdmpwr[2]; /* [0]:RF-A, [1]:RF-B */ + int i = channel - 1; if (pHalData->bTXPowerDataReadFromEEPORM == false) return; - getTxPowerIndex(Adapter, channel, &cckPowerLevel[0], - &ofdmPowerLevel[0]); + /* 1. CCK */ + cckpwr[RF_PATH_A] = pHalData->TxPwrLevelCck[RF_PATH_A][i]; + cckpwr[RF_PATH_B] = pHalData->TxPwrLevelCck[RF_PATH_B][i]; - ccxPowerIndexCheck(Adapter, channel, &cckPowerLevel[0], - &ofdmPowerLevel[0]); + /* 2. OFDM for 1S or 2S */ + if (GET_RF_TYPE(Adapter) == RF_1T2R || + GET_RF_TYPE(Adapter) == RF_1T1R) { + /* Read HT 40 OFDM TX power */ + ofdmpwr[RF_PATH_A] = pHalData->TxPwrLevelHT40_1S[RF_PATH_A][i]; + ofdmpwr[RF_PATH_B] = pHalData->TxPwrLevelHT40_1S[RF_PATH_B][i]; + } else if (GET_RF_TYPE(Adapter) == RF_2T2R) { + /* Read HT 40 OFDM TX power */ + ofdmpwr[RF_PATH_A] = pHalData->TxPwrLevelHT40_2S[RF_PATH_A][i]; + ofdmpwr[RF_PATH_B] = pHalData->TxPwrLevelHT40_2S[RF_PATH_B][i]; + } - rtl823a_phy_rf6052setccktxpower(Adapter, &cckPowerLevel[0]); - rtl8723a_PHY_RF6052SetOFDMTxPower(Adapter, &ofdmPowerLevel[0], channel); + rtl823a_phy_rf6052setccktxpower(Adapter, &cckpwr[0]); + rtl8723a_PHY_RF6052SetOFDMTxPower(Adapter, &ofdmpwr[0], channel); } /*----------------------------------------------------------------------------- diff --git a/kernel/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c b/kernel/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c index 3e3f18634..ce0d8d894 100644 --- a/kernel/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c +++ b/kernel/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c @@ -103,34 +103,24 @@ void rtl823a_phy_rf6052setccktxpower(struct rtw_adapter *Adapter, struct dm_priv *pdmpriv = &pHalData->dmpriv; struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; u32 TxAGC[2] = {0, 0}, tmpval = 0; - bool TurboScanOff = false; u8 idx1, idx2; u8 *ptr; - /* According to SD3 eechou's suggestion, we need to disable - turbo scan for RU. */ - /* Otherwise, external PA will be broken if power index > 0x20. */ - if (pHalData->EEPROMRegulatory != 0 || pHalData->ExternalPA) - TurboScanOff = true; - if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) { TxAGC[RF_PATH_A] = 0x3f3f3f3f; TxAGC[RF_PATH_B] = 0x3f3f3f3f; - TurboScanOff = true;/* disable turbo scan */ - - if (TurboScanOff) { - for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) { - TxAGC[idx1] = pPowerlevel[idx1] | - (pPowerlevel[idx1] << 8) | - (pPowerlevel[idx1] << 16) | - (pPowerlevel[idx1] << 24); - /* 2010/10/18 MH For external PA module. - We need to limit power index to be less - than 0x20. */ - if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA) - TxAGC[idx1] = 0x20; - } + for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) { + TxAGC[idx1] = pPowerlevel[idx1] | + (pPowerlevel[idx1] << 8) | + (pPowerlevel[idx1] << 16) | + (pPowerlevel[idx1] << 24); + /* + * 2010/10/18 MH For external PA module. We need + * to limit power index to be less than 0x20. + */ + if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA) + TxAGC[idx1] = 0x20; } } else { /* 20100427 Joseph: Driver dynamic Tx power shall not affect Tx @@ -138,7 +128,7 @@ void rtl823a_phy_rf6052setccktxpower(struct rtw_adapter *Adapter, /* Currently, we cannot fully disable driver dynamic tx power * mechanism because it is referenced by BT coexist mechanism. */ /* In the future, two mechanism shall be separated from each other - * and maintained independantly. Thanks for Lanhsin's reminder. */ + * and maintained independently. Thanks for Lanhsin's reminder. */ if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) { TxAGC[RF_PATH_A] = 0x10101010; TxAGC[RF_PATH_B] = 0x10101010; @@ -194,7 +184,7 @@ static void getPowerBase(struct rtw_adapter *Adapter, u8 *pPowerLevel, u8 Channel, u32 *OfdmBase, u32 *MCSBase) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - u32 powerBase0, powerBase1; + u32 ofdm, mcs; u8 Legacy_pwrdiff = 0; s8 HT20_pwrdiff = 0; u8 i, powerlevel[2]; @@ -202,11 +192,10 @@ static void getPowerBase(struct rtw_adapter *Adapter, u8 *pPowerLevel, for (i = 0; i < 2; i++) { powerlevel[i] = pPowerLevel[i]; Legacy_pwrdiff = pHalData->TxPwrLegacyHtDiff[i][Channel-1]; - powerBase0 = powerlevel[i] + Legacy_pwrdiff; + ofdm = powerlevel[i] + Legacy_pwrdiff; - powerBase0 = powerBase0 << 24 | powerBase0 << 16 | - powerBase0 << 8 | powerBase0; - *(OfdmBase + i) = powerBase0; + ofdm = ofdm << 24 | ofdm << 16 | ofdm << 8 | ofdm; + *(OfdmBase + i) = ofdm; } for (i = 0; i < 2; i++) { @@ -215,10 +204,9 @@ static void getPowerBase(struct rtw_adapter *Adapter, u8 *pPowerLevel, HT20_pwrdiff = pHalData->TxPwrHt20Diff[i][Channel-1]; powerlevel[i] += HT20_pwrdiff; } - powerBase1 = powerlevel[i]; - powerBase1 = powerBase1 << 24 | powerBase1 << 16 | - powerBase1 << 8 | powerBase1; - *(MCSBase + i) = powerBase1; + mcs = powerlevel[i]; + mcs = mcs << 24 | mcs << 16 | mcs << 8 | mcs; + *(MCSBase + i) = mcs; } } @@ -300,7 +288,7 @@ getTxPowerWriteValByRegulatory(struct rtw_adapter *Adapter, u8 Channel, /* Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. */ /* In the future, two mechanism shall be separated from each other and - maintained independantly. Thanks for Lanhsin's reminder. */ + maintained independently. Thanks for Lanhsin's reminder. */ if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) writeVal = 0x14141414; @@ -500,7 +488,6 @@ phy_RF6052_Config_ParaFile_Fail: int PHY_RF6052_Config8723A(struct rtw_adapter *Adapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - int rtStatus = _SUCCESS; /* Initialize general global value */ /* TODO: Extend RF_PATH_C and RF_PATH_D in the future */ @@ -510,8 +497,7 @@ int PHY_RF6052_Config8723A(struct rtw_adapter *Adapter) pHalData->NumTotalRFPath = 2; /* Config BB and RF */ - rtStatus = phy_RF6052_Config_ParaFile(Adapter); - return rtStatus; + return phy_RF6052_Config_ParaFile(Adapter); } /* End of HalRf6052.c */ diff --git a/kernel/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c b/kernel/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c index 6bf87fe86..14746dd8d 100644 --- a/kernel/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c +++ b/kernel/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c @@ -252,7 +252,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz) } /* (1) The sequence number of each non-Qos frame / broadcast / multicast / */ - /* mgnt frame should be controled by Hw because Fw will also send null data */ + /* mgnt frame should be controlled by Hw because Fw will also send null data */ /* which we cannot control when Fw LPS enable. */ /* --> default enable non-Qos data sequense number. 2010.06.23. by tynli. */ /* (2) Enable HW SEQ control for beacon packet, because we use Hw beacon. */ diff --git a/kernel/drivers/staging/rtl8723au/hal/usb_halinit.c b/kernel/drivers/staging/rtl8723au/hal/usb_halinit.c index 42ae29d26..9926b0790 100644 --- a/kernel/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/kernel/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -360,7 +360,7 @@ static void _InitWMACSetting(struct rtw_adapter *Adapter) /* 2010.09.08 hpfan */ /* Since ADF is removed from RCR, ps-poll will not be indicate to driver, */ - /* RxFilterMap should mask ps-poll to gurantee AP mode can + /* RxFilterMap should mask ps-poll to guarantee AP mode can rx ps-poll. */ /* value16 = 0x400; */ /* rtl8723au_write16(Adapter, REG_RXFLTMAP1, value16); */ @@ -834,12 +834,11 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, rtl8723au_read32(Adapter, rOFDM0_TRxPathEnable); Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF2] = rtl8723au_read32(Adapter, rFPGA0_RFMOD); - if (pHalData->rf_type == RF_2T2R) { + if (pHalData->rf_type == RF_2T2R) PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, 0x380038, 0); - } else if (pHalData->rf_type == RF_1T1R) { + else if (pHalData->rf_type == RF_1T1R) PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, 0x38, 0); - } PHY_SetBBReg(Adapter, rOFDM0_TRxPathEnable, 0xf0, 0); PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT(1), 1); diff --git a/kernel/drivers/staging/rtl8723au/include/odm_debug.h b/kernel/drivers/staging/rtl8723au/include/odm_debug.h index 83be5bab9..c4b375a6f 100644 --- a/kernel/drivers/staging/rtl8723au/include/odm_debug.h +++ b/kernel/drivers/staging/rtl8723au/include/odm_debug.h @@ -22,7 +22,7 @@ /* Define the debug levels */ /* */ /* 1. DBG_TRACE and DBG_LOUD are used for normal cases. */ -/* So that, they can help SW engineer to develope or trace states changed */ +/* So that, they can help SW engineer to develop or trace states changed */ /* and also help HW enginner to trace every operation to and from HW, */ /* e.g IO, Tx, Rx. */ /* */ diff --git a/kernel/drivers/staging/rtl8723au/include/rtl8723a_hal.h b/kernel/drivers/staging/rtl8723au/include/rtl8723a_hal.h index ad3a442bc..77a0fd485 100644 --- a/kernel/drivers/staging/rtl8723au/include/rtl8723a_hal.h +++ b/kernel/drivers/staging/rtl8723au/include/rtl8723a_hal.h @@ -80,12 +80,15 @@ struct rt_8723a_firmware_hdr { /* 8-byte alinment required */ /* LONG WORD 0 ---- */ - u16 Signature; /* 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut */ + __le16 Signature; /* + * 92C0: test chip; 92C, 88C0: test chip; + * 88C1: MP A-cut; 92C1: MP A-cut + */ u8 Category; /* AP/NIC and USB/PCI */ u8 Function; /* Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions */ - u16 Version; /* FW Version */ + __le16 Version; /* FW Version */ u8 Subversion; /* FW Subversion, default 0x00 */ - u16 Rsvd1; + u8 Rsvd1; /* LONG WORD 1 ---- */ @@ -93,16 +96,16 @@ struct rt_8723a_firmware_hdr { u8 Date; /* Release time Date field */ u8 Hour; /* Release time Hour field */ u8 Minute; /* Release time Minute field */ - u16 RamCodeSize; /* The size of RAM code */ - u16 Rsvd2; + __le16 RamCodeSize; /* The size of RAM code */ + __le16 Rsvd2; /* LONG WORD 2 ---- */ - u32 SvnIdx; /* The SVN entry index */ - u32 Rsvd3; + __le32 SvnIdx; /* The SVN entry index */ + __le32 Rsvd3; /* LONG WORD 3 ---- */ - u32 Rsvd4; - u32 Rsvd5; + __le32 Rsvd4; + __le32 Rsvd5; }; #define DRIVER_EARLY_INT_TIME 0x05 @@ -193,7 +196,7 @@ enum ChannelPlan /* | | Reserved(14bytes) | */ /* */ -/* PG data exclude header, dummy 6 bytes frome CP test and reserved 1byte. */ +/* PG data exclude header, dummy 6 bytes from CP test and reserved 1byte. */ #define EFUSE_OOB_PROTECT_BYTES 15 #define EFUSE_REAL_CONTENT_LEN_8723A 512 diff --git a/kernel/drivers/staging/rtl8723au/include/rtw_cmd.h b/kernel/drivers/staging/rtl8723au/include/rtw_cmd.h index 775dcdc1e..d1fa95d28 100644 --- a/kernel/drivers/staging/rtl8723au/include/rtw_cmd.h +++ b/kernel/drivers/staging/rtl8723au/include/rtw_cmd.h @@ -657,7 +657,7 @@ struct TDLSoption_param { Result: 0x00: success -0x01: sucess, and check Response. +0x01: success, and check Response. 0x02: cmd ignored due to duplicated sequcne number 0x03: cmd dropped due to invalid cmd code 0x04: reserved. @@ -725,11 +725,9 @@ void rtw_disassoc_cmd23a_callback(struct rtw_adapter *padapter, struct cmd_obj void rtw_joinbss_cmd23a_callback(struct rtw_adapter *padapter, struct cmd_obj *pcmd); void rtw_createbss_cmd23a_callback(struct rtw_adapter *padapter, struct cmd_obj *pcmd); void rtw_getbbrfreg_cmdrsp_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd); -void rtw_readtssi_cmdrsp_callback(struct rtw_adapter* padapter, struct cmd_obj *pcmd); void rtw_setstaKey_cmdrsp_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd); void rtw_setassocsta_cmdrsp_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd); -void rtw_getrttbl_cmdrsp_callback(struct rtw_adapter *padapter, struct cmd_obj *pcmd); struct _cmd_callback { u32 cmd_code; diff --git a/kernel/drivers/staging/rtl8723au/include/rtw_mlme.h b/kernel/drivers/staging/rtl8723au/include/rtw_mlme.h index a6751f138..dbd3a5f5c 100644 --- a/kernel/drivers/staging/rtl8723au/include/rtw_mlme.h +++ b/kernel/drivers/staging/rtl8723au/include/rtw_mlme.h @@ -50,11 +50,11 @@ #define WIFI_SITE_MONITOR 0x00000800 #define WIFI_MP_STATE 0x00010000 -#define WIFI_MP_CTX_BACKGROUND 0x00020000 /* in continous tx background */ -#define WIFI_MP_CTX_ST 0x00040000 /* in continous tx with single-tone */ -#define WIFI_MP_CTX_BACKGROUND_PENDING 0x00080000 /* pending in continous tx background due to out of skb */ -#define WIFI_MP_CTX_CCK_HW 0x00100000 /* in continous tx */ -#define WIFI_MP_CTX_CCK_CS 0x00200000 /* in continous tx with carrier suppression */ +#define WIFI_MP_CTX_BACKGROUND 0x00020000 /* in continuous tx background */ +#define WIFI_MP_CTX_ST 0x00040000 /* in continuous tx with single-tone */ +#define WIFI_MP_CTX_BACKGROUND_PENDING 0x00080000 /* pending in continuous tx background due to out of skb */ +#define WIFI_MP_CTX_CCK_HW 0x00100000 /* in continuous tx */ +#define WIFI_MP_CTX_CCK_CS 0x00200000 /* in continuous tx with carrier suppression */ #define WIFI_MP_LPBK_STATE 0x00400000 #define _FW_UNDER_LINKING WIFI_UNDER_LINKING diff --git a/kernel/drivers/staging/rtl8723au/include/rtw_mlme_ext.h b/kernel/drivers/staging/rtl8723au/include/rtw_mlme_ext.h index ffb37b252..ea2a6c914 100644 --- a/kernel/drivers/staging/rtl8723au/include/rtw_mlme_ext.h +++ b/kernel/drivers/staging/rtl8723au/include/rtw_mlme_ext.h @@ -103,7 +103,7 @@ extern unsigned char WMM_PARA_OUI23A[]; /* Note: */ /* We just add new channel plan when the new channel plan is different from any of the following */ /* channel plan. */ -/* If you just wnat to customize the acitions(scan period or join actions) about one of the channel plan, */ +/* If you just want to customize the actions(scan period or join actions) about one of the channel plan, */ /* customize them in struct rt_channel_info in the RT_CHANNEL_LIST. */ /* */ enum { /* _RT_CHANNEL_DOMAIN */ diff --git a/kernel/drivers/staging/rtl8723au/include/sta_info.h b/kernel/drivers/staging/rtl8723au/include/sta_info.h index c756b4f7f..e7260050e 100644 --- a/kernel/drivers/staging/rtl8723au/include/sta_info.h +++ b/kernel/drivers/staging/rtl8723au/include/sta_info.h @@ -332,7 +332,7 @@ struct sta_priv { */ struct sta_info *sta_aid[NUM_STA]; - u16 sta_dz_bitmap;/* only support 15 stations, staion aid bitmap + u16 sta_dz_bitmap;/* only support 15 stations, station aid bitmap * for sleeping sta. */ u16 tim_bitmap;/* only support 15 stations, * aid=0~15 mapping bit0~bit15 */ diff --git a/kernel/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/kernel/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index bc95ce89a..0ae2180a3 100644 --- a/kernel/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/kernel/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -379,7 +379,7 @@ void rtw_cfg80211_indicate_disconnect(struct rtw_adapter *padapter) GFP_ATOMIC); } else { cfg80211_disconnected(padapter->pnetdev, 0, NULL, - 0, GFP_ATOMIC); + 0, false, GFP_ATOMIC); } } } @@ -1041,7 +1041,7 @@ static u16 rtw_get_cur_max_rate(struct rtw_adapter *adapter) while (pcur_bss->SupportedRates[i] != 0 && pcur_bss->SupportedRates[i] != 0xFF) { rate = pcur_bss->SupportedRates[i] & 0x7F; - if (rate>max_rate) + if (rate > max_rate) max_rate = rate; i++; } diff --git a/kernel/drivers/staging/rtl8723au/os_dep/os_intfs.c b/kernel/drivers/staging/rtl8723au/os_dep/os_intfs.c index 83696360c..b8848c25b 100644 --- a/kernel/drivers/staging/rtl8723au/os_dep/os_intfs.c +++ b/kernel/drivers/staging/rtl8723au/os_dep/os_intfs.c @@ -172,7 +172,7 @@ MODULE_PARM_DESC(debug, "Set debug level (1-9) (default 1)"); static int netdev_close(struct net_device *pnetdev); -static int loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev) +static void loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev) { struct registry_priv *registry_par = &padapter->registrypriv; @@ -233,7 +233,6 @@ static int loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev) snprintf(registry_par->if2name, 16, "%s", if2name); registry_par->notch_filter = (u8)rtw_notch_filter; registry_par->regulatory_tid = (u8)rtw_regulatory_id; - return _SUCCESS; } static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p) @@ -372,7 +371,6 @@ struct net_device *rtw_init_netdev23a(struct rtw_adapter *old_padapter) pnetdev->watchdog_timeo = HZ*3; /* 3 second timeout */ - /* step 2. */ loadparam(padapter, pnetdev); return pnetdev; } |