linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtlwifi: Remove excessive check in _rtl_ps_inactive_ps()
@ 2019-09-25 20:58 Denis Efremov
  2019-09-26  0:06 ` Larry Finger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Denis Efremov @ 2019-09-25 20:58 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Denis Efremov, Ping-Ke Shih, David S. Miller, linux-wireless,
	netdev, linux-kernel

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);
 		}
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rtlwifi: Remove excessive check in _rtl_ps_inactive_ps()
  2019-09-25 20:58 [PATCH] rtlwifi: Remove excessive check in _rtl_ps_inactive_ps() Denis Efremov
@ 2019-09-26  0:06 ` Larry Finger
  2019-09-26 18:11 ` Markus Elfring
  2019-10-01  9:21 ` [PATCH] " Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Larry Finger @ 2019-09-26  0:06 UTC (permalink / raw)
  To: Denis Efremov, Kalle Valo
  Cc: Ping-Ke Shih, David S. Miller, linux-wireless, netdev, linux-kernel

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rtlwifi: Remove excessive check in _rtl_ps_inactive_ps()
  2019-09-25 20:58 [PATCH] rtlwifi: Remove excessive check in _rtl_ps_inactive_ps() Denis Efremov
  2019-09-26  0:06 ` Larry Finger
@ 2019-09-26 18:11 ` Markus Elfring
  2019-10-01  9:21 ` [PATCH] " Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2019-09-26 18:11 UTC (permalink / raw)
  To: Denis Efremov, Kalle Valo, Ping-Ke Shih, David S. Miller,
	linux-wireless, netdev
  Cc: linux-kernel, kernel-janitors, Larry Finger

> +++ 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rtlwifi: Remove excessive check in _rtl_ps_inactive_ps()
  2019-09-25 20:58 [PATCH] rtlwifi: Remove excessive check in _rtl_ps_inactive_ps() Denis Efremov
  2019-09-26  0:06 ` Larry Finger
  2019-09-26 18:11 ` Markus Elfring
@ 2019-10-01  9:21 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2019-10-01  9:21 UTC (permalink / raw)
  To: Denis Efremov
  Cc: Denis Efremov, Ping-Ke Shih, David S. Miller, linux-wireless,
	netdev, linux-kernel

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()

-- 
https://patchwork.kernel.org/patch/11161357/

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-01  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-25 20:58 [PATCH] rtlwifi: Remove excessive check in _rtl_ps_inactive_ps() Denis Efremov
2019-09-26  0:06 ` Larry Finger
2019-09-26 18:11 ` Markus Elfring
2019-10-01  9:21 ` [PATCH] " Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).