staging: rtl8192e: remove rf_type from r8192_priv
cover staging: rtl8192e: remove rf_type from r8192_priv
This series removes the rf_type field from the r8192_priv structure. RF type is always RF_1T2R, so we do not need to store it in an extra variable.
I don't have any hardware to test this, so compile-tested only.
Michael Straube (4):
staging: rtl8192e: remove RTL819X_DEFAULT_RF_TYPE
staging: rtl8192e: remove redundant setting of rf_type
staging: rtl8192e: priv->rf_type is always RF_1T2R
staging: rtl8192e: remove rf_type from struct r8192_priv
.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 19 +++----------- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 7 ++---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 3 --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 25 +++++++------------ 4 files changed, 15 insertions(+), 39 deletions(-)
Signature · 1 line
2.40.0
PATCH 1/4 staging: rtl8192e: remove RTL819X_DEFAULT_RF_TYPE
Remove RTL819X_DEFAULT_RF_TYPE and use RF_1T2R directly to make follow up patches, which will remove priv->rf_type, easier to review.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +1 -1
@@ -343,7 +343,7 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)else priv->tx_pwr_data_read_from_eeprom = false; - priv->rf_type =RTL819X_DEFAULT_RF_TYPE ; + priv->rf_type =RF_1T2R ;if (priv->card_8192_version >VERSION_8190_BD ) {if (!priv->autoload_fail_flag) {
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -2
@@ -61,8 +61,6 @@#define HAL_HW_PCI_REVISION_ID_8192PCIE 0x01#define HAL_HW_PCI_REVISION_ID_8192SE 0x10 -#define RTL819X_DEFAULT_RF_TYPE RF_1T2R -#define RTLLIB_WATCH_DOG_TIME 2000#define MAX_DEV_ADDR_SIZE 8/*support till 64 bit bus width OS*/
Signature · 1 line
2.40.0
PATCH 2/4 staging: rtl8192e: remove redundant setting of rf_type
In reply to Michael StraubeAt this point the value of priv->rf_type is RF_1T2R already. Setting it again is redundant and can be removed.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +0 -4
@@ -350,10 +350,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) tempval = (rtl92e_eeprom_read (dev, (EEPROM_RFInd_PowerDiff >>1 ))) &0xff ; priv->eeprom_legacy_ht_tx_pwr_diff = tempval &0xf ; - -if (tempval&0x80 ) - priv->rf_type =RF_1T2R ; - }else { priv->eeprom_legacy_ht_tx_pwr_diff =0x04 ; }
Signature · 1 line
2.40.0
PATCH 3/4 staging: rtl8192e: priv->rf_type is always RF_1T2R
In reply to Michael StraubeThe value of priv->rf_type is always RF_1T2R. Remove if statements that check for priv->rf_type == RF_1T2R and remove resulting dead code.
--- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 13 ++++------- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 7 ++---- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 23 +++++++------------ 3 files changed, 14 insertions(+), 29 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +4 -9
@@ -540,8 +540,7 @@ static void _rtl92e_hwconfig(struct net_device *dev)u32 ratr_value; ratr_value = regRATR; -if (priv->rf_type ==RF_1T2R ) - ratr_value &= ~(RATE_ALL_OFDM_2SS ); + ratr_value &= ~(RATE_ALL_OFDM_2SS );rtl92e_writel (dev,RATR0 , ratr_value);rtl92e_writeb (dev,UFWP ,1 ); }
@@ -1886,14 +1885,10 @@ void rtl92e_update_ratr_table(struct net_device *dev)break ;case IEEE_N_24G :case IEEE_N_5G : -if (ieee->ht_info->peer_mimo_ps ==0 ) { +if (ieee->ht_info->peer_mimo_ps ==0 ) ratr_value &=0x0007F007 ; - }else { -if (priv->rf_type ==RF_1T2R ) - ratr_value &=0x000FF007 ; -else - ratr_value &=0x0F81F007 ; - } +else + ratr_value &=0x000FF007 ;break ;default :break ;
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2 -5
@@ -281,14 +281,11 @@ static void _rtl92e_phy_config_bb(struct net_device *dev, u8 ConfigType)u32 *Rtl819XPHY_REGArray_Table =NULL ;u32 *Rtl819XAGCTAB_Array_Table =NULL ;u16 AGCTAB_ArrayLen, PHY_REGArrayLen =0 ; -struct r8192_priv *priv =rtllib_priv (dev); AGCTAB_ArrayLen =RTL8192E_AGCTAB_ARR_LEN ; Rtl819XAGCTAB_Array_Table =RTL8192E_AGCTAB_ARR ; -if (priv->rf_type ==RF_1T2R ) { - PHY_REGArrayLen =RTL8192E_PHY_REG_1T2R_ARR_LEN ; - Rtl819XPHY_REGArray_Table =RTL8192E_PHY_REG_1T2R_ARR ; - } + PHY_REGArrayLen =RTL8192E_PHY_REG_1T2R_ARR_LEN ; + Rtl819XPHY_REGArray_Table =RTL8192E_PHY_REG_1T2R_ARR ;if (ConfigType ==BB_CONFIG_PHY_REG ) {for (i =0 ; i < PHY_REGArrayLen; i +=2 ) {
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +8 -15
@@ -272,19 +272,14 @@ void rtl92e_init_adaptive_rate(struct net_device *dev) pra->ping_rssi_enable =0 ; pra->ping_rssi_thresh_for_ra =15 ; - -if (priv->rf_type ==RF_1T2R ) { - pra->upper_rssi_threshold_ratr =0x000fc000 ; - pra->middle_rssi_threshold_ratr =0x000ff000 ; - pra->low_rssi_threshold_ratr =0x000ff001 ; - pra->low_rssi_threshold_ratr_40M =0x000ff005 ; - pra->low_rssi_threshold_ratr_20M =0x000ff001 ; - pra->ping_rssi_ratr =0x0000000d ; - } - + pra->upper_rssi_threshold_ratr =0x000fc000 ; + pra->middle_rssi_threshold_ratr =0x000ff000 ; + pra->low_rssi_threshold_ratr =0x000ff001 ; + pra->low_rssi_threshold_ratr_40M =0x000ff005 ; + pra->low_rssi_threshold_ratr_20M =0x000ff001 ; + pra->ping_rssi_ratr =0x0000000d ; } -static void _rtl92e_dm_check_rate_adaptive (struct net_device *dev) {struct r8192_priv *priv =rtllib_priv (dev);
@@ -383,8 +378,7 @@ static void _rtl92e_dm_check_rate_adaptive(struct net_device *dev)u32 ratr_value; ratr_value = targetRATR; -if (priv->rf_type ==RF_1T2R ) - ratr_value &= ~(RATE_ALL_OFDM_2SS ); + ratr_value &= ~(RATE_ALL_OFDM_2SS );rtl92e_writel (dev,RATR0 , ratr_value);rtl92e_writeb (dev,UFWP ,1 );
@@ -981,8 +975,7 @@ void rtl92e_dm_restore_state(struct net_device *dev) priv->rtllib->mode == WIRELESS_MODE_N_5G))return ; ratr_value = reg_ratr; -if (priv->rf_type ==RF_1T2R ) - ratr_value &= ~(RATE_ALL_OFDM_2SS ); + ratr_value &= ~(RATE_ALL_OFDM_2SS );rtl92e_writel (dev,RATR0 , ratr_value);rtl92e_writeb (dev,UFWP ,1 );if (priv->tx_pwr_tracking_init && priv->btxpower_tracking)
Signature · 1 line
2.40.0
PATCH 4/4 staging: rtl8192e: remove rf_type from struct r8192_priv
In reply to Michael StraubeThe field rf_type of struct r8192_priv is always RF_1T2R and only used in one place. Use RF_1T2R directly there and remove rf_type from struct r8192_priv.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 -- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +0 -2
@@ -343,8 +343,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)else priv->tx_pwr_data_read_from_eeprom = false; - priv->rf_type =RF_1T2R ; -if (priv->card_8192_version >VERSION_8190_BD ) {if (!priv->autoload_fail_flag) { tempval = (rtl92e_eeprom_read(dev,
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -289,7 +289,6 @@ struct r8192_priv {enum nic_t card_8192;u8 card_8192_version; -u8 rf_type;u8 ic_cut;char nick[IW_ESSID_MAX_SIZE +1 ];u8 check_roaming_cnt;
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +1 -1
@@ -532,7 +532,7 @@ static void _rtl92e_dm_tx_power_tracking_callback_tssi(struct net_device *dev) priv->rtllib->bdynamic_txpower_enable = false; powerlevelOFDM24G = priv->pwr_track >>24 ; - RF_Type = priv->rf_type; + RF_Type =RF_1T2R ; Value = (RF_Type<<8 ) | powerlevelOFDM24G;for (j =0 ; j <=30 ; j++) {
Signature · 1 line
2.40.0
Quoted 12 lines · Michael Straube
This series removes the
rf_typefield from ther8192_privstructure. RF type is alwaysRF_1T2R, so we do not need to store it in an extra variable.I don't have any hardware to test this, so compile-tested only.
Michael Straube (4):
staging: rtl8192e: removeRTL819X_DEFAULT_RF_TYPE
staging: rtl8192e: remove redundant setting ofrf_type
staging: rtl8192e:priv->rf_typeis alwaysRF_1T2R
staging: rtl8192e: removerf_typefrom structr8192_priv
Quoted 6 lines
.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 19 +++----------- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 7 ++---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 3 --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 25 +++++++------------ 4 files changed, 15 insertions(+), 39 deletions(-)