- unsigned long end_jiffies = jiffies + HVSI_TIMEOUT;
- unsigned long timeout;
-
- DECLARE_WAITQUEUE(myself, current);
- set_current_state(TASK_UNINTERRUPTIBLE);
- add_wait_queue(&hp->emptyq, &myself);
-
- for (;;) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- if (hp->n_outbuf <= 0)
- break;
- timeout = end_jiffies - jiffies;
- if (time_after(jiffies, end_jiffies))
- break;
- schedule_timeout(timeout);
- }
- remove_wait_queue(&hp->emptyq, &myself);
- set_current_state(TASK_RUNNING);