> -----Original Message-----
> From: Jeff Angielski [mailto:jeff at theptrgroup.com] 
> Sent: Tuesday, September 20, 2005 13:40
> On Tue, 2005-09-20 at 12:56 -0500, Rune Torgersen wrote:
> 
> > Is there a better way of doing this?
> 
> If you *must* share the variable between interrupt and non-interrupt
> context, you must mutex it in an interrupt safe way.  The use of
> spin_lock_irqsave() comes to mind for you read function.

The shared variable is an int, which should be atomic to access anyways.
Someone else told me to try to set the shared variable to volatile.

> But you are going to have other problems with this approach anyways
> since you "appear" to be assuming a one-to-one relationship 
> between your
> interrupt handler and the read function.  Is that really true?
Yes. The read function starts the hardware, and the hardware responds
with an interrupt when it's done.



Reply via email to