* [Kernel-janitors] [patch 2.6.4] removing sleep_on in
@ 2004-03-20 21:33 Domen Puncer
2004-03-20 21:48 ` Greg KH
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Domen Puncer @ 2004-03-20 21:33 UTC (permalink / raw)
To: kernel-janitors
Hi.
This is my first patch on sleep_on, so i'd really like some comments.
Is wait_event(wq, 0) fine, if we are just waiting for wake_up?
Second one is just waiting 3 seconds, so i removed wq.
Domen
--- c/drivers/usb/media/usbvideo.c 2003-12-18 03:59:59.000000000 +0100
+++ a/drivers/usb/media/usbvideo.c 2004-03-20 17:46:58.000000000 +0100
@@ -225,7 +225,7 @@
static void RingQueue_InterruptibleSleepOn(struct RingQueue *rq)
{
assert(rq != NULL);
- interruptible_sleep_on(&rq->wqh);
+ wait_event_interruptible(&rq->wqh, 0);
}
void RingQueue_WakeUpInterruptible(struct RingQueue *rq)
@@ -705,10 +705,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);
}
EXPORT_SYMBOL(usbvideo_SayAndWait);
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Kernel-janitors] [patch 2.6.4] removing sleep_on in
2004-03-20 21:33 [Kernel-janitors] [patch 2.6.4] removing sleep_on in Domen Puncer
@ 2004-03-20 21:48 ` Greg KH
2004-03-20 22:13 ` Domen Puncer
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2004-03-20 21:48 UTC (permalink / raw)
To: kernel-janitors
On Sat, Mar 20, 2004 at 10:33:36PM +0100, Domen Puncer wrote:
> Hi.
>
> This is my first patch on sleep_on, so i'd really like some comments.
Please cc the linux-usb-devel list, they will help you out too
(hopefully...)
thanks,
greg k-h
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Kernel-janitors] [patch 2.6.4] removing sleep_on in
2004-03-20 21:33 [Kernel-janitors] [patch 2.6.4] removing sleep_on in Domen Puncer
2004-03-20 21:48 ` Greg KH
@ 2004-03-20 22:13 ` Domen Puncer
2004-03-21 0:06 ` Domen Puncer
2004-03-21 1:14 ` [Kernel-janitors] [patch 2.6.4] removing sleep_on from Domen Puncer
3 siblings, 0 replies; 5+ messages in thread
From: Domen Puncer @ 2004-03-20 22:13 UTC (permalink / raw)
To: kernel-janitors
On Saturday 20 of March 2004 22:48, Greg KH wrote:
> On Sat, Mar 20, 2004 at 10:33:36PM +0100, Domen Puncer wrote:
> > Hi.
> >
> > This is my first patch on sleep_on, so i'd really like some comments.
>
> Please cc the linux-usb-devel list, they will help you out too
> (hopefully...)
Comments and patch again, for the linux-usb-devel people...
Is wait_event(wq, 0) fine, if we are just waiting for wake_up?
Second one is just waiting 3 seconds, so i removed wq.
Domen
--- c/drivers/usb/media/usbvideo.c 2003-12-18 03:59:59.000000000 +0100
+++ a/drivers/usb/media/usbvideo.c 2004-03-20 17:46:58.000000000 +0100
@@ -225,7 +225,7 @@
static void RingQueue_InterruptibleSleepOn(struct RingQueue *rq)
{
assert(rq != NULL);
- interruptible_sleep_on(&rq->wqh);
+ wait_event_interruptible(&rq->wqh, 0);
}
void RingQueue_WakeUpInterruptible(struct RingQueue *rq)
@@ -705,10 +705,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);
}
EXPORT_SYMBOL(usbvideo_SayAndWait);
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Kernel-janitors] [patch 2.6.4] removing sleep_on in
2004-03-20 21:33 [Kernel-janitors] [patch 2.6.4] removing sleep_on in Domen Puncer
2004-03-20 21:48 ` Greg KH
2004-03-20 22:13 ` Domen Puncer
@ 2004-03-21 0:06 ` Domen Puncer
2004-03-21 1:14 ` [Kernel-janitors] [patch 2.6.4] removing sleep_on from Domen Puncer
3 siblings, 0 replies; 5+ messages in thread
From: Domen Puncer @ 2004-03-21 0:06 UTC (permalink / raw)
To: kernel-janitors
On Saturday 20 of March 2004 23:13, Domen Puncer wrote:
> On Saturday 20 of March 2004 22:48, Greg KH wrote:
> > On Sat, Mar 20, 2004 at 10:33:36PM +0100, Domen Puncer wrote:
> > > Hi.
> > >
> > > This is my first patch on sleep_on, so i'd really like some comments.
> >
> > Please cc the linux-usb-devel list, they will help you out too
> > (hopefully...)
>
> Comments and patch again, for the linux-usb-devel people...
>
> Is wait_event(wq, 0) fine, if we are just waiting for wake_up?
> Second one is just waiting 3 seconds, so i removed wq.
I'm really sorry for posting this again.
Forget to compile test it, and missed an error. Bad Domen
--- c/drivers/usb/media/usbvideo.c 2003-12-18 03:59:59.000000000 +0100
+++ a/drivers/usb/media/usbvideo.c 2004-03-21 00:59:23.000000000 +0100
@@ -225,7 +225,7 @@
static void RingQueue_InterruptibleSleepOn(struct RingQueue *rq)
{
assert(rq != NULL);
- interruptible_sleep_on(&rq->wqh);
+ wait_event_interruptible(rq->wqh, 0);
}
void RingQueue_WakeUpInterruptible(struct RingQueue *rq)
@@ -705,10 +705,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);
}
EXPORT_SYMBOL(usbvideo_SayAndWait);
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Kernel-janitors] [patch 2.6.4] removing sleep_on from
2004-03-20 21:33 [Kernel-janitors] [patch 2.6.4] removing sleep_on in Domen Puncer
` (2 preceding siblings ...)
2004-03-21 0:06 ` Domen Puncer
@ 2004-03-21 1:14 ` Domen Puncer
3 siblings, 0 replies; 5+ messages in thread
From: Domen Puncer @ 2004-03-21 1:14 UTC (permalink / raw)
To: kernel-janitors
Hi.
Only compile tested. Any feedback welcome.
--- c/drivers/usb/serial/whiteheat.c 2004-02-04 10:06:59.000000000 +0100
+++ a/drivers/usb/serial/whiteheat.c 2004-03-21 02:09:15.000000000 +0100
@@ -1132,6 +1132,7 @@ static int firm_send_command (struct usb
__u8 *transfer_buffer;
int retval = 0;
unsigned long flags;
+ DECLARE_WAITQUEUE(wait, current);
dbg("%s - command %d", __FUNCTION__, command);
@@ -1146,7 +1147,6 @@ static int firm_send_command (struct usb
command_port->write_urb->transfer_buffer_length = datasize + 1;
command_port->write_urb->dev = port->serial->dev;
retval = usb_submit_urb (command_port->write_urb, GFP_KERNEL);
- spin_unlock_irqrestore(&command_info->lock, flags);
if (retval) {
dbg("%s - submit urb failed", __FUNCTION__);
goto exit;
@@ -1154,11 +1154,23 @@ static int firm_send_command (struct usb
/* wait for the command to complete */
timeout = COMMAND_TIMEOUT;
- while (timeout && (command_info->command_finished = FALSE)) {
- timeout = interruptible_sleep_on_timeout (&command_info->wait_command, timeout);
+ add_wait_queue(&command_info->wait_command, &wait);
+ for (;;) {
+ set_task_state(current, TASK_INTERRUPTIBLE);
+ if (command_info->command_finished != FALSE)
+ break;
+ spin_unlock_irqrestore(&command_info->lock, flags);
+ timeout = schedule_timeout(timeout);
+ if (signal_pending(current)) {
+ remove_wait_queue(&command_info->wait_command, &wait);
+ return -EINTR;
+ }
+ spin_lock_irqsave(&command_info->lock, flags);
+ if (!timeout)
+ break;
}
-
- spin_lock_irqsave(&command_info->lock, flags);
+ set_task_state(current, TASK_RUNNING);
+ remove_wait_queue(&command_info->wait_command, &wait);
if (command_info->command_finished = FALSE) {
dbg("%s - command timed out.", __FUNCTION__);
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-03-21 1:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-20 21:33 [Kernel-janitors] [patch 2.6.4] removing sleep_on in Domen Puncer
2004-03-20 21:48 ` Greg KH
2004-03-20 22:13 ` Domen Puncer
2004-03-21 0:06 ` Domen Puncer
2004-03-21 1:14 ` [Kernel-janitors] [patch 2.6.4] removing sleep_on from Domen Puncer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.