All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Timur Tabi <timur@freescale.com>
Cc: Roland Dreier <rdreier@cisco.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] add function spin_event_timeout()
Date: Mon, 09 Mar 2009 13:47:50 -0700	[thread overview]
Message-ID: <49B58076.8020703@goop.org> (raw)
In-Reply-To: <ed82fe3e0903061725y40dc246ehd3482690ee3898fa@mail.gmail.com>

Timur Tabi wrote:
> On Fri, Mar 6, 2009 at 7:11 PM, Roland Dreier <rdreier@cisco.com> 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?

    J

  parent reply	other threads:[~2009-03-09 20:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-07  0:13 [PATCH] add function spin_event_timeout() Timur Tabi
2009-03-07  1:11 ` Roland Dreier
2009-03-07  1:25   ` Timur Tabi
2009-03-07  9:13     ` Jiri Slaby
2009-03-09 20:47     ` Jeremy Fitzhardinge [this message]
2009-03-09 20:51       ` Timur Tabi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49B58076.8020703@goop.org \
    --to=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdreier@cisco.com \
    --cc=timur@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.