All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ethernet: tlan: Convert to use jiffies macro
@ 2025-08-27  7:54 zhang.enpei
  2025-08-27 22:22 ` Jacob Keller
  2025-08-28 17:27 ` Simon Horman
  0 siblings, 2 replies; 3+ messages in thread
From: zhang.enpei @ 2025-08-27  7:54 UTC (permalink / raw)
  To: chessman; +Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

From: Zhang Enpei <zhang.enpei@zte.com.cn>

Use time_is_before_eq_jiffies macro instead of using jiffies directly to
handle wraparound.

Signed-off-by: Zhang Enpei <zhang.enpei@zte.com.cn>
---
 drivers/net/ethernet/ti/tlan.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
index a55b0f951181..7c5e51284942 100644
--- a/drivers/net/ethernet/ti/tlan.c
+++ b/drivers/net/ethernet/ti/tlan.c
@@ -1817,7 +1817,6 @@ static void tlan_timer(struct timer_list *t)
 {
 	struct tlan_priv	*priv = timer_container_of(priv, t, timer);
 	struct net_device	*dev = priv->dev;
-	u32		elapsed;
 	unsigned long	flags = 0;

 	priv->timer.function = NULL;
@@ -1844,8 +1843,7 @@ static void tlan_timer(struct timer_list *t)
 	case TLAN_TIMER_ACTIVITY:
 		spin_lock_irqsave(&priv->lock, flags);
 		if (priv->timer.function == NULL) {
-			elapsed = jiffies - priv->timer_set_at;
-			if (elapsed >= TLAN_TIMER_ACT_DELAY) {
+			if (time_is_before_eq_jiffies(priv->timer_set_at + TLAN_TIMER_ACT_DELAY)) {
 				tlan_dio_write8(dev->base_addr,
 						TLAN_LED_REG, TLAN_LED_LINK);
 			} else  {
-- 
2.25.1

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

end of thread, other threads:[~2025-08-28 17:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-27  7:54 [PATCH v3] ethernet: tlan: Convert to use jiffies macro zhang.enpei
2025-08-27 22:22 ` Jacob Keller
2025-08-28 17:27 ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.