All of lore.kernel.org
 help / color / mirror / Atom feed
From: Domen Puncer <domen@coderock.org>
To: kernel-janitors@vger.kernel.org
Subject: [Kernel-janitors] [patch 2.6.4] removing sleep_on from
Date: Sun, 21 Mar 2004 01:14:06 +0000	[thread overview]
Message-ID: <200403210214.06325.domen@coderock.org> (raw)
In-Reply-To: <200403202233.37294.domen@coderock.org>

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

      parent reply	other threads:[~2004-03-21  1:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Domen Puncer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200403210214.06325.domen@coderock.org \
    --to=domen@coderock.org \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.