diff mbox

e1000: Use time_after() for time comparison

Message ID 1400790090-13404-1-git-send-email-manuel.schoelling@gmx.de
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Manuel Schölling May 22, 2014, 8:21 p.m. UTC
To be future-proof and for better readability the time comparisons are modified
to use time_after() instead of plain, error-prone math.

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
---
 drivers/net/ethernet/intel/e1000/e1000_ethtool.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Miller May 22, 2014, 8:58 p.m. UTC | #1
From: Manuel Schölling <manuel.schoelling@gmx.de>
Date: Thu, 22 May 2014 22:21:30 +0200

> To be future-proof and for better readability the time comparisons are modified
> to use time_after() instead of plain, error-prone math.
> 
> Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>

I'll let Jeff pick this up in his tree.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kirsher, Jeffrey T May 23, 2014, 9:51 a.m. UTC | #2
On Thu, 2014-05-22 at 22:21 +0200, Manuel Schölling wrote:
> To be future-proof and for better readability the time comparisons are
> modified
> to use time_after() instead of plain, error-prone math.
> 
> Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
> ---
>  drivers/net/ethernet/intel/e1000/e1000_ethtool.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Thanks Manuel, I have added your patch to my queue.
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 73a8aee..1cbf281 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -1460,7 +1460,8 @@  static int e1000_run_loopback_test(struct e1000_adapter *adapter)
 			 * enough time to complete the receives, if it's
 			 * exceeded, break and error off
 			 */
-		} while (good_cnt < 64 && jiffies < (time + 20));
+		} while (good_cnt < 64 && time_after(time + 20, jiffies));
+
 		if (good_cnt != 64) {
 			ret_val = 13; /* ret_val is the same as mis-compare */
 			break;