lkml.org 
[lkml]   [2009]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] spi: SuperH MSIOF SPI Master driver
On Thu, 26 Nov 2009 15:43:16 +0900 Paul Mundt <lethal@linux-sh.org> wrote:

> > > +static void sh_msiof_modify_ctr_wait(struct sh_msiof_spi_priv *p,
> > > + unsigned long clr, unsigned long set)
> > > +{
> > > + unsigned long mask = clr | set;
> > > + unsigned long data;
> > > +
> > > + data = sh_msiof_read(p, CTR);
> > > + data &= ~clr;
> > > + data |= set;
> > > + sh_msiof_write(p, CTR, data);
> > > +
> > > + while ((sh_msiof_read(p, CTR) & mask) != set)
> > > + ;
> >
> > hm, confidence. No timeout needed here?
> >
> This definitely needs a timeout, nothing involving SPI inspires
> confidence. A cpu_relax() to prevent the compiler from optimizing the
> loop out would help, too.

We generally don't bother with the relax in an IO polling loop
like this. It involves an IO read/write which the compiler cannot fiddle
with and I believe that CPUs will generally take the opportunity to have
a little snooze while the slow IO operation is happening.

Can't hurt though ;)


\
 
 \ /
  Last update: 2009-11-26 08:11    [W:0.053 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site