I'm writing a kernel driver for a device that produces regular amounts of data for reading periodically. The user space program is ideally suited to making this a blocking driver.
What methods are available for pausing anywhere from 4 to 100ms in a driver (i.e. doing the "block")? In user space I'd do something akin to:
tv.tv_sec = microsecond_delay / 1000000ul;
tv.tv_usec = microsecond_delay % 1000000ul;
(void)select(0, NULL, NULL, NULL, & tv);
or
gettimeofday(tv,NULL);
and compare the structures.
[Edit - my own answer]
I will be using the following code in my driver:
#include <linux/jiffies.h>
...
schedule_timeout(file->private_data->my_driver_struct.read_pause_jiffies);
Voila! I shall now test ...