From: wudaemon <wudaemon@163.com>
To: davem@davemloft.net, kuba@kernel.org, m.grzeschik@pengutronix.de,
chenhao288@hisilicon.com, arnd@arndb.de
Cc: wudaemon@163.com, shenyang39@huawei.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v3] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable
Date: Tue, 1 Mar 2022 15:18:08 +0000 [thread overview]
Message-ID: <20220301151808.2855-1-wudaemon@163.com> (raw)
use time_before instead of direct compare for compatibility and remove the static next_jiffies variable
Signed-off-by: wudaemon <wudaemon@163.com>
---
drivers/net/ethernet/micrel/ksz884x.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index d024983815da..ce4f5c99c1ac 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -5225,7 +5225,6 @@ static irqreturn_t netdev_intr(int irq, void *dev_id)
* Linux network device functions
*/
-static unsigned long next_jiffies;
#ifdef CONFIG_NET_POLL_CONTROLLER
static void netdev_netpoll(struct net_device *dev)
@@ -5411,10 +5410,12 @@ static int netdev_open(struct net_device *dev)
struct dev_info *hw_priv = priv->adapter;
struct ksz_hw *hw = &hw_priv->hw;
struct ksz_port *port = &priv->port;
+ unsigned long next_jiffies;
int i;
int p;
int rc = 0;
+ next_jiffies = jiffies;
priv->multicast = 0;
priv->promiscuous = 0;
@@ -5428,7 +5429,7 @@ static int netdev_open(struct net_device *dev)
if (rc)
return rc;
for (i = 0; i < hw->mib_port_cnt; i++) {
- if (next_jiffies < jiffies)
+ if (time_before(next_jiffies, jiffies))
next_jiffies = jiffies + HZ * 2;
else
next_jiffies += HZ * 1;
@@ -6563,6 +6564,7 @@ static void mib_read_work(struct work_struct *work)
struct dev_info *hw_priv =
container_of(work, struct dev_info, mib_read);
struct ksz_hw *hw = &hw_priv->hw;
+ unsigned long next_jiffies;
struct ksz_port_mib *mib;
int i;
--
2.25.1
next reply other threads:[~2022-03-01 15:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 15:18 wudaemon [this message]
2022-03-05 5:49 ` 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=20220301151808.2855-1-wudaemon@163.com \
--to=wudaemon@163.com \
--cc=arnd@arndb.de \
--cc=chenhao288@hisilicon.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.grzeschik@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=shenyang39@huawei.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®