staging: rtl8192e: Remove unused and unchanged variables in rtl_ps.c
cover staging: rtl8192e: Remove unused and unchanged variables in rtl_ps.c
Remove unchanged and unused CamelCase variables that lead to dead code.
Tested with rtl8192e
Transferred this patch over wlan connection of rtl8192e
Philipp Hortmann (10):
staging: rtl8192e: Remove unchanged variable bFwCtrlLPS
staging: rtl8192e: Remove unchanged variable bInactivePs
staging: rtl8192e: Remove unused variable bIPSModeBackup
staging: rtl8192e: Remove unused variable bInPowerSaveMode
staging: rtl8192e: Remove unused variable isRFOff
staging: rtl8192e: Remove unchanged variable RegRfOff
staging: rtl8192e: Remove unchanged variable bDisableNormalResetCheck
staging: rtl8192e: Remove unused variable bForcedSilentReset
staging: rtl8192e: Remove unused variable ScanDelay
staging: rtl8192e: Remove unused variable bDriverIsGoingToUnload
.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 8 +-- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 18 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 20 +----- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 9 --- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 61 +++++++------------ drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 48 +++++++-------- drivers/staging/rtl8192e/rtllib.h | 6 -- 8 files changed, 55 insertions(+), 116 deletions(-)
Signature · 1 line
2.37.3
PATCH 1/10 staging: rtl8192e: Remove unchanged variable bFwCtrlLPS
bFwCtrlLPS is just once initialized and never changed. The evaluation will always have the same result. Remove resulting dead code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 15 ++++----------- drivers/staging/rtl8192e/rtllib.h | 3 --- 3 files changed, 4 insertions(+), 15 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
@@ -889,7 +889,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->rtllib->PowerSaveControl.bInactivePs = true; priv->rtllib->PowerSaveControl.bIPSModeBackup = false; priv->rtllib->PowerSaveControl.bLeisurePs = true; - priv->rtllib->PowerSaveControl.bFwCtrlLPS = false; priv->rtllib->LPSDelayCnt =0 ; priv->rtllib->sta_sleep =LPS_IS_WAKE ; priv->rtllib->rf_power_state = rf_on;
drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +4 -11
@@ -229,11 +229,8 @@ void rtl92e_leisure_ps_enter(struct net_device *dev)if (pPSC->LpsIdleCount >=RT_CHECK_FOR_HANG_PERIOD ) {if (priv->rtllib->ps ==RTLLIB_PS_DISABLED ) { -if (!pPSC->bFwCtrlLPS) { -if (priv->rtllib->SetFwCmdHandler) - priv->rtllib->SetFwCmdHandler ( - dev,FW_CMD_LPS_ENTER ); - } +if (priv->rtllib->SetFwCmdHandler) + priv->rtllib->SetFwCmdHandler (dev,FW_CMD_LPS_ENTER );_rtl92e_ps_set_mode (dev,RTLLIB_PS_MBCAST |RTLLIB_PS_UNICAST ); }
@@ -251,12 +248,8 @@ void rtl92e_leisure_ps_leave(struct net_device *dev)if (pPSC->bLeisurePs) {if (priv->rtllib->ps !=RTLLIB_PS_DISABLED ) {_rtl92e_ps_set_mode (dev,RTLLIB_PS_DISABLED ); - -if (!pPSC->bFwCtrlLPS) { -if (priv->rtllib->SetFwCmdHandler) - priv->rtllib->SetFwCmdHandler (dev, -FW_CMD_LPS_LEAVE ); - } +if (priv->rtllib->SetFwCmdHandler) + priv->rtllib->SetFwCmdHandler (dev,FW_CMD_LPS_LEAVE ); } } }
drivers/staging/rtl8192e/rtllib.h +0 -3
@@ -1264,9 +1264,6 @@ struct rt_pwr_save_ctrl {u32 CurPsLevel;u32 RegRfPsLevel; - -bool bFwCtrlLPS; - };#define RT_RF_CHANGE_SOURCE u32
Signature · 1 line
2.37.3
PATCH 2/10 staging: rtl8192e: Remove unchanged variable bInactivePs
In reply to Philipp HortmannbInactivePs is just once initialized and never changed. The evaluation will always have the same result. Remove resulting dead code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 18 ++++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 49 +++++++++----------- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 48 +++++++++---------- drivers/staging/rtl8192e/rtllib.h | 2 - 5 files changed, 51 insertions(+), 67 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +8 -10
@@ -81,17 +81,15 @@ void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex,enum rt_rf_power_state rt_state; rt_state = priv->rtllib->rf_power_state; -if (priv->rtllib->PowerSaveControl.bInactivePs) { -if (rt_state == rf_off) { -if (priv->rtllib->rf_off_reason >RF_CHANGE_BY_IPS ) { -netdev_warn (dev,"%s(): RF is OFF.\n" , - __func__); -return ; - } -mutex_lock (&priv->rtllib->ips_mutex); -rtl92e_ips_leave (dev); -mutex_unlock (&priv->rtllib->ips_mutex); +if (rt_state == rf_off) { +if (priv->rtllib->rf_off_reason >RF_CHANGE_BY_IPS ) { +netdev_warn (dev,"%s(): RF is OFF.\n" , + __func__); +return ; } +mutex_lock (&priv->rtllib->ips_mutex); +rtl92e_ips_leave (dev); +mutex_unlock (&priv->rtllib->ips_mutex); } priv->rtllib->is_set_key = true;if (EntryNo >=TOTAL_CAM_ENTRY ) {
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
@@ -886,7 +886,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->rf_change_in_progress = false; priv->bHwRfOffAction =0 ; priv->SetRFPowerStateInProgress = false; - priv->rtllib->PowerSaveControl.bInactivePs = true; priv->rtllib->PowerSaveControl.bIPSModeBackup = false; priv->rtllib->PowerSaveControl.bLeisurePs = true; priv->rtllib->LPSDelayCnt =0 ;
drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +21 -28
69 lines not on this page · raw message
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +22 -26
63 lines not on this page · raw message
drivers/staging/rtl8192e/rtllib.h +0 -2
@@ -1250,8 +1250,6 @@ enum rt_rf_power_state { };struct rt_pwr_save_ctrl { - -bool bInactivePs;bool bIPSModeBackup;bool bSwRfProcessing;enum rt_rf_power_state eInactivePowerState;
Signature · 1 line
2.37.3
PATCH 3/10 staging: rtl8192e: Remove unused variable bIPSModeBackup
In reply to Philipp HortmannbIPSModeBackup is just once initialized and never used. Remove resulting dead code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtllib.h | 1 - 2 files changed, 2 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
@@ -886,7 +886,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->rf_change_in_progress = false; priv->bHwRfOffAction =0 ; priv->SetRFPowerStateInProgress = false; - priv->rtllib->PowerSaveControl.bIPSModeBackup = false; priv->rtllib->PowerSaveControl.bLeisurePs = true; priv->rtllib->LPSDelayCnt =0 ; priv->rtllib->sta_sleep =LPS_IS_WAKE ;
drivers/staging/rtl8192e/rtllib.h +0 -1
@@ -1250,7 +1250,6 @@ enum rt_rf_power_state { };struct rt_pwr_save_ctrl { -bool bIPSModeBackup;bool bSwRfProcessing;enum rt_rf_power_state eInactivePowerState;enum ips_callback_function ReturnPoint;
Signature · 1 line
2.37.3
PATCH 4/10 staging: rtl8192e: Remove unused variable bInPowerSaveMode
In reply to Philipp HortmannbInPowerSaveMode is just once initialized and changed but never evaluated. Remove resulting dead code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 2 -- 3 files changed, 4 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
@@ -881,7 +881,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->hw_radio_off = false; priv->RegRfOff = false; priv->isRFOff = false; - priv->bInPowerSaveMode = false; priv->rtllib->rf_off_reason =0 ; priv->rf_change_in_progress = false; priv->bHwRfOffAction =0 ;
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -475,7 +475,6 @@ struct r8192_priv {bool RegRfOff;bool isRFOff; -bool bInPowerSaveMode;u8 bHwRfOffAction;bool rf_change_in_progress;
drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +0 -2
@@ -122,7 +122,6 @@ void rtl92e_ips_enter(struct net_device *dev) (priv->rtllib->iw_mode != IW_MODE_MASTER)) { pPSC->eInactivePowerState = rf_off; priv->isRFOff = true; - priv->bInPowerSaveMode = true;_rtl92e_ps_update_rf_state (dev); } }
@@ -138,7 +137,6 @@ void rtl92e_ips_leave(struct net_device *dev)if (rt_state != rf_on && !pPSC->bSwRfProcessing && priv->rtllib->rf_off_reason <=RF_CHANGE_BY_IPS ) { pPSC->eInactivePowerState = rf_on; - priv->bInPowerSaveMode = false;_rtl92e_ps_update_rf_state (dev); } }
Signature · 1 line
2.37.3
PATCH 5/10 staging: rtl8192e: Remove unused variable isRFOff
In reply to Philipp HortmannisRFOff is just once initialized and changed but never evaluated. Remove resulting dead code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 1 - 3 files changed, 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
@@ -880,7 +880,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->rtllib->wx_set_enc =0 ; priv->hw_radio_off = false; priv->RegRfOff = false; - priv->isRFOff = false; priv->rtllib->rf_off_reason =0 ; priv->rf_change_in_progress = false; priv->bHwRfOffAction =0 ;
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -474,7 +474,6 @@ struct r8192_priv {u16 ChannelPlan;bool RegRfOff; -bool isRFOff;u8 bHwRfOffAction;bool rf_change_in_progress;
drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +0 -1
@@ -121,7 +121,6 @@ void rtl92e_ips_enter(struct net_device *dev) (priv->rtllib->state != RTLLIB_LINKED) && (priv->rtllib->iw_mode != IW_MODE_MASTER)) { pPSC->eInactivePowerState = rf_off; - priv->isRFOff = true;_rtl92e_ps_update_rf_state (dev); } }
Signature · 1 line
2.37.3
PATCH 6/10 staging: rtl8192e: Remove unchanged variable RegRfOff
In reply to Philipp HortmannRegRfOff is just once initialized with false and then set to false again. All evaluations will result in false. Remove resulting dead code.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 7 +------ drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 -- 4 files changed, 1 insertion(+), 10 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +1 -6
@@ -624,9 +624,6 @@ bool rtl92e_start_adapter(struct net_device *dev) } priv->pFirmware->status =FW_STATUS_0_INIT ; -if (priv->RegRfOff) - priv->rtllib->rf_power_state = rf_off; - ulRegRead =rtl92e_readl (dev,CPU_GEN );if (priv->pFirmware->status ==FW_STATUS_0_INIT ) ulRegRead |=CPU_GEN_SYSTEM_RESET ;
@@ -756,9 +753,7 @@ bool rtl92e_start_adapter(struct net_device *dev)rtl92e_writeb (dev,0x87 ,0x0 ); -if (priv->RegRfOff) { -rtl92e_set_rf_state (dev, rf_off,RF_CHANGE_BY_SW ); - }else if (priv->rtllib->rf_off_reason >RF_CHANGE_BY_PS ) { +if (priv->rtllib->rf_off_reason >RF_CHANGE_BY_PS ) {rtl92e_set_rf_state (dev, rf_off, priv->rtllib->rf_off_reason); }else if (priv->rtllib->rf_off_reason >=RF_CHANGE_BY_IPS ) {rtl92e_set_rf_state (dev, rf_off, priv->rtllib->rf_off_reason);
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0 -1
@@ -1325,7 +1325,6 @@ static bool _rtl92e_set_rf_power_state(struct net_device *dev,do { InitilizeCount--; - priv->RegRfOff = false; rtstatus =rtl92e_enable_nic (dev); }while (!rtstatus && (InitilizeCount >0 ));
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
@@ -879,7 +879,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->RxCounter =0 ; priv->rtllib->wx_set_enc =0 ; priv->hw_radio_off = false; - priv->RegRfOff = false; priv->rtllib->rf_off_reason =0 ; priv->rf_change_in_progress = false; priv->bHwRfOffAction =0 ;
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -2
@@ -472,8 +472,6 @@ struct r8192_priv {u16 RegChannelPlan;u16 ChannelPlan; - -bool RegRfOff;u8 bHwRfOffAction;bool rf_change_in_progress;
Signature · 1 line
2.37.3
PATCH 7/10 staging: rtl8192e: Remove unchanged variable bDisableNormalResetCheck
In reply to Philipp HortmannbDisableNormalResetCheck is just once initialized with false. All evaluations will result in !false. Remove resulting dead code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 ++---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +2 -4
@@ -871,7 +871,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->ScanDelay =50 ; priv->ResetProgress =RESET_TYPE_NORESET ; priv->bForcedSilentReset = false; - priv->bDisableNormalResetCheck = false; priv->force_reset = false;memset (priv->rtllib->swcamtable,0 ,sizeof (struct sw_cam_table ) *32 );
@@ -1403,13 +1402,12 @@ static void _rtl92e_watchdog_wq_cb(void *data) }spin_unlock_irqrestore (&priv->tx_lock, flags); -if (!priv->bDisableNormalResetCheck && ResetType ==RESET_TYPE_NORMAL ) { +if (ResetType ==RESET_TYPE_NORMAL ) { priv->ResetProgress =RESET_TYPE_NORMAL ;return ; } -if (((priv->force_reset) || (!priv->bDisableNormalResetCheck && - ResetType ==RESET_TYPE_SILENT ))) +if ((priv->force_reset || ResetType ==RESET_TYPE_SILENT ))_rtl92e_if_silent_reset (dev); priv->force_reset = false; priv->bForcedSilentReset = false;
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -541,7 +541,6 @@ struct r8192_priv {enum reset_type ResetProgress;bool bForcedSilentReset; -bool bDisableNormalResetCheck;u16 TxCounter;u16 RxCounter;bool bResetInProgress;
Signature · 1 line
2.37.3
PATCH 8/10 staging: rtl8192e: Remove unused variable bForcedSilentReset
In reply to Philipp HortmannbForcedSilentReset is never evaluated. Remove resulting dead code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 5 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -4
@@ -870,7 +870,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->CckPwEnl =6 ; priv->ScanDelay =50 ; priv->ResetProgress =RESET_TYPE_NORESET ; - priv->bForcedSilentReset = false; priv->force_reset = false;memset (priv->rtllib->swcamtable,0 ,sizeof (struct sw_cam_table ) *32 );
@@ -1240,8 +1239,6 @@ static void _rtl92e_if_silent_reset(struct net_device *dev) END: priv->ResetProgress =RESET_TYPE_NORESET ; priv->reset_count++; - - priv->bForcedSilentReset = false; priv->bResetInProgress = false;rtl92e_writeb (dev,UFWP ,1 );
@@ -1410,7 +1407,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)if ((priv->force_reset || ResetType ==RESET_TYPE_SILENT ))_rtl92e_if_silent_reset (dev); priv->force_reset = false; - priv->bForcedSilentReset = false; priv->bResetInProgress = false; }
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -540,7 +540,6 @@ struct r8192_priv {u32 reset_count;enum reset_type ResetProgress; -bool bForcedSilentReset;u16 TxCounter;u16 RxCounter;bool bResetInProgress;
Signature · 1 line
2.37.3
PATCH 9/10 staging: rtl8192e: Remove unused variable ScanDelay
In reply to Philipp HortmannScanDelay is never evaluated. Remove resulting dead code.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 -- 3 files changed, 4 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +0 -1
@@ -503,7 +503,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) priv->ChannelPlan =0x0 ;break ;case EEPROM_CID_Nettronix: - priv->ScanDelay =100 ; priv->CustomerID = RT_CID_Nettronix;break ;case EEPROM_CID_Pronet:
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
@@ -868,7 +868,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->rfa_txpowertrackingindex =0 ; priv->rfc_txpowertrackingindex =0 ; priv->CckPwEnl =6 ; - priv->ScanDelay =50 ; priv->ResetProgress =RESET_TYPE_NORESET ; priv->force_reset = false;memset (priv->rtllib->swcamtable,0 ,sizeof (struct sw_cam_table ) *32 );
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -2
@@ -410,8 +410,6 @@ struct r8192_priv {short chan;short sens;short max_sens; - -u8 ScanDelay;bool ps_force;u32 irq_mask[2 ];
Signature · 1 line
2.37.3
PATCH 10/10 staging: rtl8192e: Remove unused variable bDriverIsGoingToUnload
In reply to Philipp HortmannbDriverIsGoingToUnload is never evaluated. Remove resulting dead code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 --- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 4 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -3
@@ -686,7 +686,6 @@ static int _rtl92e_sta_up(struct net_device *dev, bool is_silent_reset) (&priv->rtllib->PowerSaveControl);bool init_status; - priv->bDriverIsGoingToUnload = false; priv->bdisable_nic = false; priv->up =1 ;
@@ -735,7 +734,6 @@ static int _rtl92e_sta_down(struct net_device *dev, bool shutdownrf)if (priv->rtllib->state ==RTLLIB_LINKED )rtl92e_leisure_ps_leave (dev); - priv->bDriverIsGoingToUnload = true; priv->up =0 ; priv->rtllib->ieee_up =0 ; priv->bfirst_after_down = true;
@@ -838,7 +836,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->polling_timer_on =0 ; priv->up_first_time =1 ; priv->blinked_ingpio = false; - priv->bDriverIsGoingToUnload = false; priv->being_init_adapter = false; priv->initialized_at_probe = false; priv->bdisable_nic = false;
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -311,7 +311,6 @@ struct r8192_priv {bool bfirst_after_down;bool initialized_at_probe;bool being_init_adapter; -bool bDriverIsGoingToUnload;int irq;short irq_enabled;
Signature · 1 line
2.37.3