Skip to content

Commit

Permalink
net: ksz884x: use time_before in netdev_open for compatibility and re…
Browse files Browse the repository at this point in the history
…move static variable

use time_before instead of direct compare for compatibility and remove the static next_jiffies variable

Signed-off-by: wudaemon <wudaemon@163.com>
  • Loading branch information
wudaemon authored and intel-lab-lkp committed Feb 28, 2022
1 parent b42a738 commit 5db9da9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/net/ethernet/micrel/ksz884x.c
Expand Up @@ -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)
Expand Down Expand Up @@ -5361,7 +5360,7 @@ static int prepare_hardware(struct net_device *dev)
struct dev_info *hw_priv = priv->adapter;
struct ksz_hw *hw = &hw_priv->hw;
int rc = 0;

unsigned long next_jiffies = 0;
/* Remember the network device that requests interrupts. */
hw_priv->dev = dev;
rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev);
Expand Down Expand Up @@ -5428,7 +5427,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;
Expand Down Expand Up @@ -6566,7 +6565,7 @@ static void mib_read_work(struct work_struct *work)
struct ksz_port_mib *mib;
int i;

next_jiffies = jiffies;
unsigned long next_jiffies = jiffies;
for (i = 0; i < hw->mib_port_cnt; i++) {
mib = &hw->port_mib[i];

Expand Down

0 comments on commit 5db9da9

Please sign in to comment.