Re: [PATCH 19/34]: include/jiffies: add usecs_to_jiffies() function

From: Makhlis, Lev
Date: Thu Feb 03 2005 - 11:14:37 EST


Nishanth Aravamudan <nacc@xxxxxxxxxx> wrote:

> +static inline unsigned long usecs_to_jiffies(const unsigned int u)
> +{
> + if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET))
> + return MAX_JIFFY_OFFSET;
> +#if HZ <= 1000 && !(1000 % HZ)
> + return (u + (1000000 / HZ) - 1000) / (1000000 / HZ);
> +#elif HZ > 1000 && !(HZ % 1000)
> + return u * (HZ / 1000000);
> +#else
> + return (u * HZ + 999999) / 1000000;
> +#endif
> +}

Shouldn't this use 1000000 instead of 1000 everywhere?
It returns 0 if HZ=10000.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/