Commit 8365c315 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Add msleep function to the kernel core to prevent duplication.

parent b80345b7
......@@ -38,4 +38,6 @@ extern unsigned long loops_per_jiffy;
#define ndelay(x) udelay(((x)+999)/1000)
#endif
void msleep(unsigned int msecs);
#endif /* defined(_LINUX_DELAY_H) */
......@@ -1485,3 +1485,20 @@ unregister_time_interpolator(struct time_interpolator *ti)
spin_unlock(&time_interpolator_lock);
}
#endif /* CONFIG_TIME_INTERPOLATION */
/**
* msleep - sleep safely even with waitqueue interruptions
* @msecs: Time in milliseconds to sleep for
*/
void msleep(unsigned int msecs)
{
unsigned long timeout = msecs_to_jiffies(msecs);
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
}
}
EXPORT_SYMBOL(msleep);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment