Getting around this common race condition without disabling
interrupts is one of Linux's features.
You need to add the function to the wait queue before you write to the board and cause the interrupt to occur. Look at kernel/sched.c at the definition of interruptible_sleep_on(): You want to do something like this:
current->state = TASK_INTERRUPTIBLE; add_wait_queue(this_entry, &wait); trigger_interrupt_from_board(); schedule(); remove_wait_queue(this_entry, &wait);Linux's serial.c uses this trick.