mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <zhang.enpei@zte.com.cn>
To: <chessman@tux.org>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] ethernet: tlan: Convert to use jiffies macro
Date: Thu, 7 Aug 2025 20:17:22 +0800 (CST)	[thread overview]
Message-ID: <20250807201722468rYsJszSAHXqlVrVHEIuAz@zte.com.cn> (raw)

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

Use time_after_eq 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..78e439834f26 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_after_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

             reply	other threads:[~2025-08-07 12:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 12:17 zhang.enpei [this message]
2025-08-08 19:52 ` Jakub Kicinski
2025-08-19  8:16 zhang.enpei
2025-08-20  9:29 ` Przemek Kitszel
2025-08-21 22:50 ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250807201722468rYsJszSAHXqlVrVHEIuAz@zte.com.cn \
    --to=zhang.enpei@zte.com.cn \
    --cc=andrew+netdev@lunn.ch \
    --cc=chessman@tux.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®