From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Brownell Subject: Re: [patch 2.6.24 3/6] spi_bfin: wait for tx to complete on some cs_chg paths Date: Thu, 31 Jan 2008 13:53:34 -0800 Message-ID: <200801311353.34281.david-b@pacbell.net> References: <200801311219.11238.david-b@pacbell.net> <20080131132631.91075a19.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, Andrew Morton To: Bryan Wu Return-path: In-Reply-To: <20080131132631.91075a19.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org On Thursday 31 January 2008, Andrew Morton wrote: > On Thu, 31 Jan 2008 12:19:11 -0800 > David Brownell wrote: > > > + while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) > > + cpu_relax(); > > I'd suggest that this commonly-occurring code sequence be implemented in a > standalone function. The bitmask to check can be a parameter too, as well as the termination result after the mask. That will allow other loops to get properly limited too -- e.g. wait till RXS or TXS clears, not just SPIF getting set. > That'll probably produce less code and you can also > add a timeout+printk+BUG (or whatever) to that function, rather than just > mysteriously locking up if something goes wrong. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/