Messages in this thread Patch in this message | | | Date | Tue, 22 Feb 2022 11:39:42 -0800 | From | Jakub Kicinski <> | Subject | Re: [PATCH] net: ksz884x: use time_before in netdev_open for compatibility |
| |
On Sun, 20 Feb 2022 12:21:01 +0000 wudaemon wrote: > use time_before instead of direct compare for compatibility > > Signed-off-by: wudaemon <wudaemon@163.com> > --- > drivers/net/ethernet/micrel/ksz884x.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c > index d024983815da..fd3cb9ce438f 100644 > --- a/drivers/net/ethernet/micrel/ksz884x.c > +++ b/drivers/net/ethernet/micrel/ksz884x.c > @@ -5428,7 +5428,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;
I think this code is trying to space out the updates in time. So neither way of doing the comparison seems great. It'd be better to remove the static next_jiffies variable, and just do something more akin to what mib_read_work() does in open() as well.
| |