Re: V4L2 drivers: potentially dangerous and inefficient msecs_to_jiffies() calculation

2009-09-19 Thread Andreas Mohr
Hi, On Tue, Sep 15, 2009 at 09:21:46PM +0200, Andreas Mohr wrote: Hi, On Tue, Sep 15, 2009 at 09:14:19PM +0200, Marcin Slusarz wrote: Or better: frame_timeout * HZ D'oh! ;-) But then what about the other 3 bazillion places in the kernel doing multiples of seconds? linux-2.6.31]$

Re: V4L2 drivers: potentially dangerous and inefficient msecs_to_jiffies() calculation

2009-09-15 Thread Marcin Slusarz
Andreas Mohr pisze: Hi all, ./drivers/media/video/sn9c102/sn9c102_core.c , ./drivers/media/video/et61x251/et61x251_core.c and ./drivers/media/video/zc0301/zc0301_core.c do cam-module_param.frame_timeout * 1000 * msecs_to_jiffies(1)

Re: V4L2 drivers: potentially dangerous and inefficient msecs_to_jiffies() calculation

2009-09-15 Thread Andreas Mohr
Hi, On Tue, Sep 15, 2009 at 09:14:19PM +0200, Marcin Slusarz wrote: Andreas Mohr pisze: ./drivers/media/video/zc0301/zc0301_core.c do cam-module_param.frame_timeout * 1000 * msecs_to_jiffies(1) ); multiple times each. What they

Re: V4L2 drivers: potentially dangerous and inefficient msecs_to_jiffies() calculation

2009-09-14 Thread Jiri Slaby
On 09/14/2009 11:07 PM, Andreas Mohr wrote: ./drivers/media/video/zc0301/zc0301_core.c do cam-module_param.frame_timeout * 1000 * msecs_to_jiffies(1) ); multiple times each. What they should do instead is frame_timeout *

Re: V4L2 drivers: potentially dangerous and inefficient msecs_to_jiffies() calculation

2009-09-14 Thread Andreas Mohr
Hi, On Mon, Sep 14, 2009 at 11:34:40PM +0200, Jiri Slaby wrote: On 09/14/2009 11:07 PM, Andreas Mohr wrote: ./drivers/media/video/zc0301/zc0301_core.c do cam-module_param.frame_timeout * 1000 * msecs_to_jiffies(1) ); multiple

Re: V4L2 drivers: potentially dangerous and inefficient msecs_to_jiffies() calculation

2009-09-14 Thread Trent Piepho
On Mon, 14 Sep 2009, Andreas Mohr wrote: cam-module_param.frame_timeout * 1000 * msecs_to_jiffies(1) ); multiple times each. What they should do instead is frame_timeout * msecs_to_jiffies(1000), I'd think. msecs_to_jiffies(1) is quite

Re: V4L2 drivers: potentially dangerous and inefficient msecs_to_jiffies() calculation

2009-09-14 Thread Jiri Slaby
On 09/14/2009 11:39 PM, Andreas Mohr wrote: On Mon, Sep 14, 2009 at 11:34:40PM +0200, Jiri Slaby wrote: On 09/14/2009 11:07 PM, Andreas Mohr wrote: msecs_to_jiffies(1) is quite a bit too boldly assuming that all of the msecs_to_jiffies(x) implementation branches always round up. They do,

Re: V4L2 drivers: potentially dangerous and inefficient msecs_to_jiffies() calculation

2009-09-14 Thread Andreas Mohr
On Mon, Sep 14, 2009 at 11:50:50PM +0200, Jiri Slaby wrote: A potential problem here is rather that it may wait longer due to returning 1 jiffie. It's then timeout * 1000 * 1. On 250HZ system it makes a difference of multiple of 4. Don't think it's a real issue in those drivers at all, but