In Chapter 5, Managing Interrupts and Concurrency, we saw how we can defer action at a later time; however, it may happen that we still have to wait some time between two operations on a peripheral, as follows:
writeb(0x12, ctrl_reg);
wait_us(100);
writeb(0x00, ctrl_reg);
That is, if we have to write a value into a register, then wait for 100 microseconds, then write another value, these operations can be done by simply using functions defined in the linux/include/linux/delay.h header file (and other ones) instead of using techniques presented before (kernel timers and workqueues, and so on):
void ndelay(unsigned long nsecs);
void udelay(unsigned long usecs);
void mdelay(unsigned long msecs);
void usleep_range(unsigned long min, unsigned long max);
void msleep(unsigned int msecs);
unsigned long msleep_interruptible(unsigned int msecs);
void ssleep(unsigned...