From: janitor@sternwelten.at
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, janitor@sternwelten.at, nacc@us.ibm.com
Subject: [patch 03/10] atm/ambassador: replace schedule_timeout() with msleep()
Date: Sat, 20 Nov 2004 03:34:33 +0100 [thread overview]
Message-ID: <E1CVL57-0001Ii-KK@sputnik> (raw)
Any comments would be appreciated.
Description: msleep() is used instead of schedule_timeout() to guarantee
the task delays as expected. Two set_current_state()s were also
inserted, as schedule_timeout() will return immediately unless the state
is set.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
---
linux-2.6.10-rc2-bk4-max/drivers/atm/ambassador.c | 21 ++++++---------------
1 files changed, 6 insertions(+), 15 deletions(-)
diff -puN drivers/atm/ambassador.c~msleep-drivers_atm_ambassador drivers/atm/ambassador.c
--- linux-2.6.10-rc2-bk4/drivers/atm/ambassador.c~msleep-drivers_atm_ambassador 2004-11-19 17:15:24.000000000 +0100
+++ linux-2.6.10-rc2-bk4-max/drivers/atm/ambassador.c 2004-11-19 17:15:24.000000000 +0100
@@ -601,18 +601,13 @@ static int command_do (amb_dev * dev, co
// prepare to wait for cq->pending milliseconds
// effectively one centisecond on i386
- timeout = (cq->pending*HZ+999)/1000;
+ timeout = cq->pending;
if (cq->pending > cq->high)
cq->high = cq->pending;
spin_unlock (&cq->lock);
- while (timeout) {
- // go to sleep
- // PRINTD (DBG_CMD, "wait: sleeping %lu for command", timeout);
- set_current_state(TASK_UNINTERRUPTIBLE);
- timeout = schedule_timeout (timeout);
- }
+ msleep (timeout);
// wait for my slot to be reached (all waiters are here or above, until...)
while (ptrs->out != my_slot) {
@@ -1817,6 +1812,7 @@ static int __init do_loader_command (vol
timeout = HZ/10;
while (rd_plain (dev, offsetof(amb_mem, doorbell)))
if (timeout) {
+ set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout (timeout);
} else {
PRINTD (DBG_LOAD|DBG_ERR, "start command did not clear doorbell, res=%08x",
@@ -1932,11 +1928,7 @@ static int amb_reset (amb_dev * dev, int
if (diags) {
unsigned long timeout;
// 4.2 second wait
- timeout = HZ*42/10;
- while (timeout) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- timeout = schedule_timeout (timeout);
- }
+ msleep (4200);
// half second time-out
timeout = HZ/2;
while (!rd_plain (dev, offsetof(amb_mem, mb.loader.ready)))
@@ -2056,13 +2048,12 @@ static int __init amb_talk (amb_dev * de
wr_mem (dev, offsetof(amb_mem, doorbell), virt_to_bus (&a));
// 2.2 second wait (must not touch doorbell during 2 second DMA test)
- timeout = HZ*22/10;
- while (timeout)
- timeout = schedule_timeout (timeout);
+ msleep (2200);
// give the adapter another half second?
timeout = HZ/2;
while (rd_plain (dev, offsetof(amb_mem, doorbell)))
if (timeout) {
+ set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout (timeout);
} else {
PRINTD (DBG_INIT|DBG_ERR, "adapter init timed out");
_
reply other threads:[~2004-11-20 3: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=E1CVL57-0001Ii-KK@sputnik \
--to=janitor@sternwelten.at \
--cc=akpm@osdl.org \
--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