Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread Pranay Srivastava
On Feb 1, 2014 2:48 PM, "m silverstri" wrote: > > By driver code , I mean the code which set the register values and > wait till the values is set (via an interrupt handler) before > continues doing something else > > > On Sat, Feb 1, 2014 at 1:06 AM, anish singh wrote: > > On Sat, Feb 1, 2014 at

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread Josh Cartwright
On Sat, Feb 01, 2014 at 01:32:49AM -0800, anish singh wrote: > On Sat, Feb 1, 2014 at 1:15 AM, m silverstri > wrote: > > By driver code , I mean the code which set the register values and > > wait till the values is set (via an interrupt handler) before > > continues doing something else > ok so y

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread anish singh
On Sat, Feb 1, 2014 at 1:15 AM, m silverstri wrote: > By driver code , I mean the code which set the register values and > wait till the values is set (via an interrupt handler) before > continues doing something else ok so you are looking for below code: some_func() { set_register_value x_varia

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread m silverstri
By driver code , I mean the code which set the register values and wait till the values is set (via an interrupt handler) before continues doing something else On Sat, Feb 1, 2014 at 1:06 AM, anish singh wrote: > On Sat, Feb 1, 2014 at 1:03 AM, m silverstri > wrote: >> On Sat, Feb 1, 2014 at 12

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread anish singh
On Sat, Feb 1, 2014 at 1:03 AM, m silverstri wrote: > On Sat, Feb 1, 2014 at 12:48 AM, anish singh > wrote: >> On Sat, Feb 1, 2014 at 12:32 AM, m silverstri >> wrote: >> don't top-post >> >>> In my driver code, >>> I want to set a bit in a HW Register 1. HW will send an interrupt >> Yes this is

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread m silverstri
On Sat, Feb 1, 2014 at 12:48 AM, anish singh wrote: > On Sat, Feb 1, 2014 at 12:32 AM, m silverstri > wrote: > don't top-post > >> In my driver code, >> I want to set a bit in a HW Register 1. HW will send an interrupt > Yes this is how most drivers work. > >> when setting the register is done.

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread anish singh
On Sat, Feb 1, 2014 at 12:32 AM, m silverstri wrote: don't top-post > In my driver code, > I want to set a bit in a HW Register 1. HW will send an interrupt Yes this is how most drivers work. > when setting the register is done. > I don't want my driver code to block until the interrupt is sent

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread m silverstri
Sorry, I mean I want to set a bit in a HW Register 1. HW will send an interrupt when setting the register is done. I want my driver code to block until the interrupt is sent from the HW. On Sat, Feb 1, 2014 at 12:32 AM, m silverstri wrote: > In my driver code, > I want to set a bit in a HW Reg

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread m silverstri
In my driver code, I want to set a bit in a HW Register 1. HW will send an interrupt when setting the register is done. I don't want my driver code to block until the interrupt is sent from the HW. On Sat, Feb 1, 2014 at 12:06 AM, anish singh wrote: > On Fri, Jan 31, 2014 at 11:55 PM, m silver

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread anish singh
On Fri, Jan 31, 2014 at 11:55 PM, m silverstri wrote: > Hi, > > I read this article http://www.linuxjournal.com/article/5833 to learn > about spinlock. I try this to use it in my kernel driver. > > Here is what my driver code needs to do: > In f1(), it will get the spin lock, and caller can call f

Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread m silverstri
Hi, I read this article http://www.linuxjournal.com/article/5833 to learn about spinlock. I try this to use it in my kernel driver. Here is what my driver code needs to do: In f1(), it will get the spin lock, and caller can call f2() will wait for the lock since the spin lock is not being unlock.