Skip to contentSkip to conversation

staging: rtl8192e: Remove unchanged variables around rf_power_state

PATCH New Philipp Hortmann 1 participant 9 messages Apr 16, 2023 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8192e: Remove unchanged variables around rf_power_state

Remove unchanged/unused variables and resulting dead code in conjunction with the state machine of rf_power_state.

Tested with rtl8192e (WLL6130-D99)
Transferred this patch over wlan connection of rtl8192e

Philipp Hortmann (8):
staging: rtl8192e: Remove unchanged variable RegRfPsLevel
staging: rtl8192e: Remove unused function rtl92e_disable_nic
staging: rtl8192e: Remove unused macro RT_SET_PS_LEVEL
staging: rtl8192e: Remove second initialization of bActuallySet
staging: rtl8192e: Remove set to true while true of bfirst_after_down
staging: rtl8192e: Remove unchanged variable chan_forced
staging: rtl8192e: Remove unchanged variable frame_sync_monitor
staging: rtl8192e: Remove unchanged variables bfsync_processing and
more

 .../staging/rtl8192e/rtl8192e/r8192E_phy.c    |  9 +--
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c  | 20 -----
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h  |  7 --
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c    | 80 +++++++------------
 drivers/staging/rtl8192e/rtllib.h             |  2 -
 5 files changed, 32 insertions(+), 86 deletions(-)
Signature · 1 line
2.40.0
#1 lore raw

PATCH 1/8 staging: rtl8192e: Remove unchanged variable RegRfPsLevel

Remove unchanged variable RegRfPsLevel and equations that have always the same result to shorten code.

---
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 9 +--------
 drivers/staging/rtl8192e/rtllib.h              | 1 -
 2 files changed, 1 insertion(+), 9 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +1 -8
index dd666701138e..4b0ebe96302e 100644
@@ -1089,14 +1089,7 @@ static bool _rtl92e_set_rf_power_state(struct net_device *dev,
 			if (i >= MAX_DOZE_WAITING_TIMES_9x)
 				break;
 		}
-		if (psc->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC &&
-		    !RT_IN_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC)) {
-			rtl92e_disable_nic(dev);
-			RT_SET_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC);
-		} else if (!(psc->RegRfPsLevel &
-			   RT_RF_OFF_LEVL_HALT_NIC)) {
-			rtl92e_set_rf_off(dev);
-		}
+		rtl92e_set_rf_off(dev);
 		break;
 	default:
 		bResult = false;
drivers/staging/rtl8192e/rtllib.h +0 -1
index b1729d65f67f..1a0e7ae70ca6 100644
@@ -1237,7 +1237,6 @@ struct rt_pwr_save_ctrl {
 	u8				LPSAwakeIntvl;
 
 	u32				CurPsLevel;
-	u32				RegRfPsLevel;
 };
 
 #define RT_RF_CHANGE_SOURCE u32
Signature · 1 line
2.40.0
#2 lore raw

PATCH 2/8 staging: rtl8192e: Remove unused function rtl92e_disable_nic

In reply to Philipp Hortmann

Remove unused function rtl92e_disable_nic to shorten code.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 16 ----------------
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h |  1 -
 2 files changed, 17 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -16
index a644543015ee..a0c6d117211a 100644
@@ -2302,22 +2302,6 @@ bool rtl92e_enable_nic(struct net_device *dev)
 	return init_status;
 }
 
-bool rtl92e_disable_nic(struct net_device *dev)
-{
-	struct r8192_priv *priv = rtllib_priv(dev);
-	u8 tmp_state = 0;
-
-	priv->bdisable_nic = true;
-	tmp_state = priv->rtllib->state;
-	rtllib_softmac_stop_protocol(priv->rtllib, 0, false);
-	priv->rtllib->state = tmp_state;
-	_rtl92e_cancel_deferred_work(priv);
-	rtl92e_irq_disable(dev);
-
-	rtl92e_stop_adapter(dev, false);
-	return true;
-}
-
 module_pci_driver(rtl8192_pci_driver);
 
 void rtl92e_check_rfctrl_gpio_timer(struct timer_list *t)
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
index b0aa76574738..51240cbde0d3 100644
@@ -433,7 +433,6 @@ u8 rtl92e_rx_db_to_percent(s8 antpower);
 void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats,
 			    struct rtllib_rx_stats *ptarget_stats);
 bool rtl92e_enable_nic(struct net_device *dev);
