netdev
[Top] [All Lists]

Re: [PATCH] Consolidate multiple implementations of jiffies-msecs conver

To: Sridhar Samudrala <sri@xxxxxxxxxx>
Subject: Re: [PATCH] Consolidate multiple implementations of jiffies-msecs conversions.
From: Edgar Toernig <froese@xxxxxx>
Date: Fri, 26 Mar 2004 01:44:03 +0100
Cc: davem@xxxxxxxxxx, jgarzik@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <Pine.LNX.4.58.0403251142110.3037@localhost.localdomain>
References: <Pine.LNX.4.58.0403251142110.3037@localhost.localdomain>
Sender: netdev-bounce@xxxxxxxxxxx
Sridhar Samudrala wrote:
> 
> The following patch to 2.6.5-rc2 consolidates 6 different implementations
> of msecs to jiffies and 3 different implementation of jiffies to msecs.
> All of them now use the generic msecs_to_jiffies() and jiffies_to_msecs()
> that are added to include/linux/time.h
>[...]
> -#define MSECS(ms)  (((ms)*HZ/1000)+1)
> -return (((ms)*HZ+999)/1000);
> +return (msecs / 1000) * HZ + (msecs % 1000) * HZ / 1000;

Did you check that all users of the new version will work correctly
with your rounding?  Explicit round-up of delays is often required,
especially when talking to hardware...

Ciao, ET.

<Prev in Thread] Current Thread [Next in Thread>