diff mbox

[1/2] wlcore: Make sure PM calls are paired

Message ID 20180515161315.1997-2-tony@atomide.com (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show

Commit Message

Tony Lindgren May 15, 2018, 4:13 p.m. UTC
The call to wl1271_ps_elp_wakeup() in wl12xx_queue_recovery_work() is
unpaired. Let's remove it and add paired calls to wl1271_recovery_work()
instead in preparation for changing things to use runtime PM.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/net/wireless/ti/wlcore/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Tony Lindgren May 16, 2018, 3:43 p.m. UTC | #1
* Tony Lindgren <tony@atomide.com> [180515 16:15]:
> The call to wl1271_ps_elp_wakeup() in wl12xx_queue_recovery_work() is
> unpaired. Let's remove it and add paired calls to wl1271_recovery_work()
> instead in preparation for changing things to use runtime PM.

Looks like this causes at least a warning at
drivers/net/wireless/ti/wlcore/io.h:66 if recovery triggers.

Regards,

Tony
Tony Lindgren May 16, 2018, 4:17 p.m. UTC | #2
* Tony Lindgren <tony@atomide.com> [180515 16:15]:
> The call to wl1271_ps_elp_wakeup() in wl12xx_queue_recovery_work() is
> unpaired. Let's remove it and add paired calls to wl1271_recovery_work()
> instead in preparation for changing things to use runtime PM.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/net/wireless/ti/wlcore/main.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -796,7 +796,6 @@ void wl12xx_queue_recovery_work(struct wl1271 *wl)
>  
>  		wl->state = WLCORE_STATE_RESTARTING;
>  		set_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags);
> -		wl1271_ps_elp_wakeup(wl);
>  		wlcore_disable_interrupts_nosync(wl);
>  		ieee80211_queue_work(wl->hw, &wl->recovery_work);
>  	}

OK found it, we need to move wlcore_disable_interrupts_nosync(wl) to
wl1271_recovery_work() below also as otherwise wl1271_ps_elp_wakeup()
times out.

Regards,

Tony
diff mbox

Patch

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -796,7 +796,6 @@  void wl12xx_queue_recovery_work(struct wl1271 *wl)
 
 		wl->state = WLCORE_STATE_RESTARTING;
 		set_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags);
-		wl1271_ps_elp_wakeup(wl);
 		wlcore_disable_interrupts_nosync(wl);
 		ieee80211_queue_work(wl->hw, &wl->recovery_work);
 	}
@@ -919,12 +918,17 @@  static void wl1271_recovery_work(struct work_struct *work)
 		container_of(work, struct wl1271, recovery_work);
 	struct wl12xx_vif *wlvif;
 	struct ieee80211_vif *vif;
+	int error;
 
 	mutex_lock(&wl->mutex);
 
 	if (wl->state == WLCORE_STATE_OFF || wl->plt)
 		goto out_unlock;
 
+	error = wl1271_ps_elp_wakeup(wl);
+	if (error < 0)
+		wl1271_warning("Enable for recovery failed");
+
 	if (!test_bit(WL1271_FLAG_INTENDED_FW_RECOVERY, &wl->flags)) {
 		if (wl->conf.fwlog.output == WL12XX_FWLOG_OUTPUT_HOST)
 			wl12xx_read_fwlog_panic(wl);
@@ -967,6 +971,8 @@  static void wl1271_recovery_work(struct work_struct *work)
 	 */
 	wlcore_wake_queues(wl, WLCORE_QUEUE_STOP_REASON_FW_RESTART);
 
+	wl1271_ps_elp_sleep(wl);
+
 out_unlock:
 	wl->watchdog_recovery = false;
 	clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags);