netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e1000: Use time_after() for time comparison
@ 2014-05-22 20:21 Manuel Schölling
  2014-05-22 20:58 ` David Miller
  2014-05-23  9:51 ` Jeff Kirsher
  0 siblings, 2 replies; 3+ messages in thread
From: Manuel Schölling @ 2014-05-22 20:21 UTC (permalink / raw)
  To: jeffrey.t.kirsher
  Cc: e1000-devel, netdev, kernel-janitors, jesse.brandeburg,
	linux-kernel, bruce.w.allan, Manuel Schölling

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(-)

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;
-- 
1.7.10.4


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] e1000: Use time_after() for time comparison
  2014-05-22 20:21 [PATCH] e1000: Use time_after() for time comparison Manuel Schölling
@ 2014-05-22 20:58 ` David Miller
  2014-05-23  9:51 ` Jeff Kirsher
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-05-22 20:58 UTC (permalink / raw)
  To: manuel.schoelling
  Cc: jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan, e1000-devel,
	netdev, linux-kernel, kernel-janitors

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] e1000: Use time_after() for time comparison
  2014-05-22 20:21 [PATCH] e1000: Use time_after() for time comparison Manuel Schölling
  2014-05-22 20:58 ` David Miller
@ 2014-05-23  9:51 ` Jeff Kirsher
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Kirsher @ 2014-05-23  9:51 UTC (permalink / raw)
  To: Manuel Schölling
  Cc: jesse.brandeburg, bruce.w.allan, e1000-devel, netdev,
	linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 450 bytes --]

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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-23  9:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-22 20:21 [PATCH] e1000: Use time_after() for time comparison Manuel Schölling
2014-05-22 20:58 ` David Miller
2014-05-23  9:51 ` Jeff Kirsher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).