On Thursday 31 January 2008, Andrew Morton wrote:
> On Thu, 31 Jan 2008 12:19:11 -0800
> David Brownell <[EMAIL PROTECTED]> 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/
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to