rtlwifi: Fix logic error in enter/exit power-save mode
authorwang yanqing <udknight@gmail.com>
Mon, 2 May 2016 16:38:36 +0000 (00:38 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 11 May 2016 18:44:07 +0000 (21:44 +0300)
In commit a269913c52ad ("rtlwifi: Rework rtl_lps_leave() and
rtl_lps_enter() to use work queue"), the tests for enter/exit
power-save mode were inverted. With this change applied, the
wifi connection becomes much more stable.

Fixes: a269913c52ad ("rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue")
Signed-off-by: Wang YanQing <udknight@gmail.com>
CC: Stable <stable@vger.kernel.org> [3.10+]
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/base.c

index c74eb139bfa14d5ea1e04c223f441d2de15d7b9b..264466f59c57029e71c64109b58c0b359557f5fe 100644 (file)
@@ -1660,9 +1660,9 @@ void rtl_watchdog_wq_callback(void *data)
                if (((rtlpriv->link_info.num_rx_inperiod +
                      rtlpriv->link_info.num_tx_inperiod) > 8) ||
                    (rtlpriv->link_info.num_rx_inperiod > 2))
-                       rtl_lps_enter(hw);
-               else
                        rtl_lps_leave(hw);
+               else
+                       rtl_lps_enter(hw);
        }
 
        rtlpriv->link_info.num_rx_inperiod = 0;