Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Mar 2015 12:43:55 +0100
From:      =?UTF-8?B?xYF1a2FzeiBXw7NqY2lr?= <lukasz.wojcik@zoho.com>
To:        fjoe@freebsd.org, freebsd-ports@freebsd.org
Subject:   Bug (?) in dahdi
Message-ID:  <54F992FB.401@zoho.com>

next in thread | raw e-mail | index | archive | help
Hello,

I am currently working on sponsored project to upgrade dahdi to support
some of newer Digium cards (namely TE235). During porting, I've noticed
the following definition (in linux.h):

#define msecs_to_jiffies(msec)	((msec) / 1000 / HZ)

I believe it is a bug. It may introduce some discrete problems
(time-triggered). Unless I'm mistaken, linux' 'jiffies' is the same as
system ticks. Therefore we want to get a number of system ticks that
would 'happen' in 'msec' time. Given equation will always give 0
(rounded to integer), unless msec > 1000* HZ.

I believe that formula should be:

#define msecs_to_jiffies(msec)	((msec) * 1000 / HZ)

But it could also be improved to secure some corner cases, e.g. like this:

https://searchcode.com/codesearch/view/429809/

Am I missing something, or is it a bug ?

Regards,
-ŁW




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54F992FB.401>