lkml.org 
[lkml]   [2021]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 13/19] staging: qlge: rewrite do while loop as for loop in qlge_sem_spinlock
Date
Since wait_count=30 > 0, the for loop is equivalent to do while
loop. This commit also replaces 100 with UDELAY_DELAY.

Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
---
drivers/staging/qlge/qlge_main.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index c5e161595b1f..2d2405be38f5 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -140,12 +140,13 @@ static int qlge_sem_trylock(struct qlge_adapter *qdev, u32 sem_mask)
int qlge_sem_spinlock(struct qlge_adapter *qdev, u32 sem_mask)
{
unsigned int wait_count = 30;
+ int count;

- do {
+ for (count = 0; count < wait_count; count++) {
if (!qlge_sem_trylock(qdev, sem_mask))
return 0;
- udelay(100);
- } while (--wait_count);
+ udelay(UDELAY_DELAY);
+ }
return -ETIMEDOUT;
}

--
2.32.0
\
 
 \ /
  Last update: 2021-06-21 15:51    [W:0.069 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site