Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

Nonatomic context

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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content