From: Kalle Valo <kvalo@kernel.org>
To: Jeff Johnson <quic_jjohnson@quicinc.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
<linux-kernel@vger.kernel.org>,
Jeff Johnson <jjohnson@kernel.org>,
<linux-wireless@vger.kernel.org>, <ath11k@lists.infradead.org>
Subject: Re: [PATCH 1/6] wifi: ath11k: use 'time_left' variable with wait_event_timeout()
Date: Tue, 04 Jun 2024 20:11:10 +0300 [thread overview]
Message-ID: <87r0dcskep.fsf@kernel.org> (raw)
In-Reply-To: <47cc9455-6efb-4b1c-8743-c992e502633d@quicinc.com> (Jeff Johnson's message of "Mon, 3 Jun 2024 15:57:28 -0700")
Jeff Johnson <quic_jjohnson@quicinc.com> writes:
> On 6/3/2024 2:15 AM, Wolfram Sang wrote:
>
>> There is a confusing pattern in the kernel to use a variable named 'timeout' to
>> store the result of wait_event_timeout() causing patterns like:
>>
>> timeout = wait_event_timeout(...)
>> if (!timeout) return -ETIMEDOUT;
>>
>> with all kinds of permutations. Use 'time_left' as a variable to make the code
>> self explaining.
>>
>> Fix to the proper variable type 'long' while here.
>>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>> ---
>> drivers/net/wireless/ath/ath11k/qmi.c | 20 ++++++++++----------
>> 1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
>> index d4a243b64f6c..2fe0ef660456 100644
>> --- a/drivers/net/wireless/ath/ath11k/qmi.c
>> +++ b/drivers/net/wireless/ath/ath11k/qmi.c
>> @@ -2859,7 +2859,7 @@ int ath11k_qmi_firmware_start(struct ath11k_base *ab,
>>
>> int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab)
>> {
>> - int timeout;
>> + long time_left;
>>
>> if (!ath11k_core_coldboot_cal_support(ab) ||
>> ab->hw_params.cbcal_restart_fw == 0)
>> @@ -2867,11 +2867,11 @@ int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab)
>>
>> ath11k_dbg(ab, ATH11K_DBG_QMI, "wait for cold boot done\n");
>>
>> - timeout = wait_event_timeout(ab->qmi.cold_boot_waitq,
>> - (ab->qmi.cal_done == 1),
>> - ATH11K_COLD_BOOT_FW_RESET_DELAY);
>> + time_left = wait_event_timeout(ab->qmi.cold_boot_waitq,
>> + (ab->qmi.cal_done == 1),
>> + ATH11K_COLD_BOOT_FW_RESET_DELAY);
>>
>> - if (timeout <= 0) {
>> + if (time_left <= 0) {
>> ath11k_warn(ab, "Coldboot Calibration timed out\n");
>> return -ETIMEDOUT;
>> }
>> @@ -2886,7 +2886,7 @@ EXPORT_SYMBOL(ath11k_qmi_fwreset_from_cold_boot);
>>
>> static int ath11k_qmi_process_coldboot_calibration(struct ath11k_base *ab)
>> {
>> - int timeout;
>> + long time_left;
>> int ret;
>>
>> ret = ath11k_qmi_wlanfw_mode_send(ab, ATH11K_FIRMWARE_MODE_COLD_BOOT);
>> @@ -2897,10 +2897,10 @@ static int ath11k_qmi_process_coldboot_calibration(struct ath11k_base *ab)
>>
>> ath11k_dbg(ab, ATH11K_DBG_QMI, "Coldboot calibration wait started\n");
>>
>> - timeout = wait_event_timeout(ab->qmi.cold_boot_waitq,
>> - (ab->qmi.cal_done == 1),
>> - ATH11K_COLD_BOOT_FW_RESET_DELAY);
>> - if (timeout <= 0) {
>> + time_left = wait_event_timeout(ab->qmi.cold_boot_waitq,
>> + (ab->qmi.cal_done == 1),
>> + ATH11K_COLD_BOOT_FW_RESET_DELAY);
>> + if (time_left <= 0) {
>> ath11k_warn(ab, "coldboot calibration timed out\n");
>> return 0;
>> }
>
> This looks ok to me, but note that changes to ath11k go through the ath tree,
> so, unless Kalle has a different opinion, this should be submitted separately
> from changes that go through the wireless tree.
As there are no dependencies to other patches I can take this directly
to ath.git, so no need to resend because of this.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2024-06-04 17:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-03 9:15 [PATCH 0/6] net: use 'time_left' instead of 'timeout' with wait_*() functions Wolfram Sang
2024-06-03 9:15 ` [PATCH 1/6] wifi: ath11k: use 'time_left' variable with wait_event_timeout() Wolfram Sang
2024-06-03 22:57 ` Jeff Johnson
2024-06-04 17:11 ` Kalle Valo [this message]
2024-06-11 18:41 ` Kalle Valo
2024-06-03 9:15 ` [PATCH 2/6] wifi: brcmfmac: " Wolfram Sang
2024-06-03 9:42 ` Arend van Spriel
2024-06-03 13:15 ` Wolfram Sang
2024-06-12 12:01 ` Kalle Valo
2024-06-03 9:15 ` [PATCH 3/6] wifi: mac80211: use 'time_left' variable with wait_for_completion_timeout() Wolfram Sang
2024-06-05 12:54 ` Kalle Valo
2024-06-06 10:23 ` Wolfram Sang
2024-06-03 9:15 ` [PATCH 4/6] wifi: p54: use 'time_left' variable with wait_for_completion_interruptible_timeout() Wolfram Sang
2024-06-03 9:15 ` [PATCH 5/6] wifi: rtw89: use 'time_left' variable with wait_for_completion_timeout() Wolfram Sang
2024-06-04 0:35 ` Ping-Ke Shih
2024-06-04 8:13 ` Kalle Valo
2024-06-04 8:57 ` Ping-Ke Shih
2024-06-17 2:07 ` Ping-Ke Shih
2024-06-03 9:15 ` [PATCH 6/6] wifi: zd1211rw: " Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r0dcskep.fsf@kernel.org \
--to=kvalo@kernel.org \
--cc=ath11k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_jjohnson@quicinc.com \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.