From 5faae4ff49c825a868a100c42c2df3597e510e5f Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 25 Aug 2018 20:29:23 +0200 Subject: [PATCH 1/2] Fixed unreachable switches and other compile warnings --- core/rtw_mlme_ext.c | 11 +++--- core/rtw_recv.c | 3 +- core/rtw_wlan_util.c | 6 +-- core/rtw_xmit.c | 4 +- dkms.conf | 2 +- hal/hal_intf.c | 2 +- hal/hal_mp.c | 2 +- hal/phydm/halrf/halphyrf_ce.c | 3 +- hal/phydm/halrf/halrf.c | 13 +++---- hal/phydm/halrf/halrf_kfree.c | 29 +++++++------- hal/phydm/halrf/rtl8812a/halrf_8812a_ce.c | 3 +- hal/phydm/halrf/rtl8821a/halrf_iqk_8821a_ce.c | 6 ++- hal/phydm/phydm_adc_sampling.c | 5 ++- hal/phydm/phydm_beamforming.c | 12 +++--- hal/phydm/phydm_debug.c | 14 ++++--- hal/phydm/txbf/halcomtxbf.c | 39 +++++++++++-------- hal/phydm/txbf/haltxbfjaguar.c | 3 +- os_dep/linux/ioctl_cfg80211.c | 2 + os_dep/linux/recv_linux.c | 5 ++- 19 files changed, 93 insertions(+), 71 deletions(-) diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 3bcb3fa..028d39a 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -1826,7 +1826,7 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame) ptable->func = &OnAuth; else ptable->func = &OnAuthClient; - /* pass through */ + /* intentional fallthrough */ case WIFI_ASSOCREQ: case WIFI_REASSOCREQ: _mgt_dispatcher(padapter, ptable, precv_frame); @@ -2657,14 +2657,15 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame) if (rtw_is_list_empty(&pstat->asoc_list) == _FALSE) { rtw_list_delete(&pstat->asoc_list); pstapriv->asoc_list_cnt--; - if (pstat->expire_to > 0) + if (pstat->expire_to > 0) { ;/* TODO: STA re_auth within expire_to */ + } } _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - if (seq == 1) - ; /* TODO: STA re_auth and auth timeout */ - + if (seq == 1) { + ;/* TODO: STA re_auth and auth timeout */ + } } } diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 4da9bc4..dc2e856 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -2367,8 +2367,9 @@ sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame) dump_rx_packet(ptr); } #endif - } else + } else { DBG_COUNTER(adapter->rx_logs.core_rx_pre_data_handled); + } break; default: DBG_COUNTER(adapter->rx_logs.core_rx_pre_unknown); diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 45c273b..26f75a9 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -2256,9 +2256,9 @@ int rtw_get_bcn_keys(ADAPTER *Adapter, u8 *pframe, u32 packet_len, _rtw_memcpy(recv_beacon->ssid, elems.ssid, elems.ssid_len); recv_beacon->ssid_len = elems.ssid_len; - } else - ; /* means hidden ssid */ - + } else { + ;/* means hidden ssid */ + } /* checking RSN first */ if (elems.rsn_ie && elems.rsn_ie_len) { recv_beacon->encryp_protocol = ENCRYP_PROTOCOL_WPA2; diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index b480319..2825865 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -1333,9 +1333,9 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr _rtw_memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); _rtw_memcpy(pattrib->ta, get_bssid(pmlmepriv), ETH_ALEN); DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_ap); - } else + } else { DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_unknown); - + } get_sta_info: bmcast = IS_MCAST(pattrib->ra); if (bmcast) { diff --git a/dkms.conf b/dkms.conf index 5c3322b..c23a887 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="realtek-rtl88xxau" -PACKAGE_VERSION="5.2.20.2~20180812" +PACKAGE_VERSION="5.2.20.2~20180825" CLEAN="'make' clean" BUILT_MODULE_NAME[0]=88XXau PROCS_NUM=`nproc` diff --git a/hal/hal_intf.c b/hal/hal_intf.c index 351e923..189dfee 100644 --- a/hal/hal_intf.c +++ b/hal/hal_intf.c @@ -941,7 +941,7 @@ s32 c2h_handler(_adapter *adapter, u8 id, u8 seq, u8 plen, u8 *payload) #endif case C2H_EXTEND: sub_id = payload[0]; - /* no handle, goto default */ + /* intentional fallthrough */ default: if (phydm_c2H_content_parsing(adapter_to_phydm(adapter), id, plen, payload) != TRUE) diff --git a/hal/hal_mp.c b/hal/hal_mp.c index 8616dcb..bf74a7a 100644 --- a/hal/hal_mp.c +++ b/hal/hal_mp.c @@ -960,6 +960,7 @@ void mpt_SetRFPath_8812A(PADAPTER pAdapter) u8 bandwidth = pmp->bandwidth; u8 eLNA_2g = pHalData->ExternalLNA_2G; u32 ulAntennaTx, ulAntennaRx; + u32 reg0xC50 = 0; ulAntennaTx = pHalData->antenna_tx_path; ulAntennaRx = pHalData->AntennaRxPath; @@ -990,7 +991,6 @@ void mpt_SetRFPath_8812A(PADAPTER pAdapter) } switch (ulAntennaRx) { - u32 reg0xC50 = 0; case ANTENNA_A: phy_set_bb_reg(pAdapter, rRxPath_Jaguar, bMaskByte0, 0x11); phy_set_rf_reg(pAdapter, RF_PATH_B, RF_AC_Jaguar, 0xF0000, 0x1); /*/ RF_B_0x0[19:16] = 1, Standby mode*/ diff --git a/hal/phydm/halrf/halphyrf_ce.c b/hal/phydm/halrf/halphyrf_ce.c index 847a685..826aa84 100644 --- a/hal/phydm/halrf/halphyrf_ce.c +++ b/hal/phydm/halrf/halphyrf_ce.c @@ -310,8 +310,9 @@ odm_txpowertracking_callback_thermal_meter( /*4 3. Initialize ThermalValues of rf_calibrate_info*/ - if (cali_info->is_reloadtxpowerindex) + if (cali_info->is_reloadtxpowerindex) { PHYDM_DBG(dm, ODM_COMP_TX_PWR_TRACK, "reload ofdm index for band switch\n"); + } /*4 4. Calculate average thermal meter*/ diff --git a/hal/phydm/halrf/halrf.c b/hal/phydm/halrf/halrf.c index 82ddf83..1f16b9a 100644 --- a/hal/phydm/halrf/halrf.c +++ b/hal/phydm/halrf/halrf.c @@ -854,16 +854,14 @@ halrf_segment_iqk_trigger( odm_acquire_spin_lock(dm, RT_IQK_SPINLOCK); dm->rf_calibrate_info.is_iqk_in_progress = false; odm_release_spin_lock(dm, RT_IQK_SPINLOCK); - } else + } else { PHYDM_DBG(dm, ODM_COMP_CALIBRATION, "== Return the IQK CMD, because RFKs in Progress ==\n"); + } } - - #endif - u8 halrf_match_iqk_version(void *dm_void) { struct dm_struct *dm = (struct dm_struct *)dm_void; @@ -1422,12 +1420,12 @@ halrf_iqk_trigger( odm_acquire_spin_lock(dm, RT_IQK_SPINLOCK); dm->rf_calibrate_info.is_iqk_in_progress = false; odm_release_spin_lock(dm, RT_IQK_SPINLOCK); - } else + } else { PHYDM_DBG(dm, ODM_COMP_CALIBRATION, "== Return the IQK CMD, because RFKs in Progress ==\n"); + } } - void halrf_lck_trigger( void *dm_void @@ -1548,8 +1546,9 @@ halrf_lck_trigger( odm_acquire_spin_lock(dm, RT_IQK_SPINLOCK); dm->rf_calibrate_info.is_lck_in_progress = false; odm_release_spin_lock(dm, RT_IQK_SPINLOCK); - }else + } else { PHYDM_DBG(dm, ODM_COMP_CALIBRATION, "== Return the LCK CMD, because RFK is in Progress ==\n"); + } } void diff --git a/hal/phydm/halrf/halrf_kfree.c b/hal/phydm/halrf/halrf_kfree.c index d48223d..1151d68 100644 --- a/hal/phydm/halrf/halrf_kfree.c +++ b/hal/phydm/halrf/halrf_kfree.c @@ -118,9 +118,9 @@ phydm_set_kfree_to_rf_8814a( /*that means Kfree offset is negative, we need to record it.*/ cali_info->kfree_offset[e_rf_path] = (-1) * cali_info->kfree_offset[e_rf_path]; PHYDM_DBG(dm, ODM_COMP_MP, "phy_ConfigKFree8814A(): kfree_offset = %d\n", cali_info->kfree_offset[e_rf_path]); - } else + } else { PHYDM_DBG(dm, ODM_COMP_MP, "phy_ConfigKFree8814A(): kfree_offset = %d\n", cali_info->kfree_offset[e_rf_path]); - + } } @@ -152,8 +152,9 @@ phydm_get_thermal_trim_offset_8821c( PHYDM_DBG(dm, ODM_COMP_MP, "[kfree] 8821c thermal trim flag:0x%02x\n", power_trim_info->flag); - if (power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) + if (power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) { PHYDM_DBG(dm, ODM_COMP_MP, "[kfree] 8821c thermal:%d\n", power_trim_info->thermal); + } } @@ -308,8 +309,9 @@ phydm_get_thermal_trim_offset_8822b( PHYDM_DBG(dm, ODM_COMP_MP, "[kfree] 8822b thermal trim flag:0x%02x\n", power_trim_info->flag); - if (power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) + if (power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) { PHYDM_DBG(dm, ODM_COMP_MP, "[kfree] 8822b thermal:%d\n", power_trim_info->thermal); + } #if 0 } else return; @@ -503,9 +505,9 @@ phydm_get_pa_bias_offset_8822b( phydm_set_pa_bias_to_rf_8822b(dm, e_rf_path, tx_pa_bias[e_rf_path]); power_trim_info->pa_bias_flag |= PA_BIAS_FLAG_ON; - } - else + } else { PHYDM_DBG(dm, ODM_COMP_MP, "[kfree] 8822b 2g tx pa bias no pg\n"); + } } @@ -579,19 +581,20 @@ void *dm_void) if (pg_therm != 0xff) { pg_therm = pg_therm & 0x1f; - if ((pg_therm & BIT(0)) == 0) + if ((pg_therm & BIT(0)) == 0) { power_trim_info->thermal = (-1 * (pg_therm >> 1)); - else + } else { power_trim_info->thermal = (pg_therm >> 1); power_trim_info->flag |= KFREE_FLAG_THERMAL_K_ON; + } } ODM_RT_TRACE(dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b thermal trim flag:0x%02x\n", power_trim_info->flag)); - if (power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) + if (power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON) { ODM_RT_TRACE(dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b thermal:%d\n", power_trim_info->thermal)); - + } } void @@ -619,10 +622,10 @@ phydm_get_power_trim_offset_8710b( ODM_RT_TRACE(dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b power trim flag:0x%02x\n", power_trim_info->flag)); - if (power_trim_info->flag & KFREE_FLAG_ON) - - ODM_RT_TRACE(dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b power_trim_data->bb_gain[0][0]=0x%X\n", power_trim_info->bb_gain[0][0])); + if (power_trim_info->flag & KFREE_FLAG_ON) { + ODM_RT_TRACE(dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b power_trim_data->bb_gain[0][0]=0x%X\n", power_trim_info->bb_gain[0][0])); + } } void phydm_set_kfree_to_rf_8710b( diff --git a/hal/phydm/halrf/rtl8812a/halrf_8812a_ce.c b/hal/phydm/halrf/rtl8812a/halrf_8812a_ce.c index 707dc6a..7a9afa2 100644 --- a/hal/phydm/halrf/rtl8812a/halrf_8812a_ce.c +++ b/hal/phydm/halrf/rtl8812a/halrf_8812a_ce.c @@ -1353,8 +1353,9 @@ phy_iq_calibrate_8812a( if (dm->fw_offload_ability & PHYDM_RF_IQK_OFFLOAD) { _phy_iq_calibrate_by_fw_8812a(dm); phydm_iqk_wait(dm, 500); - if (dm->rf_calibrate_info.is_iqk_in_progress) + if (dm->rf_calibrate_info.is_iqk_in_progress) { PHYDM_DBG(dm, ODM_COMP_CALIBRATION, "== FW IQK TIMEOUT (Still in progress after 500ms) ==\n"); + } } else _phy_iq_calibrate_8812a(dm, *dm->channel); } diff --git a/hal/phydm/halrf/rtl8821a/halrf_iqk_8821a_ce.c b/hal/phydm/halrf/rtl8821a/halrf_iqk_8821a_ce.c index 661fa2e..2806fda 100644 --- a/hal/phydm/halrf/rtl8821a/halrf_iqk_8821a_ce.c +++ b/hal/phydm/halrf/rtl8821a/halrf_iqk_8821a_ce.c @@ -622,8 +622,9 @@ void _iqk_tx_8821a( for (i = 0; i < rx_average; i++) { PHYDM_DBG(dm, ODM_COMP_CALIBRATION, "RX_X0[0][%d] = %x ;; RX_Y0[0][%d] = %x\n", i, (RX_X0[0][i]) >> 21 & 0x000007ff, i, (RX_Y0[0][i]) >> 21 & 0x000007ff); - if (rx_iqk_loop == 2) + if (rx_iqk_loop == 2) { PHYDM_DBG(dm, ODM_COMP_CALIBRATION, "RX_X0[1][%d] = %x ;; RX_Y0[1][%d] = %x\n", i, (RX_X0[1][i]) >> 21 & 0x000007ff, i, (RX_Y0[1][i]) >> 21 & 0x000007ff); + } } for (i = 0; i < rx_average; i++) { for (ii = i + 1; ii < rx_average; ii++) { @@ -763,8 +764,9 @@ phy_iq_calibrate_8821a( if ((dm->fw_offload_ability & PHYDM_RF_IQK_OFFLOAD) && !(*(dm->mp_mode))) { _phy_iq_calibrate_by_fw_8821a(dm); phydm_iqk_wait(dm, 500); - if (dm->rf_calibrate_info.is_iqk_in_progress) + if (dm->rf_calibrate_info.is_iqk_in_progress) { PHYDM_DBG(dm, ODM_COMP_CALIBRATION, "== FW IQK TIMEOUT (Still in progress after 500ms) ==\n"); + } } else _phy_iq_calibrate_8821a(dm); } diff --git a/hal/phydm/phydm_adc_sampling.c b/hal/phydm/phydm_adc_sampling.c index 72c6051..d60c1f7 100644 --- a/hal/phydm/phydm_adc_sampling.c +++ b/hal/phydm/phydm_adc_sampling.c @@ -66,12 +66,13 @@ phydm_la_buffer_allocate( if (PlatformAllocateMemoryWithZero(adapter, (void **)&adc_smp_buf->octet, adc_smp_buf->buffer_size) != RT_STATUS_SUCCESS) { #else odm_allocate_memory(dm, (void **)&adc_smp_buf->octet, adc_smp_buf->buffer_size); - if (!adc_smp_buf->octet) { + if (!adc_smp_buf->octet) { #endif ret = false; - } else + } else { adc_smp_buf->length = adc_smp_buf->buffer_size; ret = true; + } } return ret; diff --git a/hal/phydm/phydm_beamforming.c b/hal/phydm/phydm_beamforming.c index 4b84d1b..7a1b7dd 100644 --- a/hal/phydm/phydm_beamforming.c +++ b/hal/phydm/phydm_beamforming.c @@ -1123,8 +1123,9 @@ phydm_beamforming_notify( /*if (sound_info->sound_mode == SOUNDING_SW_VHT_TIMER || sound_info->sound_mode == SOUNDING_SW_HT_TIMER) odm_set_timer(dm, &beam_info->beamforming_timer, sound_info->sound_period);*/ odm_set_timer(dm, &beam_info->beamforming_timer, 1000); /*Do MU sounding every 1sec*/ - } else + } else { PHYDM_DBG(dm, DBG_TXBF, "%s: Less or larger than 2 MU STAs, not to set timer\n", __func__); + } break; case BEAMFORMEE_NOTIFY_DELETE_MU: @@ -1243,8 +1244,9 @@ beamforming_init_entry( if (beamformer_entry == NULL) { beamformer_entry = beamforming_add_bfer_entry(dm, sta, beamform_cap, num_of_sounding_dim, &bfer_idx); - if (beamformer_entry == NULL) + if (beamformer_entry == NULL) { PHYDM_DBG(dm, DBG_TXBF, "[%s]Not enough BFer entry!!!!!\n", __func__); + } } } @@ -1657,11 +1659,11 @@ beamforming_timer_callback( else ret = 0; #endif - if (ret) + if (ret) { ret = beamforming_start_sw(dm, sound_info->sound_idx, sound_info->sound_mode, sound_info->sound_bw); - else + } else { PHYDM_DBG(dm, DBG_TXBF, "%s, Error value return from BeamformingStart_V2\n", __func__); - + } if ((beam_info->beamformee_su_cnt != 0) || (beam_info->beamformee_mu_cnt > 1)) { if (sound_info->sound_mode == SOUNDING_SW_VHT_TIMER || sound_info->sound_mode == SOUNDING_SW_HT_TIMER) odm_set_timer(dm, &beam_info->beamforming_timer, sound_info->sound_period); diff --git a/hal/phydm/phydm_debug.c b/hal/phydm/phydm_debug.c index 3599e65..70404a1 100644 --- a/hal/phydm/phydm_debug.c +++ b/hal/phydm/phydm_debug.c @@ -1319,9 +1319,9 @@ phydm_basic_dbg_message if (dm->support_ic_type & PHYSTS_2ND_TYPE_IC) PHYDM_DBG(dm, ODM_COMP_COMMON, "Coding: LDPC=((%s)), STBC=((%s))\n", (dm->phy_dbg_info.is_ldpc_pkt) ? "Y" : "N", (dm->phy_dbg_info.is_stbc_pkt) ? "Y" : "N"); #endif - } else + } else { PHYDM_DBG(dm, ODM_COMP_COMMON, "No Link !!!\n"); - + } PHYDM_DBG(dm, ODM_COMP_COMMON, "[CCA Cnt] {CCK, OFDM, Total} = {%d, %d, %d}\n", false_alm_cnt->cnt_cck_cca, false_alm_cnt->cnt_ofdm_cca, false_alm_cnt->cnt_cca_all); @@ -1640,11 +1640,12 @@ phydm_fw_trace_en_h2c( PHYDM_DBG(dm, DBG_FW_TRACE, "---->\n"); - if (monitor_mode == 0) + if (monitor_mode == 0) { PHYDM_DBG(dm, DBG_FW_TRACE, "[H2C] FW_debug_en: (( %d ))\n", enable); - else + } else { PHYDM_DBG(dm, DBG_FW_TRACE, "[H2C] FW_debug_en: (( %d )), mode: (( %d )), macid: (( %d ))\n", enable, monitor_mode, macid); - odm_fill_h2c_cmd(dm, PHYDM_H2C_FW_TRACE_EN, cmd_length, h2c_parameter); + odm_fill_h2c_cmd(dm, PHYDM_H2C_FW_TRACE_EN, cmd_length, h2c_parameter); + } } void @@ -3588,8 +3589,9 @@ phydm_fw_trace_handler_code( u16 content_3 = (((u16)buffer[9]) << 8) | ((u16)buffer[8]); u16 content_4 = (((u16)buffer[11]) << 8) | ((u16)buffer[10]); - if (cmd_len > 12) + if (cmd_len > 12) { PHYDM_DBG(dm, DBG_FW_TRACE, "[FW Msg] Invalid cmd length (( %d )) >12\n", cmd_len); + } /* PHYDM_DBG(dm, DBG_FW_TRACE,"[FW Msg] Func=((%d)), num=((%d)), ct_0=((%d)), ct_1=((%d)), ct_2=((%d)), ct_3=((%d)), ct_4=((%d))\n", */ /* function, dbg_num, content_0, content_1, content_2, content_3, content_4); */ diff --git a/hal/phydm/txbf/halcomtxbf.c b/hal/phydm/txbf/halcomtxbf.c index 8de20bb..310959f 100644 --- a/hal/phydm/txbf/halcomtxbf.c +++ b/hal/phydm/txbf/halcomtxbf.c @@ -46,8 +46,9 @@ hal_com_txbf_config_gtab( { struct dm_struct *dm = (struct dm_struct *)dm_void; - if (dm->support_ic_type & ODM_RTL8822B) + if (dm->support_ic_type & ODM_RTL8822B) { hal_txbf_8822b_config_gtab(dm); + } } void @@ -204,14 +205,15 @@ hal_com_txbf_enter_work_item_callback( PHYDM_DBG(dm, DBG_TXBF, "[%s] Start!\n", __func__); - if (dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) + if (dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) { hal_txbf_jaguar_enter(dm, idx); - else if (dm->support_ic_type & ODM_RTL8192E) + } else if (dm->support_ic_type & ODM_RTL8192E) { hal_txbf_8192e_enter(dm, idx); - else if (dm->support_ic_type & ODM_RTL8814A) + } else if (dm->support_ic_type & ODM_RTL8814A) { hal_txbf_8814a_enter(dm, idx); - else if (dm->support_ic_type & ODM_RTL8822B) + } else if (dm->support_ic_type & ODM_RTL8822B) { hal_txbf_8822b_enter(dm, idx); + } } void @@ -235,14 +237,15 @@ hal_com_txbf_leave_work_item_callback( PHYDM_DBG(dm, DBG_TXBF, "[%s] Start!\n", __func__); - if (dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) + if (dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) { hal_txbf_jaguar_leave(dm, idx); - else if (dm->support_ic_type & ODM_RTL8192E) + } else if (dm->support_ic_type & ODM_RTL8192E) { hal_txbf_8192e_leave(dm, idx); - else if (dm->support_ic_type & ODM_RTL8814A) + } else if (dm->support_ic_type & ODM_RTL8814A) { hal_txbf_8814a_leave(dm, idx); - else if (dm->support_ic_type & ODM_RTL8822B) + } else if (dm->support_ic_type & ODM_RTL8822B) { hal_txbf_8822b_leave(dm, idx); + } } @@ -266,14 +269,15 @@ hal_com_txbf_fw_ndpa_work_item_callback( PHYDM_DBG(dm, DBG_TXBF, "[%s] Start!\n", __func__); - if (dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) + if (dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) { hal_txbf_jaguar_fw_txbf(dm, idx); - else if (dm->support_ic_type & ODM_RTL8192E) + } else if (dm->support_ic_type & ODM_RTL8192E) { hal_txbf_8192e_fw_tx_bf(dm, idx); - else if (dm->support_ic_type & ODM_RTL8814A) + } else if (dm->support_ic_type & ODM_RTL8814A) { hal_txbf_8814a_fw_txbf(dm, idx); - else if (dm->support_ic_type & ODM_RTL8822B) + } else if (dm->support_ic_type & ODM_RTL8822B) { hal_txbf_8822b_fw_txbf(dm, idx); + } } void @@ -376,14 +380,15 @@ hal_com_txbf_status_work_item_callback( PHYDM_DBG(dm, DBG_TXBF, "[%s] Start!\n", __func__); - if (dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) + if (dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) { hal_txbf_jaguar_status(dm, idx); - else if (dm->support_ic_type & ODM_RTL8192E) + } else if (dm->support_ic_type & ODM_RTL8192E) { hal_txbf_8192e_status(dm, idx); - else if (dm->support_ic_type & ODM_RTL8814A) + } else if (dm->support_ic_type & ODM_RTL8814A) { hal_txbf_8814a_status(dm, idx); - else if (dm->support_ic_type & ODM_RTL8822B) + } else if (dm->support_ic_type & ODM_RTL8822B) { hal_txbf_8822b_status(dm, idx); + } } void diff --git a/hal/phydm/txbf/haltxbfjaguar.c b/hal/phydm/txbf/haltxbfjaguar.c index 85eac44..ff61ccd 100644 --- a/hal/phydm/txbf/haltxbfjaguar.c +++ b/hal/phydm/txbf/haltxbfjaguar.c @@ -147,8 +147,9 @@ hal_txbf_jaguar_download_ndpa( dl_bcn_count++; } while (!(bcn_valid_reg & BIT(0)) && dl_bcn_count < 5); - if (!(bcn_valid_reg & BIT(0))) + if (!(bcn_valid_reg & BIT(0))) { PHYDM_DBG(dm, DBG_TXBF, "%s Download RSVD page failed!\n", __func__); + } /*TDECTRL[15:8] 0x209[7:0] = 0xF6 Beacon Head for TXDMA*/ odm_write_1byte(dm, REG_TDECTRL_8812A + 1, tx_page_bndy); diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index b2ecf23..3f1ddaf 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -2358,6 +2358,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, case NL80211_IFTYPE_P2P_CLIENT: is_p2p = _TRUE; #endif + /* intentional fallthrough */ case NL80211_IFTYPE_STATION: networkType = Ndis802_11Infrastructure; @@ -2382,6 +2383,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, case NL80211_IFTYPE_P2P_GO: is_p2p = _TRUE; #endif + /* intentional fallthrough */ case NL80211_IFTYPE_AP: networkType = Ndis802_11APMode; diff --git a/os_dep/linux/recv_linux.c b/os_dep/linux/recv_linux.c index d099f69..c5e3be7 100644 --- a/os_dep/linux/recv_linux.c +++ b/os_dep/linux/recv_linux.c @@ -529,10 +529,11 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, union recv_frame *r #endif /* CONFIG_RTW_NAPI */ ret = rtw_netif_rx(padapter->pnetdev, pkt); - if (ret == NET_RX_SUCCESS) + if (ret == NET_RX_SUCCESS) { DBG_COUNTER(padapter->rx_logs.os_netif_ok); - else + } else { DBG_COUNTER(padapter->rx_logs.os_netif_err); + } } } From 5e345a86d5a4b3bd5ac97fea526da6dc4ca8b084 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 25 Aug 2018 20:37:42 +0200 Subject: [PATCH 2/2] Fix USB3 and USB modeswitch function --- os_dep/linux/os_intfs.c | 2 +- os_dep/linux/usb_intf.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 21497ee..d07bf46 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -306,7 +306,7 @@ int rtw_drv_ant_band_switch = 1; /* 0:OFF , 1:ON, Driver control antenna band sw int rtw_single_ant_path; /*0:main ant , 1:aux ant , Fixed single antenna path, default main ant*/ /* 0: doesn't switch, 1: switch from usb2.0 to usb 3.0 2: switch from usb3.0 to usb 2.0 */ -int rtw_switch_usb_mode = 0; +int rtw_switch_usb_mode = 1; #ifdef CONFIG_USB_AUTOSUSPEND int rtw_enusbss = 1;/* 0:disable,1:enable */ diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c index 52d8258..90184e8 100644 --- a/os_dep/linux/usb_intf.c +++ b/os_dep/linux/usb_intf.c @@ -664,7 +664,24 @@ static int usb_reprobe_switch_usb_mode(PADAPTER Adapter) if (registry_par->switch_usb_mode == 0) goto exit; +#if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8814A) + if (IS_HIGH_SPEED_USB(Adapter)) { + if ((rtw_read8(Adapter, 0x74) & (BIT(2)|BIT(3))) != BIT(3)) { + rtw_write8(Adapter, 0x74, 0x8); + rtw_write8(Adapter, 0x70, 0x2); + rtw_write8(Adapter, 0x3e, 0x1); + rtw_write8(Adapter, 0x3d, 0x3); + /* usb disconnect */ + rtw_write8(Adapter, 0x5, 0x80); + ret = _TRUE; + } + } else if (IS_SUPER_SPEED_USB(Adapter)) { + rtw_write8(Adapter, 0x70, rtw_read8(Adapter, 0x70) & (~BIT(1))); + rtw_write8(Adapter, 0x3e, rtw_read8(Adapter, 0x3e) & (~BIT(0))); + } +#else rtw_hal_set_hwreg(Adapter, HW_VAR_USB_MODE, &ret); +#endif exit: return ret;