-bool rtl92e_disable_nic(struct net_device *dev);
 
 bool rtl92e_set_rf_state(struct net_device *dev,
 			 enum rt_rf_power_state state_to_set,
Signature · 1 line
2.40.0
#3 lore raw

PATCH 3/8 staging: rtl8192e: Remove unused macro RT_SET_PS_LEVEL

In reply to Philipp Hortmann

Remove unused macro RT_SET_PS_LEVEL to shorten code.

---
 drivers/staging/rtl8192e/rtllib.h | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
index 1a0e7ae70ca6..6e665e866f1f 100644
@@ -100,7 +100,6 @@ static inline void *netdev_priv_rsl(struct net_device *dev)
 	((psc->CurPsLevel & _PS_FLAG) ? true : false)
 #define	RT_CLEAR_PS_LEVEL(psc, _PS_FLAG)	\
 	(psc->CurPsLevel &= (~(_PS_FLAG)))
-#define	RT_SET_PS_LEVEL(psc, _PS_FLAG)	(psc->CurPsLevel |= _PS_FLAG)
 
 /* defined for skb cb field */
 /* At most 28 byte */
Signature · 1 line
2.40.0
#4 lore raw

PATCH 4/8 staging: rtl8192e: Remove second initialization of bActuallySet

In reply to Philipp Hortmann

Remove second initialization of bActuallySet to shorten code.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +0 -2
index 93504d5a8578..7342ef591169 100644
@@ -1539,8 +1539,6 @@ static void _rtl92e_dm_check_rf_ctrl_gpio(void *data)
 	enum rt_rf_power_state rf_power_state_to_set;
 	bool bActuallySet = false;
 
-	bActuallySet = false;
-
 	if ((priv->up_first_time == 1) || (priv->being_init_adapter))
 		return;
 
Signature · 1 line
2.40.0
#5 lore raw

PATCH 5/8 staging: rtl8192e: Remove set to true while true of bfirst_after_down

In reply to Philipp Hortmann

Remove set to true while true of bfirst_after_down to shorten code.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +1 -3
index 7342ef591169..ed8b39d3c856 100644
@@ -1542,10 +1542,8 @@ static void _rtl92e_dm_check_rf_ctrl_gpio(void *data)
 	if ((priv->up_first_time == 1) || (priv->being_init_adapter))
 		return;
 
-	if (priv->bfirst_after_down) {
-		priv->bfirst_after_down = true;
+	if (priv->bfirst_after_down)
 		return;
-	}
 
 	tmp1byte = rtl92e_readb(dev, GPI);
 
Signature · 1 line
2.40.0
#6 lore raw

PATCH 6/8 staging: rtl8192e: Remove unchanged variable chan_forced

In reply to Philipp Hortmann

Remove unchanged variable chan_forced and equations that have always the same result to shorten code.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 ---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 --
 2 files changed, 5 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -3
index a0c6d117211a..88ff54173a1f 100644
@@ -249,9 +249,6 @@ static void _rtl92e_set_chan(struct net_device *dev, short ch)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	if (priv->chan_forced)
-		return;
-
 	priv->chan = ch;
 
 	if (priv->rf_set_chan)
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -2
index 51240cbde0d3..0eca73e4540f 100644
@@ -392,8 +392,6 @@ struct r8192_priv {
 	bool		reset_in_progress;
 	bool		force_reset;
 	bool		force_lps;
-
-	bool		chan_forced;
 };
 
 extern const struct ethtool_ops rtl819x_ethtool_ops;
Signature · 1 line
2.40.0
#7 lore raw

PATCH 7/8 staging: rtl8192e: Remove unchanged variable frame_sync_monitor

In reply to Philipp Hortmann

Remove unchanged variable frame_sync_monitor and equations that have always the same result to shorten code.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h |  2 -
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c   | 73 ++++++++------------
 2 files changed, 30 insertions(+), 45 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -2
index 0eca73e4540f..c97e315a9091 100644
@@ -382,8 +382,6 @@ struct r8192_priv {
 	u32		continue_diff_count;
 	bool		bswitch_fsync;
 	u8		framesync;
-	u8		frame_sync_monitor;
-
 	u32		reset_count;
 
 	enum reset_type rst_progress;
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +30 -43

99 lines not on this page · raw message

Signature · 1 line
2.40.0
#8 lore raw

PATCH 8/8 staging: rtl8192e: Remove unchanged variables bfsync_processing and more

In reply to Philipp Hortmann

Remove unchanged variable bfsync_processing and
rfc_txpowertrackingindex_real to shorten code.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 -
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 --
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c   | 1 -
 3 files changed, 4 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
index 88ff54173a1f..27040d1e3230 100644
@@ -786,7 +786,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
 	priv->rtllib->short_slot = 1;
 	priv->promisc = (dev->flags & IFF_PROMISC) ? 1 : 0;
 	priv->bcck_in_ch14 = false;
-	priv->bfsync_processing  = false;
 	priv->cck_present_attn = 0;
 	priv->rfa_txpowertrackingindex = 0;
 	priv->rfc_txpowertrackingindex = 0;
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -2
index c97e315a9091..285dac32c074 100644
@@ -357,7 +357,6 @@ struct r8192_priv {
 	u8		rfa_txpowertrackingindex_real;
 	u8		rfa_txpowertracking_default;
 	u8		rfc_txpowertrackingindex;
-	u8		rfc_txpowertrackingindex_real;
 	bool		btxpower_tracking;
 	bool		bcck_in_ch14;
 
@@ -376,7 +375,6 @@ struct r8192_priv {
 	bool		bcurrent_turbo_EDCA;
 	bool		bis_cur_rdlstate;
 
-	bool		bfsync_processing;
 	u32		rate_record;
 	u32		rate_count_diff_rec;
 	u32		continue_diff_count;
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +0 -1
index 43e335ab0733..56a8ec517c06 100644
@@ -998,7 +998,6 @@ void rtl92e_dm_backup_state(struct net_device *dev)
 	u32 bit_mask = bMaskByte0;
 
 	priv->bswitch_fsync  = false;
-	priv->bfsync_processing = false;
 
 	if (dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
 		return;
Signature · 1 line
2.40.0