Commit 4ee2f342 authored by Brian Norris's avatar Brian Norris Committed by Kalle Valo

rtw88: use a for loop in rtw_power_mode_change(), not goto

No change in logic.
Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
Acked-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 12078aae
...@@ -69,7 +69,7 @@ void rtw_power_mode_change(struct rtw_dev *rtwdev, bool enter) ...@@ -69,7 +69,7 @@ void rtw_power_mode_change(struct rtw_dev *rtwdev, bool enter)
u8 polling_cnt; u8 polling_cnt;
u8 retry_cnt = 0; u8 retry_cnt = 0;
retry: for (retry_cnt = 0; retry_cnt < 3; retry_cnt++) {
request = rtw_read8(rtwdev, rtwdev->hci.rpwm_addr); request = rtw_read8(rtwdev, rtwdev->hci.rpwm_addr);
confirm = rtw_read8(rtwdev, rtwdev->hci.cpwm_addr); confirm = rtw_read8(rtwdev, rtwdev->hci.cpwm_addr);
...@@ -85,8 +85,10 @@ void rtw_power_mode_change(struct rtw_dev *rtwdev, bool enter) ...@@ -85,8 +85,10 @@ void rtw_power_mode_change(struct rtw_dev *rtwdev, bool enter)
rtw_write8(rtwdev, rtwdev->hci.rpwm_addr, request); rtw_write8(rtwdev, rtwdev->hci.rpwm_addr, request);
if (enter)
return;
/* check confirm power mode has left power save state */ /* check confirm power mode has left power save state */
if (!enter) {
for (polling_cnt = 0; polling_cnt < 3; polling_cnt++) { for (polling_cnt = 0; polling_cnt < 3; polling_cnt++) {
polling = rtw_read8(rtwdev, rtwdev->hci.cpwm_addr); polling = rtw_read8(rtwdev, rtwdev->hci.cpwm_addr);
if ((polling ^ confirm) & BIT_RPWM_TOGGLE) if ((polling ^ confirm) & BIT_RPWM_TOGGLE)
...@@ -94,23 +96,18 @@ void rtw_power_mode_change(struct rtw_dev *rtwdev, bool enter) ...@@ -94,23 +96,18 @@ void rtw_power_mode_change(struct rtw_dev *rtwdev, bool enter)
mdelay(20); mdelay(20);
} }
/* in case of fw/hw missed the request, retry 3 times */ /* in case of fw/hw missed the request, retry */
if (retry_cnt < 3) {
rtw_warn(rtwdev, "failed to leave deep PS, retry=%d\n", rtw_warn(rtwdev, "failed to leave deep PS, retry=%d\n",
retry_cnt); retry_cnt);
retry_cnt++;
goto retry;
} }
/* Hit here means that driver failed to change hardware /* Hit here means that driver failed to change hardware power mode to
* power mode to active state after retry 3 times. * active state after retry 3 times. If the power state is locked at
* If the power state is locked at Deep sleep, most of * Deep sleep, most of the hardware circuits is not working, even
* the hardware circuits is not working, even register * register read/write. It should be treated as fatal error and
* read/write. It should be treated as fatal error and
* requires an entire analysis about the firmware/hardware * requires an entire analysis about the firmware/hardware
*/ */
WARN(1, "Hardware power state locked\n"); WARN(1, "Hardware power state locked\n");
}
} }
EXPORT_SYMBOL(rtw_power_mode_change); EXPORT_SYMBOL(rtw_power_mode_change);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment