lockdep_assert_held(&mvm->mutex);
- /* Clean up some internal and mac80211 state on restart */
- if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
+ if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
+ /* Clean up some internal and mac80211 state on restart */
iwl_mvm_restart_cleanup(mvm);
-
+ } else {
+ /* Hold the reference to prevent runtime suspend while
+ * the start procedure runs. It's a bit confusing
+ * that the UCODE_DOWN reference is taken, but it just
+ * means "UCODE is not UP yet". ( TODO: rename this
+ * reference).
+ */
+ iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN);
+ }
ret = iwl_mvm_up(mvm);
if (ret && test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
*/
memset(&mvm->accu_radio_stats, 0, sizeof(mvm->accu_radio_stats));
- /*
- * Disallow low power states when the FW is down by taking
- * the UCODE_DOWN ref. in case of ongoing hw restart the
- * ref is already taken, so don't take it again.
- */
- if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
- iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN);
-
/* async_handlers_wk is now blocked */
/*
memset(&mvm->rx_stats, 0, sizeof(struct mvm_statistics_rx));
- /* rpm starts with a taken ref. only set the appropriate bit here. */
- mvm->refs[IWL_MVM_REF_UCODE_DOWN] = 1;
+ /* rpm starts with a taken reference, we can release it now */
+ iwl_trans_unref(mvm->trans);
iwl_mvm_tof_init(mvm);