Re: [spi-devel-general] Spinlock vs mutexes for spi network driver

2010-03-19 Thread Amit Uttamchandani
On Thu, Mar 18, 2010 at 06:11:00PM -0400, Ned Forrester wrote: [...] > > I'm not familiar with spi_read and spi_write. I guess those may be part > of the user space driver: spidev? (I wrote a dedicated protocol driver > for my device.) Looking at spi.c, spi_read and spi_write both use spi_syn

Re: [spi-devel-general] Spinlock vs mutexes for spi network driver

2010-03-18 Thread Ned Forrester
On 03/18/2010 06:11 PM, Ned Forrester wrote: > > It could be a lot of places, from bug in your code to bug in the > controller driver. I'm not sure how much testing omap2_mcspi.c has > received. When I first started using pxa2xx_spi.c, less than a year > after it appeared in the kernel, I found a

Re: [spi-devel-general] Spinlock vs mutexes for spi network driver

2010-03-18 Thread Ned Forrester
On 03/18/2010 04:09 PM, Amit Uttamchandani wrote: > On Thu, Mar 18, 2010 at 01:28:17PM -0400, Ned Forrester wrote: > > [...] > >> >> The message is atomic in the sense that the controller driver guarantees >> to complete all the transfers defined in the message (assuming no >> errors) before it h

Re: [spi-devel-general] Spinlock vs mutexes for spi network driver

2010-03-18 Thread Amit Uttamchandani
On Thu, Mar 18, 2010 at 01:28:17PM -0400, Ned Forrester wrote: [...] > > The message is atomic in the sense that the controller driver guarantees > to complete all the transfers defined in the message (assuming no > errors) before it handles the next message. Each transfer may change > the cloc

Re: [spi-devel-general] Spinlock vs mutexes for spi network driver

2010-03-18 Thread Ned Forrester
On 03/18/2010 12:46 PM, Amit Uttamchandani wrote: > On Wed, Mar 17, 2010 at 05:28:16PM -0400, Ned Forrester wrote: > > [...] > >> If I recall correctly, the work queue does NOT run in interrupt context >> (are allowed to sleep), and therefore mutexs are permitted (for locking >> with other non-in

Re: [spi-devel-general] Spinlock vs mutexes for spi network driver

2010-03-18 Thread Amit Uttamchandani
On Wed, Mar 17, 2010 at 05:28:16PM -0400, Ned Forrester wrote: [...] > If I recall correctly, the work queue does NOT run in interrupt context > (are allowed to sleep), and therefore mutexs are permitted (for locking > with other non-interrupt activity). The interrupt handler definitely > runs i

Re: [spi-devel-general] Spinlock vs mutexes for spi network driver

2010-03-17 Thread Ned Forrester
On 03/17/2010 04:49 PM, Amit Uttamchandani wrote: > > I have modified 'drivers/net/ethoc.c' for spi communication and it is > able to transmit/receive packets. However, I am confused about using > spinlocks vs mutexes for locking access to the spi device. > > e.g. For the transmit function I use

[spi-devel-general] Spinlock vs mutexes for spi network driver

2010-03-17 Thread Amit Uttamchandani
I have modified 'drivers/net/ethoc.c' for spi communication and it is able to transmit/receive packets. However, I am confused about using spinlocks vs mutexes for locking access to the spi device. e.g. For the transmit function I use a work_queue to schedule the transmits. In the handler functio