[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a1cd16d2-1fbc-6543-c17c-a321ac72a2f3@gmail.com>
Date: Fri, 17 May 2024 12:57:37 -0400
From: Jonathan Bither <jonbither@...il.com>
To: Guilherme Giacomo Simoes <trintaeoitogc@...il.com>,
miriam.rachel.korenblit@...el.com, kvalo@...nel.org,
rafael.j.wysocki@...el.com, daniel.lezcano@...aro.org,
johannes.berg@...el.com, dmantipov@...dex.ru
Cc: linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] thermal: adding check if the thermal firmware is running
On 5/17/24 10:16, Guilherme Giacomo Simoes wrote:
> 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 <refael.j.wysocki@...el.com> for
> your suggestions in mu first patch that results in this another patch.
> ---
> drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
> index 8083c4b2ab6b..68ab9966330c 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
> @@ -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;
> + }
> +
You could skip using the res variable and move the mutex lock here and
simplify the above a bit. Ex:
int temp;
- mutex_lock(&mvm->mutex);
+ if (!iwl_mvm_firmware_running(mvm))
+ return -EAGAIN;
- if (!iwl_mvm_firmware_running(mvm) ||
- mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) {
+ mutex_lock(&mvm->mutex);
+ if (mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) {
ret = -ENODATA;
goto out;
}
> + if (mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) {
> ret = -ENODATA;
> goto out;
> }
Powered by blists - more mailing lists