[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1487661214.2853.14.camel@perches.com>
Date: Mon, 20 Feb 2017 23:13:34 -0800
From: Joe Perches <joe@...ches.com>
To: fgao@...ai8.com, davem@...emloft.net, edumazet@...gle.com,
soheil@...gle.com, netdev@...r.kernel.org, gfree.wind@...il.com
Subject: Re: [PATCH net-next 1/1] net: sock: Use USEC_PER_SEC macro instead
of literal 1000000
On Mon, 2017-02-20 at 22:33 +0800, fgao@...ai8.com wrote:
> From: Gao Feng <fgao@...ai8.com>
>
> The USEC_PER_SEC is used once in sock_set_timeout as the max value of
> tv_usec. But there are other similar codes which use the literal
> 1000000 in this file.
> It is minor cleanup to keep consitent.
[]
> diff --git a/net/core/sock.c b/net/core/sock.c
[]
> @@ -367,7 +367,7 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
> if (tv.tv_sec == 0 && tv.tv_usec == 0)
> return 0;
> if (tv.tv_sec < (MAX_SCHEDULE_TIMEOUT/HZ - 1))
> - *timeo_p = tv.tv_sec*HZ + (tv.tv_usec+(1000000/HZ-1))/(1000000/HZ);
> + *timeo_p = tv.tv_sec * HZ + (tv.tv_usec + (USEC_PER_SEC / HZ - 1)) / (USEC_PER_SEC / HZ);
Maybe convert this to DIV_ROUND_UP one day too?
*timeo_p = tv.tv_sec * HZ + DIV_ROUND_UP(tv.tv_usec, USEC_PER_SEC / HZ);
Powered by blists - more mailing lists