SPI operations on interrupt context!?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux