]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/intel/iwlwifi/mvm/tt.c
Merge tag 'iwlwifi-next-for-kalle-2017-06-06' of git://git.kernel.org/pub/scm/linux...
[karo-tx-linux.git] / drivers / net / wireless / intel / iwlwifi / mvm / tt.c
index 506d58104e1cc007ba9d767a16dd77f9df8f0481..453a785a3ea5e91a8a68a475aa2c6a6b1d8f1ff2 100644 (file)
@@ -628,7 +628,8 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
 
        mutex_lock(&mvm->mutex);
 
-       if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR)) {
+       if (!iwl_mvm_firmware_running(mvm) ||
+           mvm->cur_ucode != IWL_UCODE_REGULAR) {
                ret = -EIO;
                goto out;
        }
@@ -678,7 +679,8 @@ static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device,
 
        mutex_lock(&mvm->mutex);
 
-       if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR)) {
+       if (!iwl_mvm_firmware_running(mvm) ||
+           mvm->cur_ucode != IWL_UCODE_REGULAR) {
                ret = -EIO;
                goto out;
        }
@@ -792,7 +794,8 @@ static int iwl_mvm_tcool_set_cur_state(struct thermal_cooling_device *cdev,
 
        mutex_lock(&mvm->mutex);
 
-       if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR)) {
+       if (!iwl_mvm_firmware_running(mvm) ||
+           mvm->cur_ucode != IWL_UCODE_REGULAR) {
                ret = -EIO;
                goto unlock;
        }
@@ -884,10 +887,14 @@ void iwl_mvm_thermal_initialize(struct iwl_mvm *mvm, u32 min_backoff)
        iwl_mvm_cooling_device_register(mvm);
        iwl_mvm_thermal_zone_register(mvm);
 #endif
+       mvm->init_status |= IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE;
 }
 
 void iwl_mvm_thermal_exit(struct iwl_mvm *mvm)
 {
+       if (!(mvm->init_status & IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE))
+               return;
+
        cancel_delayed_work_sync(&mvm->thermal_throttle.ct_kill_exit);
        IWL_DEBUG_TEMP(mvm, "Exit Thermal Throttling\n");
 
@@ -895,4 +902,5 @@ void iwl_mvm_thermal_exit(struct iwl_mvm *mvm)
        iwl_mvm_cooling_device_unregister(mvm);
        iwl_mvm_thermal_zone_unregister(mvm);
 #endif
+       mvm->init_status &= ~IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE;
 }