On 12/14/2016 04:21 PM, Mark Brown wrote: > On Sun, Dec 11, 2016 at 09:03:49PM +0100, Hauke Mehrtens wrote: > >> This callback checks if the transfer really finished. This allows a >> driver to directly call the completion list in the irq handler and it >> does not have to bushy wait till the hardware is really finished in the >> IRQ handler. This is needed for the Lantiq driver. > > This is really hard to understand and does not seem like a good > interface, it's going to be confusing for anyone who doesn't have > hardware which is broken in whatever way your hardware is broken and it > sounds like it's misnamed for your hardware since my guess is that you > actually want to wait for something in the function rather than just > check to see if the transfer completed. > > Why not just have your interrupt handler schedule something on a > workqueue to check whatever it is needs checking here? I have two problems. 1. My SPI controller does not signal an IRQ when it is idle, it can only send an interrupt based on the filling of the rx and tx fifo or after every word (2 to 32 bits). The data from the fifo is written to a shift register in the hardware, so when the fifo is empty it is still working on the last word and should not be reconfigured. I could make it send an IRQ after every word, but that would be a lot of IRQs. To solve this problem I would convert it to threaded IRQs and directly do the busy waiting int the IRQ handler. 2. When something went wrong and I got an error IRQ for example, I would like to add this information to the spi message that was transfered, but the only way I see it to not wake the completion and let it run into a timeout. I would like to have a function in which I can do some busy waiting till the last word is really written to the wire and also return if the transfer was successful or what error occurred. With the check_finished callback I was albe to solve both problems. Should I rename it to get_transfer_result() ? Hauke -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html