[PATCH 1/3] Char: isicom, use completion

From: Jiri Slaby
Date: Sat Oct 21 2006 - 20:55:09 EST


isicom, use completion

use wait_for_completion+complete instead of variables+msleep hack.

Signed-off-by: Jiri Slaby <jirislaby@xxxxxxxxx>

---
commit 12be27655354f888150bbb720614dfba48cecdaf
tree a41af90a51a6de23bbae8ee7109a33a7fef23154
parent e6ef63223d0b6c4a72f815b8a42584d346980c82
author Jiri Slaby <jirislaby@xxxxxxxxx> Sat, 21 Oct 2006 21:50:40 +0200
committer Jiri Slaby <jirislaby@xxxxxxxxx> Sat, 21 Oct 2006 21:50:40 +0200

drivers/char/isicom.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index db57da6..a8cfdf5 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -172,6 +172,7 @@ static struct pci_driver isicom_driver =
static int prev_card = 3; /* start servicing isi_card[0] */
static struct tty_driver *isicom_normal;

+static DECLARE_COMPLETION(isi_timerdone);
static struct timer_list tx;
static char re_schedule = 1;

@@ -514,7 +515,7 @@ static void isicom_tx(unsigned long _dat
/* schedule another tx for hopefully in about 10ms */
sched_again:
if (!re_schedule) {
- re_schedule = 2;
+ complete(&isi_timerdone);
return;
}

@@ -1923,12 +1924,9 @@ error:

static void __exit isicom_exit(void)
{
- unsigned int index = 0;
-
re_schedule = 0;

- while (re_schedule != 2 && index++ < 100)
- msleep(10);
+ wait_for_completion_timeout(&isi_timerdone, HZ);

pci_unregister_driver(&isicom_driver);
tty_unregister_driver(isicom_normal);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/