SPI operations on interrupt context!?
From: Daniel. <hidden>
Date: 2015-09-08 17:19:28
Hi all, I'm dealing with a SPI driver and I have a doubt. I need to read and write data to spi (registers and values) inside interrupt handler. I want to know if this pattern is safe or if I'll face problems with it. This code is being added to gpio-mcp23s08.c driver to handle IRQ and save INTCAP at interruption time. INTCAP register keeps the input port status at interruption time. I want to capture this as fast as possible and put it at a circular queue. I write this code inspired by spi_sync function, but using spinlocks so it doesn't sleeps. But, these spin_(un)lock calls seems a bad ideia to me. Any better idea or guidelines? Here is the code. https://gist.github.com/gkos/4cce494e90518077084a#file-gpio-mcp23s08-c-L440 The functions are mcp23s17_read_irqsafe and mcp23s17_read_irqsafe_complete PS: The code is a little messed up (because I've been trying to optimize this INTCAP capturing by many means) Cheers - dhs -- *"Do or do not. There is no try"* *Yoda Master* -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150908/c798eb33/attachment.html