aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-02-12 03:52:31 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:30 -0500
commit40565f1962c5be9b9e285e05af01ab7771534868 (patch)
treeae84097778a8adfc5a9aad8a5428fe803d54346a /drivers/char/pcmcia
parentd096f3e9898d469493fc0afe88d7285c4bdc3ce2 (diff)
[PATCH] Char: timers cleanup
- Use timer macros to set function and data members and to modify expiration time. - Use DEFINE_TIMER for global timers and do not init them at run-time in these cases. - del_timer_sync is common in most cases -- we want to wait for timer function if it's still running. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Dave Airlie <airlied@linux.ie> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Paul Fulghum <paulkf@microgate.com> Cc: Kylene Jo Hall <kjhall@us.ibm.com> Cc: Wim Van Sebroeck <wim@iguana.be> Acked-by: Dmitry Torokhov <dtor@mail.ru> (Input bits) Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/pcmcia')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c10
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c3
-rw-r--r--drivers/char/pcmcia/synclink_cs.c10
3 files changed, 8 insertions, 15 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 211c93fda6fc..e91b43a014b0 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -946,8 +946,7 @@ release_io:
946 946
947return_with_timer: 947return_with_timer:
948 DEBUGP(7, dev, "<- monitor_card (returns with timer)\n"); 948 DEBUGP(7, dev, "<- monitor_card (returns with timer)\n");
949 dev->timer.expires = jiffies + dev->mdelay; 949 mod_timer(&dev->timer, jiffies + dev->mdelay);
950 add_timer(&dev->timer);
951 clear_bit(LOCK_MONITOR, &dev->flags); 950 clear_bit(LOCK_MONITOR, &dev->flags);
952} 951}
953 952
@@ -1406,12 +1405,9 @@ static void start_monitor(struct cm4000_dev *dev)
1406 DEBUGP(3, dev, "-> start_monitor\n"); 1405 DEBUGP(3, dev, "-> start_monitor\n");
1407 if (!dev->monitor_running) { 1406 if (!dev->monitor_running) {
1408 DEBUGP(5, dev, "create, init and add timer\n"); 1407 DEBUGP(5, dev, "create, init and add timer\n");
1409 init_timer(&dev->timer); 1408 setup_timer(&dev->timer, monitor_card, (unsigned long)dev);
1410 dev->monitor_running = 1; 1409 dev->monitor_running = 1;
1411 dev->timer.expires = jiffies; 1410 mod_timer(&dev->timer, jiffies);
1412 dev->timer.data = (unsigned long) dev;
1413 dev->timer.function = monitor_card;
1414 add_timer(&dev->timer);
1415 } else 1411 } else
1416 DEBUGP(5, dev, "monitor already running\n"); 1412 DEBUGP(5, dev, "monitor already running\n");
1417 DEBUGP(3, dev, "<- start_monitor\n"); 1413 DEBUGP(3, dev, "<- start_monitor\n");
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 9b1ff7e8f896..0e82968c2f38 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -632,8 +632,7 @@ static int reader_probe(struct pcmcia_device *link)
632 init_waitqueue_head(&dev->poll_wait); 632 init_waitqueue_head(&dev->poll_wait);
633 init_waitqueue_head(&dev->read_wait); 633 init_waitqueue_head(&dev->read_wait);
634 init_waitqueue_head(&dev->write_wait); 634 init_waitqueue_head(&dev->write_wait);
635 init_timer(&dev->poll_timer); 635 setup_timer(&dev->poll_timer, cm4040_do_poll, 0);
636 dev->poll_timer.function = &cm4040_do_poll;
637 636
638 ret = reader_config(link, i); 637 ret = reader_config(link, i);
639 if (ret) 638 if (ret)
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 4ab2c98f978c..8d025e9b5bce 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -1361,9 +1361,7 @@ static int startup(MGSLPC_INFO * info)
1361 1361
1362 memset(&info->icount, 0, sizeof(info->icount)); 1362 memset(&info->icount, 0, sizeof(info->icount));
1363 1363
1364 init_timer(&info->tx_timer); 1364 setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info);
1365 info->tx_timer.data = (unsigned long)info;
1366 info->tx_timer.function = tx_timeout;
1367 1365
1368 /* Allocate and claim adapter resources */ 1366 /* Allocate and claim adapter resources */
1369 retval = claim_resources(info); 1367 retval = claim_resources(info);
@@ -1408,7 +1406,7 @@ static void shutdown(MGSLPC_INFO * info)
1408 wake_up_interruptible(&info->status_event_wait_q); 1406 wake_up_interruptible(&info->status_event_wait_q);
1409 wake_up_interruptible(&info->event_wait_q); 1407 wake_up_interruptible(&info->event_wait_q);
1410 1408
1411 del_timer(&info->tx_timer); 1409 del_timer_sync(&info->tx_timer);
1412 1410
1413 if (info->tx_buf) { 1411 if (info->tx_buf) {
1414 free_page((unsigned long) info->tx_buf); 1412 free_page((unsigned long) info->tx_buf);
@@ -3549,8 +3547,8 @@ static void tx_start(MGSLPC_INFO *info)
3549 } else { 3547 } else {
3550 info->tx_active = 1; 3548 info->tx_active = 1;
3551 tx_ready(info); 3549 tx_ready(info);
3552 info->tx_timer.expires = jiffies + msecs_to_jiffies(5000); 3550 mod_timer(&info->tx_timer, jiffies +
3553 add_timer(&info->tx_timer); 3551 msecs_to_jiffies(5000));
3554 } 3552 }
3555 } 3553 }
3556 3554