From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754777AbZCIUsK (ORCPT ); Mon, 9 Mar 2009 16:48:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752998AbZCIUr4 (ORCPT ); Mon, 9 Mar 2009 16:47:56 -0400 Received: from gw.goop.org ([64.81.55.164]:43494 "EHLO mail.goop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751646AbZCIUrz (ORCPT ); Mon, 9 Mar 2009 16:47:55 -0400 Message-ID: <49B58076.8020703@goop.org> Date: Mon, 09 Mar 2009 13:47:50 -0700 From: Jeremy Fitzhardinge User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Timur Tabi CC: Roland Dreier , linux-kernel@vger.kernel.org Subject: Re: [PATCH] add function spin_event_timeout() References: <1236384801-10305-1-git-send-email-timur@freescale.com> In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? J