blob: 95272f4765fcfa4b8c0385013c1556ef1ccaa7b1 [file] [log] [blame]
Konrad Zapalowicz9a633d02014-08-06 14:21:23 +02001#include <linux/tty.h>
2#include <linux/sched.h>
3#include "dgnc_utils.h"
Konrad Zapalowicz9a633d02014-08-06 14:21:23 +02004
5/*
6 * dgnc_ms_sleep()
7 *
8 * Put the driver to sleep for x ms's
9 *
10 * Returns 0 if timed out, !0 (showing signal) if interrupted by a signal.
11 */
12int dgnc_ms_sleep(ulong ms)
13{
Davidlohr Bueso2be90fe2015-01-26 02:15:02 -080014 __set_current_state(TASK_INTERRUPTIBLE);
Konrad Zapalowicz9a633d02014-08-06 14:21:23 +020015 schedule_timeout((ms * HZ) / 1000);
16 return signal_pending(current);
17}