From: Chaitanya T K <chaitanya.mgit@xxxxxxxxx> If we receive suspend after TX path has executed dynamic ps disable work, the driver will be in ACTIVE state during suspend and even after it resumes. As before suspend all data packets are flushed it is safe to put the driver in to sleep for optimal power during suspend or up on resume. Signed-off-by: Chaitanya T K <chaitanya.mgit@xxxxxxxxx> --- net/mac80211/pm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index ac6ad62..c9d71c2 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c @@ -76,6 +76,21 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) if (sdata->vif.type != NL80211_IFTYPE_STATION) continue; ieee80211_mgd_quiesce(sdata); + /* This is to handle a race where suspend + * is invoked after dynamic ps work disables + * power save due to TX. This causes the driver + * to be stuck in ACTIVE during suspend and + * after resume unless there is another TX, + * after which the dynamic ps puts driver + * back to DOZE. + */ + if (sdata->u.mgd.associated && + sdata->u.mgd.powersave && + !(local->hw.conf.flags & IEEE80211_CONF_PS)) { + local->hw.conf.flags |= IEEE80211_CONF_PS; + ieee80211_hw_config(local, + IEEE80211_CONF_CHANGE_PS); + } } err = drv_suspend(local, wowlan); -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html