Skip to contentSkip to conversation

iwlwifi: mvm: adding check if the thermal firmware is running

PATCH RESEND Superseded Guilherme Giacomo Simoes 2 participants 3 messages Jun 5, 2024 Intel wireless wifi link (iwlwifi)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 iwlwifi: mvm: adding check if the thermal firmware is running

In the dmesg is showing the message "failed to read out thermal zone" as if the temperature read is failed by don't find the thermal zone.

After researching and debugging, I see that this specific error is occurrenced because the thermal try read the temperature when is started, but the firmware is not running yet.

For more legibiliti i change the tt.c for return EAGAIN when this was occurrence. After this change, in my computer I compile and install kernel in /boot and in my dmesg the message "failed to read out thermal zone" is not show any more.

I would like to thanks for Rafael Wysocki <[email protected]> and Kalle Valo <[email protected]> for your suggestions in my first patch.

---
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tt.c +8 -2
index 8083c4b2ab6b..68ab9966330c 100644
@@ -620,8 +620,14 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
 
 	mutex_lock(&mvm->mutex);
 
-	if (!iwl_mvm_firmware_running(mvm) ||
-	    mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) {
+	const int res = iwl_mvm_firmware_running(mvm);
+
+	if (!res) {
+		ret = -EAGAIN;
+		goto out;
+	}
+
+	if (mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) {
 		ret = -ENODATA;
 		goto out;
 	}
Signature · 1 line
2.45.2
#1 lore raw
Quoted 25 lines · Guilherme Giacomo Simoes

In the dmesg is showing the message "failed to read out thermal zone" as if the temperature read is failed by don't find the thermal zone.

After researching and debugging, I see that this specific error is occurrenced because the thermal try read the temperature when is started, but the firmware is not running yet.

For more legibiliti i change the tt.c for return EAGAIN when this was occurrence. After this change, in my computer I compile and install kernel in /boot and in my dmesg the message "failed to read out thermal zone" is not show any more.

I would like to thanks for Rafael Wysocki <[email protected]> and Kalle Valo <[email protected]> for your suggestions in my first patch.

---
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tt.c +0 -0
index 8083c4b2ab6b..68ab9966330c 100644

drivers/net/wireless/intel/iwlwifi/mvm/tt.c static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device, · line 623

Quoted 6 lines
drivers/net/wireless/intel/iwlwifi/mvm/tt.c +1 -2
@@ -620,8 +620,14 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
 
 	mutex_lock(&mvm->mutex);
 
-	if (!iwl_mvm_firmware_running(mvm) ||
-	    mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) {
+	const int res = iwl_mvm_firmware_running(mvm);

const is useless, but you should not have variable declarations in the middle of the function (per kernel convention)

johannes

#2 lore raw

Johannes Berg <[email protected]> write:

Quoted 30 lines · Guilherme Giacomo Simoes
Quoted 28 lines

In the dmesg is showing the message "failed to read out thermal zone" as if the temperature read is failed by don't find the thermal zone.

After researching and debugging, I see that this specific error is occurrenced because the thermal try read the temperature when is started, but the firmware is not running yet.

For more legibiliti i change the tt.c for return EAGAIN when this was occurrence. After this change, in my computer I compile and install kernel in /boot and in my dmesg the message "failed to read out thermal zone" is not show any more.

I would like to thanks for Rafael Wysocki <[email protected]> and Kalle Valo <[email protected]> for your suggestions in my first patch.

---
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tt.c +0 -0
index 8083c4b2ab6b..68ab9966330c 100644
@@ -620,8 +620,14 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
 
      mutex_lock(&mvm->mutex);
 
Quoted 9 lines

drivers/net/wireless/intel/iwlwifi/mvm/tt.c static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device, · line 623

Quoted 3 lines
drivers/net/wireless/intel/iwlwifi/mvm/tt.c +1 -2
-     if (!iwl_mvm_firmware_running(mvm) ||
-         mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) {
+     const int res = iwl_mvm_firmware_running(mvm);

const is useless, but you should not have variable declarations in the middle of the function (per kernel convention)

johannes

I really appreciate your suggestions. I sended a new v3 patch without the "const" keyword.