From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] [PATCH 2/21] polling loops: change exit condition to
Date: Sun, 04 Dec 2005 00:13:20 +0000 [thread overview]
Message-ID: <439234A0.3030602@gmail.com> (raw)
ATM
P: Chas Williams
M: chas@cmf.nrl.navy.mil
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
diff -upr -X linux-2.6.15-rc4/Documentation/dontdiff linux-2.6.15-rc4-orig/drivers/atm/firestream.c linux-2.6.15-rc4/drivers/atm/firestream.c
--- linux-2.6.15-rc4-orig/drivers/atm/firestream.c 2005-11-20 16:53:15.000000000 +0100
+++ linux-2.6.15-rc4/drivers/atm/firestream.c 2005-12-03 16:53:10.000000000 +0100
@@ -1651,8 +1651,9 @@ static void fs_poll (unsigned long data)
static int __devinit fs_init (struct fs_dev *dev)
{
struct pci_dev *pci_dev;
- int isr, to;
+ int isr;
int i;
+ unsigned long end_time;
func_enter ();
pci_dev = dev->pci_dev;
@@ -1690,8 +1691,8 @@ static int __devinit fs_init (struct fs_
/* 10ms * 100 is 1 second. That should be enough, as AN3:9 says it takes
1ms. */
- to = 100;
- while (--to) {
+ end_time = jiffies + msecs_to_jiffies(1000);
+ while (time_before(jiffies, end_time)) {
isr = read_fs (dev, ISR);
/* This bit is documented as "RESERVED" */
@@ -1708,7 +1709,7 @@ static int __devinit fs_init (struct fs_
msleep(10);
}
- if (!to) {
+ if (time_after_eq(jiffies, end_time)) {
printk (KERN_ERR "timeout initializing the FS... \n");
return 1;
}
diff -upr -X linux-2.6.15-rc4/Documentation/dontdiff linux-2.6.15-rc4-orig/drivers/atm/he.c linux-2.6.15-rc4/drivers/atm/he.c
--- linux-2.6.15-rc4-orig/drivers/atm/he.c 2005-11-20 16:53:15.000000000 +0100
+++ linux-2.6.15-rc4/drivers/atm/he.c 2005-12-03 16:53:10.000000000 +0100
@@ -2550,8 +2550,9 @@ he_close(struct atm_vcc *vcc)
struct he_tpd *tpd;
unsigned cid;
struct he_vcc *he_vcc = HE_VCC(vcc);
-#define MAX_RETRY 30
- int retry = 0, sleep = 1, tx_inuse;
+#define MAX_TIMEOUT 6000
+ int sleep = 1, tx_inuse;
+ unsigned long end_time;
HPRINTK("close vcc %p %d.%d\n", vcc, vcc->vpi, vcc->vci);
@@ -2607,14 +2608,12 @@ he_close(struct atm_vcc *vcc)
* TBRQ. When the last packet on the connection arrives in the
* TBRQ, the host issues the close command to the adapter.
*/
-
+ end_time = jiffies + msecs_to_jiffies(MAX_TIMEOUT);
while (((tx_inuse = atomic_read(&sk_atm(vcc)->sk_wmem_alloc)) > 0) &&
- (retry < MAX_RETRY)) {
+ time_before(jiffies, end_time)) {
msleep(sleep);
if (sleep < 250)
sleep = sleep * 2;
-
- ++retry;
}
if (tx_inuse)
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next reply other threads:[~2005-12-04 0:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-04 0:13 Marcin Slusarz [this message]
2005-12-10 17:51 ` [KJ] [PATCH 2/21] polling loops: change exit condition to Alexey Dobriyan
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=439234A0.3030602@gmail.com \
--to=marcin.slusarz@gmail.com \
--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.