linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers:net:ethernet:emulex:benet: Use time_before_eq for time comparison
@ 2017-04-28  1:48 Karim Eshapa
  2017-05-01  2:34 ` David Miller
  2017-05-01 13:58 ` [PATCH] benet: " Karim Eshapa
  0 siblings, 2 replies; 3+ messages in thread
From: Karim Eshapa @ 2017-04-28  1:48 UTC (permalink / raw)
  To: sathya.perla
  Cc: ajit.khaparde, sriharsha.basavapatna, somnath.kotur, netdev,
	linux-kernel, Karim Eshapa, Karim Eshapa

Use time_before_eq for time comparison more safe and dealing
with timer wrapping to be future-proof.

Signed-off-by: Karim Eshapa <kaim.eshapa@gmail.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 6be3b9a..56d2368 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -5217,15 +5217,15 @@ static bool be_err_is_recoverable(struct be_adapter *adapter)
 	dev_err(&adapter->pdev->dev, "Recoverable HW error code: 0x%x\n",
 		ue_err_code);
 
-	if (jiffies - err_rec->probe_time <= initial_idle_time) {
+	if (time_before_eq(jiffies - err_rec->probe_time, initial_idle_time)) {
 		dev_err(&adapter->pdev->dev,
 			"Cannot recover within %lu sec from driver load\n",
 			jiffies_to_msecs(initial_idle_time) / MSEC_PER_SEC);
 		return false;
 	}
 
-	if (err_rec->last_recovery_time &&
-	    (jiffies - err_rec->last_recovery_time <= recovery_interval)) {
+	if (err_rec->last_recovery_time && time_before_eq(
+		jiffies - err_rec->last_recovery_time, recovery_interval)) {
 		dev_err(&adapter->pdev->dev,
 			"Cannot recover within %lu sec from last recovery\n",
 			jiffies_to_msecs(recovery_interval) / MSEC_PER_SEC);
-- 
2.7.4

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

* Re: [PATCH] drivers:net:ethernet:emulex:benet: Use time_before_eq for time comparison
  2017-04-28  1:48 [PATCH] drivers:net:ethernet:emulex:benet: Use time_before_eq for time comparison Karim Eshapa
@ 2017-05-01  2:34 ` David Miller
  2017-05-01 13:58 ` [PATCH] benet: " Karim Eshapa
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-05-01  2:34 UTC (permalink / raw)
  To: karim.eshapa
  Cc: sathya.perla, ajit.khaparde, sriharsha.basavapatna,
	somnath.kotur, netdev, linux-kernel, kaim.eshapa

From: Karim Eshapa <karim.eshapa@gmail.com>
Date: Fri, 28 Apr 2017 03:48:59 +0200

> Use time_before_eq for time comparison more safe and dealing
> with timer wrapping to be future-proof.
> 
> Signed-off-by: Karim Eshapa <kaim.eshapa@gmail.com>

Subject line has way too many subsystem prefixes, simply
"benet: " is sufficient.

And in situations where multiple subsystem prefixes are
appropriate, one must put a space after each one like
"one: two: three: ".

Thanks.

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

* [PATCH] benet: Use time_before_eq for time comparison
  2017-04-28  1:48 [PATCH] drivers:net:ethernet:emulex:benet: Use time_before_eq for time comparison Karim Eshapa
  2017-05-01  2:34 ` David Miller
@ 2017-05-01 13:58 ` Karim Eshapa
  1 sibling, 0 replies; 3+ messages in thread
From: Karim Eshapa @ 2017-05-01 13:58 UTC (permalink / raw)
  To: sathya.perla
  Cc: ajit.khaparde, sriharsha.basavapatna, somnath.kotur, netdev,
	linux-kernel, Karim Eshapa

Use time_before_eq for time comparison more safe and dealing
with timer wrapping to be future-proof.

Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 6be3b9a..56d2368 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -5217,15 +5217,15 @@ static bool be_err_is_recoverable(struct be_adapter *adapter)
 	dev_err(&adapter->pdev->dev, "Recoverable HW error code: 0x%x\n",
 		ue_err_code);
 
-	if (jiffies - err_rec->probe_time <= initial_idle_time) {
+	if (time_before_eq(jiffies - err_rec->probe_time, initial_idle_time)) {
 		dev_err(&adapter->pdev->dev,
 			"Cannot recover within %lu sec from driver load\n",
 			jiffies_to_msecs(initial_idle_time) / MSEC_PER_SEC);
 		return false;
 	}
 
-	if (err_rec->last_recovery_time &&
-	    (jiffies - err_rec->last_recovery_time <= recovery_interval)) {
+	if (err_rec->last_recovery_time && time_before_eq(
+		jiffies - err_rec->last_recovery_time, recovery_interval)) {
 		dev_err(&adapter->pdev->dev,
 			"Cannot recover within %lu sec from last recovery\n",
 			jiffies_to_msecs(recovery_interval) / MSEC_PER_SEC);
-- 
2.7.4

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

end of thread, other threads:[~2017-05-01 13:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-28  1:48 [PATCH] drivers:net:ethernet:emulex:benet: Use time_before_eq for time comparison Karim Eshapa
2017-05-01  2:34 ` David Miller
2017-05-01 13:58 ` [PATCH] benet: " Karim Eshapa

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