[alsa-devel] problems writing pcm driver

Takashi Iwai tiwai at suse.de
Wed Aug 22 11:24:34 CEST 2007


At Tue, 21 Aug 2007 22:13:45 -0700 (PDT),
Trent Piepho wrote:
> 
> > > This means I have to use locking between the irq handler
> > > and the pointer callback, which I have been able to avoid so far.
> >
> > ?? probably not as long as you only read the cached value from the chip
> > struct once in the pointer callback.
> > However you might need locking to provide exclusive access to the
> > hardware if there are accesses that have to happen in sequence.
> 
> I was under the impression that one should not count on writing to an integer
> on one while cpu reading from the same integer on another cpu at the same time
> working correctly.  If you want to do this, you have to use atomic_t and
> related functions.

See $LINUXKERNEL/Documentation/memory-barriers.txt.  Worth to read to
understand what you need for such a case.


Takashi


More information about the Alsa-devel mailing list