lkml.org 
[lkml]   [2022]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2022-02-22 20:39    [W:0.052 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site