Skip to contentSkip to conversation

rtlwifi: Remove excessive check in _rtl_ps_inactive_ps()

PATCH In review Denis Efremov 4 participants 4 messages Sep 25, 2019 – Oct 1, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtlwifi: Remove excessive check in _rtl_ps_inactive_ps()

There is no need to check "rtlhal->interface == INTF_PCI" twice in _rtl_ps_inactive_ps(). The nested check is always true. Thus, the expression can be simplified.

---
 drivers/net/wireless/realtek/rtlwifi/ps.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/ps.c +1 -2
index 70f04c2f5b17..6a8127539ea7 100644
@@ -161,8 +161,7 @@ static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw)
 	if (ppsc->inactive_pwrstate == ERFON &&
 	    rtlhal->interface == INTF_PCI) {
 		if ((ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM) &&
-		    RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM) &&
-		    rtlhal->interface == INTF_PCI) {
+		    RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) {
 			rtlpriv->intf_ops->disable_aspm(hw);
 			RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM);
 		}
Signature · 1 line
2.21.0
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Denis Efremov

There is no need to check "rtlhal->interface == INTF_PCI" twice in _rtl_ps_inactive_ps(). The nested check is always true. Thus, the expression can be simplified.

---
  drivers/net/wireless/realtek/rtlwifi/ps.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/ps.c +0 -0
index 70f04c2f5b17..6a8127539ea7 100644

drivers/net/wireless/realtek/rtlwifi/ps.c static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw) · line 167

Quoted 9 lines
drivers/net/wireless/realtek/rtlwifi/ps.c +1 -2
@@ -161,8 +161,7 @@ static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw)
  	if (ppsc->inactive_pwrstate == ERFON &&
  	    rtlhal->interface == INTF_PCI) {
  		if ((ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM) &&
-		    RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM) &&
-		    rtlhal->interface == INTF_PCI) {
+		    RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) {
  			rtlpriv->intf_ops->disable_aspm(hw);
  			RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM);
  		}

Thanks,

Larry

#2 lore raw
In reply to Denis Efremov

Review static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw) · line 163

Quoted 5 lines

+++ b/drivers/net/wireless/realtek/rtlwifi/ps.c

(quoted diff) +0 -0
@@ -161,8 +161,7 @@  static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw)
 	if (ppsc->inactive_pwrstate = ERFON &&
 	    rtlhal->interface = INTF_PCI) {
 		if ((ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM) &&

Can it make sense to reduce the nesting level for these condition checks besides the suggested deletion of duplicate source code?

Regards,
Markus

#3 lore raw
In reply to Denis Efremov
Quoted 6 lines · Denis Efremov

There is no need to check "rtlhal->interface == INTF_PCI" twice in _rtl_ps_inactive_ps(). The nested check is always true. Thus, the expression can be simplified.

Patch applied to wireless-drivers-next.git, thanks.

a0d46f7a0fa5 rtlwifi: Remove excessive check in _rtl_ps_inactive_ps()

Signature · 3 lines
https://patchwork.kernel.org/patch/11161357/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches