-/*
- * rounded_tv2jif - calculate jiffies from timeval including optional up
- * @tv: pointer to timeval
- *
- * Description:
- * Unlike timeval_to_jiffies() provided in include/linux/jiffies.h, this
- * function is intentionally more relaxed on precise timer ticks to get
- * exact one jiffy for requested 1000us on a 1000HZ machine.
- * This code is to be removed when upgrading to kernel hrtimer.
- *
- * Return:
- * calculated jiffies (max: ULONG_MAX)
- */
-static unsigned long rounded_tv2jif(const struct timeval *tv)
-{
- unsigned long sec = tv->tv_sec;
- unsigned long usec = tv->tv_usec;
- unsigned long jif;
-
- if (sec > ULONG_MAX / HZ)
- return ULONG_MAX;
-
- /* round up to get at least the requested time */
- usec += 1000000 / HZ - 1;
-
- jif = usec / (1000000 / HZ);
-
- if (sec * HZ > ULONG_MAX - jif)
- return ULONG_MAX;
-
- return jif + sec * HZ;
-}
-