On Wed, Apr 15, 2015 at 04:00:32PM +0800, Huiquan Zhong wrote: > master->pump_messages workqueue can be queued by spi_start_queue(), > __spi_queued_transfer(). > > there is one case that if one resume thread call spi_start_queue(), > and at the same time another spi_device thread call spi_queued_transfer() > to do spi transfer, then the first workqueue will start the spi transfer, > but the next workqueue queued before SPI transfer complete, will unusual > terminate spi transfer. I've applied this, it took a while mostly because it is very hard for me to understand your commit message - I'm not clear what mechanism will cause a problem for a running transfer ("unusual terminate spi transfer"). I can see we might end up with the work being added to the queue more often than is needed but not how that ends up causing anything other than a little wasted work. Your commit message suggests it's to do with multiple devices adding to the queue simultaneously but the queue access in __spi_queued_transfer() and __spi_pump_messages() all appears to be done with the queue lock held... I'm still not 100% clear that this is doing anything other than making the locking a bit more consistent.
Attachment:
signature.asc
Description: Digital signature