Commit 3d530eea authored by Wolfram Sang's avatar Wolfram Sang Committed by Ping-Ke Shih

wifi: rtw89: use 'time_left' variable with wait_for_completion_timeout()

There is a confusing pattern in the kernel to use a variable named 'timeout' to
store the result of wait_for_completion_timeout() causing patterns like:

	timeout = wait_for_completion_timeout(...)
	if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the code
self explaining.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240603091541.8367-6-wsa+renesas@sang-engineering.com
parent a2ead344
...@@ -4054,15 +4054,15 @@ void rtw89_core_update_beacon_work(struct work_struct *work) ...@@ -4054,15 +4054,15 @@ void rtw89_core_update_beacon_work(struct work_struct *work)
int rtw89_wait_for_cond(struct rtw89_wait_info *wait, unsigned int cond) int rtw89_wait_for_cond(struct rtw89_wait_info *wait, unsigned int cond)
{ {
struct completion *cmpl = &wait->completion; struct completion *cmpl = &wait->completion;
unsigned long timeout; unsigned long time_left;
unsigned int cur; unsigned int cur;
cur = atomic_cmpxchg(&wait->cond, RTW89_WAIT_COND_IDLE, cond); cur = atomic_cmpxchg(&wait->cond, RTW89_WAIT_COND_IDLE, cond);
if (cur != RTW89_WAIT_COND_IDLE) if (cur != RTW89_WAIT_COND_IDLE)
return -EBUSY; return -EBUSY;
timeout = wait_for_completion_timeout(cmpl, RTW89_WAIT_FOR_COND_TIMEOUT); time_left = wait_for_completion_timeout(cmpl, RTW89_WAIT_FOR_COND_TIMEOUT);
if (timeout == 0) { if (time_left == 0) {
atomic_set(&wait->cond, RTW89_WAIT_COND_IDLE); atomic_set(&wait->cond, RTW89_WAIT_COND_IDLE);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment