RE: wait_event and interrupts
From: Rune Torgersen <hidden>
Date: 2005-09-20 19:14:58
-----Original Message----- From: Jeff Angielski [mailto:jeff@theptrgroup.com]=20 Sent: Tuesday, September 20, 2005 13:40 On Tue, 2005-09-20 at 12:56 -0500, Rune Torgersen wrote: =20quoted
Is there a better way of doing this?=20 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=20 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.