Ernst Schwab <esch...@online.de> wrote:

>  int spi_async(struct spi_device *spi, struct spi_message *message)
>  {
[...]
> +     if (master->bus_lock_flag)
> +             ret = -EBUSY;
> +     else
> +             ret = __spi_async(spi, message);
>  
> +     return ret;
>  }

I'm still not satisfied with this.

The code present in the kernel (without patches) allows spi_async() to be 
called concurrently from interrupt context and process context, without
any loss of data.

With the first patch attempt (bus lock implemented in the master driver)
no messages were lost during the bus lock.

With the current patch, drivers calling spi_async() from the interrupt 
context (are there any??) will get an error code, which they cannot 
handle without adding additional queuing code in the driver.

A possible solution would be to add an extra queue, handled in the
spi.c module, stored in the master's data structure, that stores all
messages coming in while the bus lock is active. The queue can be
flushed by calling __spi_async() for each message as soon as the bus
lock is removed.

Regards
Ernst

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to