From: Eliad Peller Date: Thu, 11 Dec 2014 08:48:18 +0000 (+0200) Subject: iwlwifi: mvm: wait for d0i3 exit on hw restart X-Git-Tag: v4.0-rc1~133^2~10^2~1^2~72 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Flinux.git;a=commitdiff_plain;h=37948fcfd0bef2344df4245f231947cbadb6341a;hp=b0677f71333032c384641b874c26b8871431a009 iwlwifi: mvm: wait for d0i3 exit on hw restart On hw restart, make sure to wait for d0i3 exit (by checking the IN_D0I3 status bit). This is needed in order to avoid the stale d0i3_exit_work from doing harm (e.g. unref cleared reference). Signed-off-by: Eliad Peller Reviewed-by: Gregory Greenman Reviewed-by: Johannes Berg Signed-off-by: Emmanuel Grumbach --- diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 29f0feb1dbd2..9ccecbc588f9 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -972,6 +972,19 @@ static int iwl_mvm_mac_start(struct ieee80211_hw *hw) struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); int ret; + /* Some hw restart cleanups must not hold the mutex */ + if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { + /* + * Make sure we are out of d0i3. This is needed + * to make sure the reference accounting is correct + * (and there is no stale d0i3_exit_work). + */ + wait_event_timeout(mvm->d0i3_exit_waitq, + !test_bit(IWL_MVM_STATUS_IN_D0I3, + &mvm->status), + HZ); + } + mutex_lock(&mvm->mutex); ret = __iwl_mvm_mac_start(mvm); mutex_unlock(&mvm->mutex);