[lkml]   [2009]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] add function spin_event_timeout()
Timur Tabi wrote:
> On Fri, Mar 6, 2009 at 7:11 PM, Roland Dreier <> wrote:
>> > The function spin_event_timeout() takes a condition and timeout value
>> > (in jiffies) as parameters. It spins until either the condition is true
>> > or the timeout expires. It returns non-zero if the condition is true,
>> > zero otherwise.
>> What's the motivation for this? Where do you plan to use it?
> I expect it would be useful for drivers that need to wait until a
> specific register has changed its value, but don't want to risk an
> infinite loop if the hardware is not functioning. For example, to
> replace the while loop and subsequent check in this code:

A jiffy is a really long time to be spinning, let alone liffies plural.
In this use case are you expecting that the loop will iterate a very
small number of times before returning, and the timeout case is a very
unlikely error condition?


 \ /
  Last update: 2009-03-09 21:51    [W:0.083 / U:3.224 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site