diff mbox series

rtlwifi: Remove excessive check in _rtl_ps_inactive_ps()

Message ID 20190925205858.30216-1-efremov@linux.com (mailing list archive)
State Accepted
Commit a0d46f7a0fa5e2a447a25c87612040babf7a3e18
Delegated to: Kalle Valo
Headers show
Series rtlwifi: Remove excessive check in _rtl_ps_inactive_ps() | expand

Commit Message

Denis Efremov (Oracle) Sept. 25, 2019, 8:58 p.m. UTC
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.

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 drivers/net/wireless/realtek/rtlwifi/ps.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Larry Finger Sept. 26, 2019, 12:06 a.m. UTC | #1
On 9/25/19 3:58 PM, Denis Efremov wrote:
> 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.
> 
> Signed-off-by: Denis Efremov <efremov@linux.com>
> ---
>   drivers/net/wireless/realtek/rtlwifi/ps.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.c b/drivers/net/wireless/realtek/rtlwifi/ps.c
> index 70f04c2f5b17..6a8127539ea7 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/ps.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/ps.c
> @@ -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);
>   		}
> 
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

Thanks,

Larry
Markus Elfring Sept. 26, 2019, 6:11 p.m. UTC | #2
> +++ b/drivers/net/wireless/realtek/rtlwifi/ps.c
> @@ -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
Kalle Valo Oct. 1, 2019, 9:21 a.m. UTC | #3
Denis Efremov <efremov@linux.com> wrote:

> 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.
> 
> Signed-off-by: Denis Efremov <efremov@linux.com>
> Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

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

a0d46f7a0fa5 rtlwifi: Remove excessive check in _rtl_ps_inactive_ps()
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.c b/drivers/net/wireless/realtek/rtlwifi/ps.c
index 70f04c2f5b17..6a8127539ea7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/ps.c
+++ b/drivers/net/wireless/realtek/rtlwifi/ps.c
@@ -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);
 		}