In a nonatomic context, the kernel provides the sleep[_range] family of functions and which function to use depends on how long you need to delay by:
- udelay(unsigned long usecs): Busy-wait loop-based. You should use this function if you need to sleep for a few µsecs ( < ~10 us ).
- usleep_range(unsigned long min, unsigned long max): Relies on hrtimers, and it is recommended to let this sleep for a few ~µsecs or small msecs (10 us - 20 ms), avoiding the busy-wait loop of udelay().
- msleep(unsigned long msecs): Backed by jiffies/legacy_timers. You should use this for larger, msecs sleep (10 ms+).
Sleep and delay topics are well explained in Documentation/timers/timers-howto.txt in the kernel source.