]> git.baikalelectronics.ru Git - kernel.git/commitdiff
rtw88: power on again if it was already on
authorYan-Hsuan Chuang <yhchuang@realtek.com>
Fri, 14 Jun 2019 07:24:12 +0000 (15:24 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 25 Jun 2019 05:08:59 +0000 (08:08 +0300)
We could fail to power on because it was already on. If the return
value is -EALREADY, power off and then power on again to turn on the
hardware as expected.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtw88/mac.c

index 25a923bc63662fb6ed6af4df290570d43c777a08..fc14b37d927d75b21f1bb6a3733c34eaffa75b9a 100644 (file)
@@ -285,8 +285,14 @@ int rtw_mac_power_on(struct rtw_dev *rtwdev)
                goto err;
 
        ret = rtw_mac_power_switch(rtwdev, true);
-       if (ret)
+       if (ret == -EALREADY) {
+               rtw_mac_power_switch(rtwdev, false);
+               ret = rtw_mac_power_switch(rtwdev, true);
+               if (ret)
+                       goto err;
+       } else if (ret) {
                goto err;
+       }
 
        ret = rtw_mac_init_system_cfg(rtwdev);
        if (ret)