A kernel driver handles interrupts coming from a CPU pin.
The interrupt handler function wakes up a thread function which reads data from an interface.
There is one interrupt per data block but a running thread function is able to read more blocks if available. The function quits if nothing more is available.
If I return IRQ_WAKE_THREAD in the interrupt handler while the thread is still alive then it is not woken up later. This is ok if the function is fully active and finds more data to read.
But the thread function also could have decided to quit at this time. It hasn't quit yet so the interrupt handler sees it's still running, activating it would be useless. But the thread function quits right now and doesn't read data.
So somehow the thread must be relaunched right after it has finished, while the interrupt handler is gone and can't do this.
What is a recommended pattern to handle this properly?