summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2022-04-09 18:32:10 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-12 15:49:58 +0200
commitefe20b73c5caefa68509ad076d4f6459c4a17420 (patch)
tree88fd352e913f8731227806466dd47f903c6d6257
parent11788aac9228875cac0a6b1a303521fe47115d24 (diff)
downloadlinux-efe20b73c5caefa68509ad076d4f6459c4a17420.tar.bz2
staging: r8188eu: improve timeout handling in iol_execute
Use the standard kernel functions to define and check the timeout in iol_execute. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20220409163212.241122-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/r8188eu/hal/rtl8188e_hal_init.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
index 609138887b25..efdadfb61905 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
@@ -33,17 +33,16 @@ static s32 iol_execute(struct adapter *padapter, u8 control)
{
s32 status = _FAIL;
u8 reg_0x88 = 0;
- u32 start = 0, passing_time = 0;
+ unsigned long timeout;
control = control & 0x0f;
reg_0x88 = rtw_read8(padapter, REG_HMEBOX_E0);
rtw_write8(padapter, REG_HMEBOX_E0, reg_0x88 | control);
- start = jiffies;
+ timeout = jiffies + msecs_to_jiffies(1000);
while ((reg_0x88 = rtw_read8(padapter, REG_HMEBOX_E0)) & control &&
- (passing_time = rtw_get_passing_time_ms(start)) < 1000) {
+ time_before(jiffies, timeout))
;
- }
reg_0x88 = rtw_read8(padapter, REG_HMEBOX_E0);
status = (reg_0x88 & control) ? _FAIL : _SUCCESS;