The simplest way is with the wait_event[_interruptible] macros.
In newer versions of the USB drivers, you'll find examples.
You may also set your task's state and put yourself on a waitqueue,
before you do something that will cause you to be woken up.
And yes, most examples you found are buggy, as they can miss
a wakeup.
To use sleep_on safely you must make sure that you cannot be woken up
before you begin to sleep.
Regards
Oliver
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/