Commit e76e8754 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[TIME]: Put jiffies_to_usecs in time.h

Move local version put in tcp_diag.c into time.h
where it belongs.  Also, make it smarted about HZ
values math.

Based upon suggestions from Joe Perches <joe@Perches.com>
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9c80ee75
......@@ -194,6 +194,18 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
return (j * 1000) / HZ;
#endif
}
static inline unsigned int jiffies_to_usecs(const unsigned long j)
{
#if HZ <= 1000 && !(1000 % HZ)
return (1000000 / HZ) * j;
#elif HZ > 1000 && !(HZ % 1000)
return (j*1000 + (HZ - 1000))/(HZ / 1000);
#else
return (j * 1000000) / HZ;
#endif
}
static inline unsigned long msecs_to_jiffies(const unsigned int m)
{
#if HZ <= 1000 && !(1000 % HZ)
......
......@@ -41,12 +41,6 @@ static struct sock *tcpnl;
rta->rta_len = rtalen; \
RTA_DATA(rta); })
static inline unsigned int jiffies_to_usecs(const unsigned long j)
{
return 1000*jiffies_to_msecs(j);
}
/* Return information about state of tcp endpoint in API format. */
void tcp_get_info(struct sock *sk, struct tcp_info *info)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment