]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: rtw89: use 'time_left' variable with wait_for_completion_timeout()
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 3 Jun 2024 09:15:38 +0000 (11:15 +0200)
committerPing-Ke Shih <pkshih@realtek.com>
Mon, 17 Jun 2024 02:01:13 +0000 (10:01 +0800)
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: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240603091541.8367-6-wsa+renesas@sang-engineering.com
drivers/net/wireless/realtek/rtw89/core.c

index 3e99b63a7995951556570a6162b643f517dfa26f..fe403fb7e8a2269285a25013a36f6a9f0ff045c9 100644 (file)
@@ -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)
 {
        struct completion *cmpl = &wait->completion;
-       unsigned long timeout;
+       unsigned long time_left;
        unsigned int cur;
 
        cur = atomic_cmpxchg(&wait->cond, RTW89_WAIT_COND_IDLE, cond);
        if (cur != RTW89_WAIT_COND_IDLE)
                return -EBUSY;
 
-       timeout = wait_for_completion_timeout(cmpl, RTW89_WAIT_FOR_COND_TIMEOUT);
-       if (timeout == 0) {
+       time_left = wait_for_completion_timeout(cmpl, RTW89_WAIT_FOR_COND_TIMEOUT);
+       if (time_left == 0) {
                atomic_set(&wait->cond, RTW89_WAIT_COND_IDLE);
                return -ETIMEDOUT;
        }