Skip to contentSkip to conversation

qlge: Move jiffies_to_usecs immediately before loop

PATCH In review Joe Perches 3 participants 3 messages May 20, 2015 – May 21, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qlge: Move jiffies_to_usecs immediately before loop

30 usecs (or really, 1 jiffy) can go by pretty fast.

Move the set of the timeout immediately before the loop.

Remove the unnecessary max(1ul, usecs_to_jiffies(30)) as usecs_to_jiffies with a non-zero constant is guaranteed to be non-zero.

---
 drivers/net/ethernet/qlogic/qlge/qlge_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/qlogic/qlge/qlge_main.c +1 -3
index 25800a1..02b7115 100644
@@ -3871,9 +3871,6 @@ static int ql_adapter_reset(struct ql_adapter *qdev)
 		return status;
 	}
 
-	end_jiffies = jiffies +
-		max((unsigned long)1, usecs_to_jiffies(30));
-
 	/* Check if bit is set then skip the mailbox command and
 	 * clear the bit, else we are in normal reset process.
 	 */
@@ -3888,6 +3885,7 @@ static int ql_adapter_reset(struct ql_adapter *qdev)
 
 	ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR);
 
+	end_jiffies = jiffies + usecs_to_jiffies(30);
 	do {
 		value = ql_read32(qdev, RST_FO);
 		if ((value & RST_FO_FR) == 0)
Acked-by on v1 1/1
#1 lore raw
Quoted 33 lines

30 usecs (or really, 1 jiffy) can go by pretty fast.

Move the set of the timeout immediately before the loop.

Remove the unnecessary max(1ul, usecs_to_jiffies(30)) as usecs_to_jiffies with a non-zero constant is guaranteed to be non-zero.

---
drivers/net/ethernet/qlogic/qlge/qlge_main.c | 4 +---

1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/qlogic/qlge/qlge_main.c +0 -3
index 25800a1..02b7115 100644
@@ -3871,9 +3871,6 @@ static int ql_adapter_reset(struct ql_adapter *qdev)
 		return status;
 	}
 
-	end_jiffies = jiffies +
-		max((unsigned long)1, usecs_to_jiffies(30));
-
 	/* Check if bit is set then skip the mailbox command and
 	 * clear the bit, else we are in normal reset process.
 	 */

drivers/net/ethernet/qlogic/qlge/qlge_main.c static int ql_adapter_reset(struct ql_adapter *qdev) · line 3891

Quoted 7 lines
drivers/net/ethernet/qlogic/qlge/qlge_main.c +1 -0
@@ -3888,6 +3885,7 @@ static int ql_adapter_reset(struct ql_adapter *qdev)
 
 	ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR);
 
+	end_jiffies = jiffies + usecs_to_jiffies(30);
 	do {
 		value = ql_read32(qdev, RST_FO);
 		if ((value & RST_FO_FR) == 0)

Thanks,
Harish

maintainer
#2 lore raw
In reply to Joe Perches

From: Joe Perches <[email protected]>
Date: Tue, 19 May 2015 21:44:52 -0700

Quoted 9 lines

30 usecs (or really, 1 jiffy) can go by pretty fast.

Move the set of the timeout immediately before the loop.

Remove the unnecessary max(1ul, usecs_to_jiffies(30)) as usecs_to_jiffies with a non-zero constant is guaranteed to be non-zero.

This looks fine, applied to net-next, thanks Joe.