To avoid raw division, use ktime_to_timeval() to get usec.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
 
 #endif
 
+static inline s64 ktime_to_us(const ktime_t kt)
+{
+       struct timeval tv = ktime_to_timeval(kt);
+       return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
+}
+
 /*
  * The resolution of the clocks. The resolution value is returned in
  * the clock_getres() system call to give application programmers an
 
 
        ca->acked = pkts_acked;
 
-       rtt = ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC;
+       rtt = ktime_to_us(net_timedelta(last));
 
        /* ignore bogus values, this prevents wraparound in alpha math */
        if (rtt > RTT_MAX)
 
        struct tcp_sock *tp = tcp_sk(sk);
        struct lp *lp = inet_csk_ca(sk);
 
-       tcp_lp_rtt_sample(sk,  ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC);
+       tcp_lp_rtt_sample(sk,  ktime_to_us(net_timedelta(last)));
 
        /* calc inference */
        if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
 
        u32 vrtt;
 
        /* Never allow zero rtt or baseRTT */
-       vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1;
+       vrtt = ktime_to_us(net_timedelta(last)) + 1;
 
        /* Filter to find propagation delay: */
        if (vrtt < vegas->baseRTT)
 
        u32 vrtt;
 
        /* Never allow zero rtt or baseRTT */
-       vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1;
+       vrtt = ktime_to_us(net_timedelta(last)) + 1;
 
        /* Filter to find propagation delay: */
        if (vrtt < veno->basertt)