public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: domen@coderock.org
To: axboe@suse.de
Cc: linux-kernel@vger.kernel.org,
	Nishanth Aravamudan <nacc@us.ibm.com>,
	domen@coderock.org
Subject: [patch 10/12] block/swim_iop: replace schedule_timeout() with msleep_interruptible()
Date: Mon, 20 Jun 2005 23:51:40 +0200	[thread overview]
Message-ID: <20050620215138.918628000@nd47.coderock.org> (raw)

[-- Attachment #1: msleep-drivers_block_swim_iop.patch --]
[-- Type: text/plain, Size: 1412 bytes --]

From: Nishanth Aravamudan <nacc@us.ibm.com>


Change the delay logic of swimiop_eject() to use
msleep_interruptible() and time_before(). Rather than depend on the
number of iterations of the loop for timing accuracy, I rely on the
current value of jiffies relative to a static timeout (end_jiffies).

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
 swim_iop.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Index: quilt/drivers/block/swim_iop.c
===================================================================
--- quilt.orig/drivers/block/swim_iop.c
+++ quilt/drivers/block/swim_iop.c
@@ -317,7 +317,8 @@ static void swimiop_status_update(int dr
 
 static int swimiop_eject(struct floppy_state *fs)
 {
-	int err, n;
+	int err;
+	unsigned long end_jiffies;
 	struct swim_iop_req req;
 	struct swimcmd_eject *cmd = (struct swimcmd_eject *) &req.command[0];
 
@@ -332,14 +333,13 @@ static int swimiop_eject(struct floppy_s
 		release_drive(fs);
 		return err;
 	}
-	for (n = 2*HZ; n > 0; --n) {
-		if (req.complete) break;
+	end_jiffies = jiffies + 2 * HZ;
+	while (!req.complete && time_before(jiffies, end_jiffies)) {
+		msleep_interruptible(10);
 		if (signal_pending(current)) {
 			err = -EINTR;
 			break;
 		}
-		current->state = TASK_INTERRUPTIBLE;
-		schedule_timeout(1);
 	}
 	release_drive(fs);
 	return cmd->error;

--

                 reply	other threads:[~2005-06-21  6:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20050620215138.918628000@nd47.coderock.org \
    --to=domen@coderock.org \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nacc@us.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox