Hi,
this patch removes sleep_on from usbvideo.
I see no MAINTAINERS entry, thus it goes to the whole list.
Two remarks: Using sleep_on just for a dely is not funny.
Checking a queue for activity is a bad idea.
Regards
Oliver
--- usbvideo.h.alt Sun Dec 2 23:51:10 2001
+++ usbvideo.h Sun Dec 2 23:51:32 2001
@@ -123,6 +123,7 @@
int wi; /* That's where we write */
int ri; /* Read from here until you hit write index */
wait_queue_head_t wqh; /* Processes waiting */
+ char wake /* safe to wake up */
} RingQueue_t;
typedef enum {
--- usbvideo.c.alt Sun Dec 2 23:59:48 2001
+++ usbvideo.c Sun Dec 2 23:58:29 2001
@@ -155,6 +155,7 @@
{
assert(rq != NULL);
init_waitqueue_head(&rq->wqh);
+ rq->wake = 0;
}
void RingQueue_Allocate(RingQueue_t *rq, int rqLen)
@@ -243,15 +244,23 @@
void RingQueue_InterruptibleSleepOn(RingQueue_t *rq)
{
+ DECLARE_WAITQUEUE(wait, current);
+
assert(rq != NULL);
- interruptible_sleep_on(&rq->wqh);
+ add_wait_queue(&rq->wqh, &wait);
+ set_current_state(TASK_INTERRUPTIBLE);
+ if (!rq->wake)
+ schedule();
+ rq->wake = 0;
+ remove_wait_queue(&rq->wqh, &wait);
+ set_current_state(TASK_RUNNING);
}
void RingQueue_WakeUpInterruptible(RingQueue_t *rq)
{
assert(rq != NULL);
- if (waitqueue_active(&rq->wqh))
- wake_up_interruptible(&rq->wqh);
+ rq->wake = 1;
+ wake_up_interruptible(&rq->wqh);
}
/*
@@ -707,10 +716,9 @@
/* Debugging aid */
void usbvideo_SayAndWait(const char *what)
{
- wait_queue_head_t wq;
- init_waitqueue_head(&wq);
info("Say: %s", what);
- interruptible_sleep_on_timeout (&wq, HZ*3); /* Timeout */
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout (HZ*3); /* Timeout */
}
/* ******************************************************************** */
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel