linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-kernel@vger.kernel.org
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Arend van Spriel <arend.vanspriel@broadcom.com>,
	Kalle Valo <kvalo@kernel.org>,
	linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev,
	brcm80211-dev-list.pdl@broadcom.com
Subject: [PATCH 2/6] wifi: brcmfmac: use 'time_left' variable with wait_event_timeout()
Date: Mon,  3 Jun 2024 11:15:35 +0200	[thread overview]
Message-ID: <20240603091541.8367-3-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20240603091541.8367-1-wsa+renesas@sang-engineering.com>

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>
---
 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 5fe0e671ecb3..1585a5653ee4 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -4071,7 +4071,7 @@ static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
 	struct cfg80211_wowlan_wakeup *wakeup;
 	u32 wakeind;
 	s32 err;
-	int timeout;
+	long time_left;
 
 	err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
 				       sizeof(wake_ind_le));
@@ -4113,10 +4113,10 @@ static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
 		}
 		if (wakeind & BRCMF_WOWL_PFN_FOUND) {
 			brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_PFN_FOUND\n");
-			timeout = wait_event_timeout(cfg->wowl.nd_data_wait,
-				cfg->wowl.nd_data_completed,
-				BRCMF_ND_INFO_TIMEOUT);
-			if (!timeout)
+			time_left = wait_event_timeout(cfg->wowl.nd_data_wait,
+						       cfg->wowl.nd_data_completed,
+						       BRCMF_ND_INFO_TIMEOUT);
+			if (!time_left)
 				bphy_err(drvr, "No result for wowl net detect\n");
 			else
 				wakeup_data.net_detect = cfg->wowl.nd_info;
-- 
2.43.0


  parent reply	other threads:[~2024-06-03  9:15 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
2024-06-11 18:41   ` Kalle Valo
2024-06-03  9:15 ` Wolfram Sang [this message]
2024-06-03  9:42   ` [PATCH 2/6] wifi: brcmfmac: " 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=20240603091541.8367-3-wsa+renesas@sang-engineering.com \
    --to=wsa+renesas@sang-engineering.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=brcm80211-dev-list.pdl@broadcom.com \
    --cc=brcm80211@lists.linux.dev \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).