aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/char/drm/via_dmablit.c14
-rw-r--r--drivers/char/dtlk.c8
-rw-r--r--drivers/char/ip2/i2lib.c30
-rw-r--r--drivers/char/n_r3964.c4
-rw-r--r--drivers/char/nwbutton.c13
-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
-rw-r--r--drivers/char/rio/rio_linux.c12
-rw-r--r--drivers/char/rocket.c10
-rw-r--r--drivers/char/rtc.c12
-rw-r--r--drivers/char/specialix.c12
-rw-r--r--drivers/char/synclink.c10
-rw-r--r--drivers/char/synclink_gt.c19
-rw-r--r--drivers/char/synclinkmp.c22
-rw-r--r--drivers/char/tpm/tpm.c5
-rw-r--r--drivers/char/vt.c4
17 files changed, 75 insertions, 123 deletions
diff --git a/drivers/char/drm/via_dmablit.c b/drivers/char/drm/via_dmablit.c
index 2054d5773717..2881a06b6f55 100644
--- a/drivers/char/drm/via_dmablit.c
+++ b/drivers/char/drm/via_dmablit.c
@@ -376,10 +376,8 @@ via_dmablit_handler(drm_device_t *dev, int engine, int from_irq)
376 blitq->cur = cur; 376 blitq->cur = cur;
377 blitq->num_outstanding--; 377 blitq->num_outstanding--;
378 blitq->end = jiffies + DRM_HZ; 378 blitq->end = jiffies + DRM_HZ;
379 if (!timer_pending(&blitq->poll_timer)) { 379 if (!timer_pending(&blitq->poll_timer))
380 blitq->poll_timer.expires = jiffies+1; 380 mod_timer(&blitq->poll_timer, jiffies + 1);
381 add_timer(&blitq->poll_timer);
382 }
383 } else { 381 } else {
384 if (timer_pending(&blitq->poll_timer)) { 382 if (timer_pending(&blitq->poll_timer)) {
385 del_timer(&blitq->poll_timer); 383 del_timer(&blitq->poll_timer);
@@ -478,8 +476,7 @@ via_dmablit_timer(unsigned long data)
478 via_dmablit_handler(dev, engine, 0); 476 via_dmablit_handler(dev, engine, 0);
479 477
480 if (!timer_pending(&blitq->poll_timer)) { 478 if (!timer_pending(&blitq->poll_timer)) {
481 blitq->poll_timer.expires = jiffies+1; 479 mod_timer(&blitq->poll_timer, jiffies + 1);
482 add_timer(&blitq->poll_timer);
483 480
484 /* 481 /*
485 * Rerun handler to delete timer if engines are off, and 482 * Rerun handler to delete timer if engines are off, and
@@ -574,9 +571,8 @@ via_init_dmablit(drm_device_t *dev)
574 } 571 }
575 DRM_INIT_WAITQUEUE(&blitq->busy_queue); 572 DRM_INIT_WAITQUEUE(&blitq->busy_queue);
576 INIT_WORK(&blitq->wq, via_dmablit_workqueue); 573 INIT_WORK(&blitq->wq, via_dmablit_workqueue);
577 init_timer(&blitq->poll_timer); 574 setup_timer(&blitq->poll_timer, via_dmablit_timer,
578 blitq->poll_timer.function = &via_dmablit_timer; 575 (unsigned long)blitq);
579 blitq->poll_timer.data = (unsigned long) blitq;
580 } 576 }
581} 577}
582 578
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
index d4005e94fe5f..d8dbdb916232 100644
--- a/drivers/char/dtlk.c
+++ b/drivers/char/dtlk.c
@@ -72,6 +72,7 @@
72#define TRACE_RET ((void) 0) 72#define TRACE_RET ((void) 0)
73#endif /* TRACING */ 73#endif /* TRACING */
74 74
75static void dtlk_timer_tick(unsigned long data);
75 76
76static int dtlk_major; 77static int dtlk_major;
77static int dtlk_port_lpc; 78static int dtlk_port_lpc;
@@ -81,7 +82,7 @@ static int dtlk_has_indexing;
81static unsigned int dtlk_portlist[] = 82static unsigned int dtlk_portlist[] =
82{0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0}; 83{0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
83static wait_queue_head_t dtlk_process_list; 84static wait_queue_head_t dtlk_process_list;
84static struct timer_list dtlk_timer; 85static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0);
85 86
86/* prototypes for file_operations struct */ 87/* prototypes for file_operations struct */
87static ssize_t dtlk_read(struct file *, char __user *, 88static ssize_t dtlk_read(struct file *, char __user *,
@@ -117,7 +118,6 @@ static char dtlk_write_tts(char);
117/* 118/*
118 static void dtlk_handle_error(char, char, unsigned int); 119 static void dtlk_handle_error(char, char, unsigned int);
119 */ 120 */
120static void dtlk_timer_tick(unsigned long data);
121 121
122static ssize_t dtlk_read(struct file *file, char __user *buf, 122static ssize_t dtlk_read(struct file *file, char __user *buf,
123 size_t count, loff_t * ppos) 123 size_t count, loff_t * ppos)
@@ -318,7 +318,7 @@ static int dtlk_release(struct inode *inode, struct file *file)
318 } 318 }
319 TRACE_RET; 319 TRACE_RET;
320 320
321 del_timer(&dtlk_timer); 321 del_timer_sync(&dtlk_timer);
322 322
323 return 0; 323 return 0;
324} 324}
@@ -336,8 +336,6 @@ static int __init dtlk_init(void)
336 if (dtlk_dev_probe() == 0) 336 if (dtlk_dev_probe() == 0)
337 printk(", MAJOR %d\n", dtlk_major); 337 printk(", MAJOR %d\n", dtlk_major);
338 338
339 init_timer(&dtlk_timer);
340 dtlk_timer.function = dtlk_timer_tick;
341 init_waitqueue_head(&dtlk_process_list); 339 init_waitqueue_head(&dtlk_process_list);
342 340
343 return 0; 341 return 0;
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c
index 88b9d338da53..f86fa0c55d36 100644
--- a/drivers/char/ip2/i2lib.c
+++ b/drivers/char/ip2/i2lib.c
@@ -80,7 +80,7 @@ static int i2RetryFlushOutput(i2ChanStrPtr);
80// Not a documented part of the library routines (careful...) but the Diagnostic 80// Not a documented part of the library routines (careful...) but the Diagnostic
81// i2diag.c finds them useful to help the throughput in certain limited 81// i2diag.c finds them useful to help the throughput in certain limited
82// single-threaded operations. 82// single-threaded operations.
83static void iiSendPendingMail(i2eBordStrPtr); 83static inline void iiSendPendingMail(i2eBordStrPtr);
84static void serviceOutgoingFifo(i2eBordStrPtr); 84static void serviceOutgoingFifo(i2eBordStrPtr);
85 85
86// Functions defined in ip2.c as part of interrupt handling 86// Functions defined in ip2.c as part of interrupt handling
@@ -150,6 +150,13 @@ i2Validate ( i2ChanStrPtr pCh )
150 == (CHANNEL_MAGIC | CHANNEL_SUPPORT)); 150 == (CHANNEL_MAGIC | CHANNEL_SUPPORT));
151} 151}
152 152
153static void iiSendPendingMail_t(unsigned long data)
154{
155 i2eBordStrPtr pB = (i2eBordStrPtr)data;
156
157 iiSendPendingMail(pB);
158}
159
153//****************************************************************************** 160//******************************************************************************
154// Function: iiSendPendingMail(pB) 161// Function: iiSendPendingMail(pB)
155// Parameters: Pointer to a board structure 162// Parameters: Pointer to a board structure
@@ -184,12 +191,9 @@ iiSendPendingMail(i2eBordStrPtr pB)
184 /\/\|=mhw=|\/\/ */ 191 /\/\|=mhw=|\/\/ */
185 192
186 if( ++pB->SendPendingRetry < 16 ) { 193 if( ++pB->SendPendingRetry < 16 ) {
187 194 setup_timer(&pB->SendPendingTimer,
188 init_timer( &(pB->SendPendingTimer) ); 195 iiSendPendingMail_t, (unsigned long)pB);
189 pB->SendPendingTimer.expires = jiffies + 1; 196 mod_timer(&pB->SendPendingTimer, jiffies + 1);
190 pB->SendPendingTimer.function = (void*)(unsigned long)iiSendPendingMail;
191 pB->SendPendingTimer.data = (unsigned long)pB;
192 add_timer( &(pB->SendPendingTimer) );
193 } else { 197 } else {
194 printk( KERN_ERR "IP2: iiSendPendingMail unable to queue outbound mail\n" ); 198 printk( KERN_ERR "IP2: iiSendPendingMail unable to queue outbound mail\n" );
195 } 199 }
@@ -1265,8 +1269,10 @@ i2RetryFlushOutput(i2ChanStrPtr pCh)
1265// soon as all the data is completely sent. 1269// soon as all the data is completely sent.
1266//****************************************************************************** 1270//******************************************************************************
1267static void 1271static void
1268i2DrainWakeup(i2ChanStrPtr pCh) 1272i2DrainWakeup(unsigned long d)
1269{ 1273{
1274 i2ChanStrPtr pCh = (i2ChanStrPtr)d;
1275
1270 ip2trace (CHANN, ITRC_DRAIN, 10, 1, pCh->BookmarkTimer.expires ); 1276 ip2trace (CHANN, ITRC_DRAIN, 10, 1, pCh->BookmarkTimer.expires );
1271 1277
1272 pCh->BookmarkTimer.expires = 0; 1278 pCh->BookmarkTimer.expires = 0;
@@ -1292,14 +1298,12 @@ i2DrainOutput(i2ChanStrPtr pCh, int timeout)
1292 } 1298 }
1293 if ((timeout > 0) && (pCh->BookmarkTimer.expires == 0 )) { 1299 if ((timeout > 0) && (pCh->BookmarkTimer.expires == 0 )) {
1294 // One per customer (channel) 1300 // One per customer (channel)
1295 init_timer( &(pCh->BookmarkTimer) ); 1301 setup_timer(&pCh->BookmarkTimer, i2DrainWakeup,
1296 pCh->BookmarkTimer.expires = jiffies + timeout; 1302 (unsigned long)pCh);
1297 pCh->BookmarkTimer.function = (void*)(unsigned long)i2DrainWakeup;
1298 pCh->BookmarkTimer.data = (unsigned long)pCh;
1299 1303
1300 ip2trace (CHANN, ITRC_DRAIN, 1, 1, pCh->BookmarkTimer.expires ); 1304 ip2trace (CHANN, ITRC_DRAIN, 1, 1, pCh->BookmarkTimer.expires );
1301 1305
1302 add_timer( &(pCh->BookmarkTimer) ); 1306 mod_timer(&pCh->BookmarkTimer, jiffies + timeout);
1303 } 1307 }
1304 1308
1305 i2QueueCommands( PTYPE_INLINE, pCh, -1, 1, CMD_BMARK_REQ ); 1309 i2QueueCommands( PTYPE_INLINE, pCh, -1, 1, CMD_BMARK_REQ );
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
index fab1b7d42858..65f2d3a96b85 100644
--- a/drivers/char/n_r3964.c
+++ b/drivers/char/n_r3964.c
@@ -1005,9 +1005,7 @@ static int r3964_open(struct tty_struct *tty)
1005 tty->disc_data = pInfo; 1005 tty->disc_data = pInfo;
1006 tty->receive_room = 65536; 1006 tty->receive_room = 65536;
1007 1007
1008 init_timer(&pInfo->tmr); 1008 setup_timer(&pInfo->tmr, on_timeout, (unsigned long)pInfo);
1009 pInfo->tmr.data = (unsigned long)pInfo;
1010 pInfo->tmr.function = on_timeout;
1011 1009
1012 return 0; 1010 return 0;
1013} 1011}
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
index 2d264971d839..2604246501e4 100644
--- a/drivers/char/nwbutton.c
+++ b/drivers/char/nwbutton.c
@@ -23,8 +23,11 @@
23#define __NWBUTTON_C /* Tell the header file who we are */ 23#define __NWBUTTON_C /* Tell the header file who we are */
24#include "nwbutton.h" 24#include "nwbutton.h"
25 25
26static void button_sequence_finished (unsigned long parameters);
27
26static int button_press_count; /* The count of button presses */ 28static int button_press_count; /* The count of button presses */
27static struct timer_list button_timer; /* Times for the end of a sequence */ 29/* Times for the end of a sequence */
30static DEFINE_TIMER(button_timer, button_sequence_finished, 0, 0);
28static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */ 31static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
29static char button_output_buffer[32]; /* Stores data to write out of device */ 32static char button_output_buffer[32]; /* Stores data to write out of device */
30static int bcount; /* The number of bytes in the buffer */ 33static int bcount; /* The number of bytes in the buffer */
@@ -146,14 +149,8 @@ static void button_sequence_finished (unsigned long parameters)
146 149
147static irqreturn_t button_handler (int irq, void *dev_id) 150static irqreturn_t button_handler (int irq, void *dev_id)
148{ 151{
149 if (button_press_count) {
150 del_timer (&button_timer);
151 }
152 button_press_count++; 152 button_press_count++;
153 init_timer (&button_timer); 153 mod_timer(&button_timer, jiffies + bdelay);
154 button_timer.function = button_sequence_finished;
155 button_timer.expires = (jiffies + bdelay);
156 add_timer (&button_timer);
157 154
158 return IRQ_HANDLED; 155 return IRQ_HANDLED;
159} 156}
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
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index e79b2ede8510..85c161845260 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -418,8 +418,7 @@ static void rio_pollfunc(unsigned long data)
418 func_enter(); 418 func_enter();
419 419
420 rio_interrupt(0, &p->RIOHosts[data]); 420 rio_interrupt(0, &p->RIOHosts[data]);
421 p->RIOHosts[data].timer.expires = jiffies + rio_poll; 421 mod_timer(&p->RIOHosts[data].timer, jiffies + rio_poll);
422 add_timer(&p->RIOHosts[data].timer);
423 422
424 func_exit(); 423 func_exit();
425} 424}
@@ -1154,13 +1153,10 @@ static int __init rio_init(void)
1154 /* Init the timer "always" to make sure that it can safely be 1153 /* Init the timer "always" to make sure that it can safely be
1155 deleted when we unload... */ 1154 deleted when we unload... */
1156 1155
1157 init_timer(&hp->timer); 1156 setup_timer(&hp->timer, rio_pollfunc, i);
1158 if (!hp->Ivec) { 1157 if (!hp->Ivec) {
1159 rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll); 1158 rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll);
1160 hp->timer.data = i; 1159 mod_timer(&hp->timer, jiffies + rio_poll);
1161 hp->timer.function = rio_pollfunc;
1162 hp->timer.expires = jiffies + rio_poll;
1163 add_timer(&hp->timer);
1164 } 1160 }
1165 } 1161 }
1166 1162
@@ -1191,7 +1187,7 @@ static void __exit rio_exit(void)
1191 rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec); 1187 rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec);
1192 } 1188 }
1193 /* It is safe/allowed to del_timer a non-active timer */ 1189 /* It is safe/allowed to del_timer a non-active timer */
1194 del_timer(&hp->timer); 1190 del_timer_sync(&hp->timer);
1195 if (hp->Caddr) 1191 if (hp->Caddr)
1196 iounmap(hp->Caddr); 1192 iounmap(hp->Caddr);
1197 if (hp->Type == RIO_PCI) 1193 if (hp->Type == RIO_PCI)
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 106f225e745f..76357c855ce3 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -106,6 +106,8 @@
106 106
107/****** RocketPort Local Variables ******/ 107/****** RocketPort Local Variables ******/
108 108
109static void rp_do_poll(unsigned long dummy);
110
109static struct tty_driver *rocket_driver; 111static struct tty_driver *rocket_driver;
110 112
111static struct rocket_version driver_version = { 113static struct rocket_version driver_version = {
@@ -116,7 +118,7 @@ static struct r_port *rp_table[MAX_RP_PORTS]; /* The main repository of
116static unsigned int xmit_flags[NUM_BOARDS]; /* Bit significant, indicates port had data to transmit. */ 118static unsigned int xmit_flags[NUM_BOARDS]; /* Bit significant, indicates port had data to transmit. */
117 /* eg. Bit 0 indicates port 0 has xmit data, ... */ 119 /* eg. Bit 0 indicates port 0 has xmit data, ... */
118static atomic_t rp_num_ports_open; /* Number of serial ports open */ 120static atomic_t rp_num_ports_open; /* Number of serial ports open */
119static struct timer_list rocket_timer; 121static DEFINE_TIMER(rocket_timer, rp_do_poll, 0, 0);
120 122
121static unsigned long board1; /* ISA addresses, retrieved from rocketport.conf */ 123static unsigned long board1; /* ISA addresses, retrieved from rocketport.conf */
122static unsigned long board2; 124static unsigned long board2;
@@ -2368,12 +2370,6 @@ static int __init rp_init(void)
2368 return -ENOMEM; 2370 return -ENOMEM;
2369 2371
2370 /* 2372 /*
2371 * Set up the timer channel.
2372 */
2373 init_timer(&rocket_timer);
2374 rocket_timer.function = rp_do_poll;
2375
2376 /*
2377 * Initialize the array of pointers to our own internal state 2373 * Initialize the array of pointers to our own internal state
2378 * structures. 2374 * structures.
2379 */ 2375 */
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 664f36c98e6a..b6d3072dce5a 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -135,7 +135,9 @@ static struct fasync_struct *rtc_async_queue;
135static DECLARE_WAIT_QUEUE_HEAD(rtc_wait); 135static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
136 136
137#ifdef RTC_IRQ 137#ifdef RTC_IRQ
138static struct timer_list rtc_irq_timer; 138static void rtc_dropped_irq(unsigned long data);
139
140static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
139#endif 141#endif
140 142
141static ssize_t rtc_read(struct file *file, char __user *buf, 143static ssize_t rtc_read(struct file *file, char __user *buf,
@@ -150,8 +152,6 @@ static unsigned int rtc_poll(struct file *file, poll_table *wait);
150 152
151static void get_rtc_alm_time (struct rtc_time *alm_tm); 153static void get_rtc_alm_time (struct rtc_time *alm_tm);
152#ifdef RTC_IRQ 154#ifdef RTC_IRQ
153static void rtc_dropped_irq(unsigned long data);
154
155static void set_rtc_irq_bit_locked(unsigned char bit); 155static void set_rtc_irq_bit_locked(unsigned char bit);
156static void mask_rtc_irq_bit_locked(unsigned char bit); 156static void mask_rtc_irq_bit_locked(unsigned char bit);
157 157
@@ -454,8 +454,8 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
454 454
455 spin_lock_irqsave (&rtc_lock, flags); 455 spin_lock_irqsave (&rtc_lock, flags);
456 if (!(rtc_status & RTC_TIMER_ON)) { 456 if (!(rtc_status & RTC_TIMER_ON)) {
457 rtc_irq_timer.expires = jiffies + HZ/rtc_freq + 2*HZ/100; 457 mod_timer(&rtc_irq_timer, jiffies + HZ/rtc_freq +
458 add_timer(&rtc_irq_timer); 458 2*HZ/100);
459 rtc_status |= RTC_TIMER_ON; 459 rtc_status |= RTC_TIMER_ON;
460 } 460 }
461 set_rtc_irq_bit_locked(RTC_PIE); 461 set_rtc_irq_bit_locked(RTC_PIE);
@@ -1084,8 +1084,6 @@ no_irq:
1084 if (rtc_has_irq == 0) 1084 if (rtc_has_irq == 0)
1085 goto no_irq2; 1085 goto no_irq2;
1086 1086
1087 init_timer(&rtc_irq_timer);
1088 rtc_irq_timer.function = rtc_dropped_irq;
1089 spin_lock_irq(&rtc_lock); 1087 spin_lock_irq(&rtc_lock);
1090 rtc_freq = 1024; 1088 rtc_freq = 1024;
1091 if (!hpet_set_periodic_freq(rtc_freq)) { 1089 if (!hpet_set_periodic_freq(rtc_freq)) {
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index f1688fe81ac7..baf7234b6e66 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -461,8 +461,7 @@ void missed_irq (unsigned long data)
461 sx_interrupt (((struct specialix_board *)data)->irq, 461 sx_interrupt (((struct specialix_board *)data)->irq,
462 (void*)data); 462 (void*)data);
463 } 463 }
464 missed_irq_timer.expires = jiffies + sx_poll; 464 mod_timer(&missed_irq_timer, jiffies + sx_poll);
465 add_timer (&missed_irq_timer);
466} 465}
467#endif 466#endif
468 467
@@ -597,11 +596,8 @@ static int sx_probe(struct specialix_board *bp)
597 dprintk (SX_DEBUG_INIT, " GFCR = 0x%02x\n", sx_in_off(bp, CD186x_GFRCR) ); 596 dprintk (SX_DEBUG_INIT, " GFCR = 0x%02x\n", sx_in_off(bp, CD186x_GFRCR) );
598 597
599#ifdef SPECIALIX_TIMER 598#ifdef SPECIALIX_TIMER
600 init_timer (&missed_irq_timer); 599 setup_timer(&missed_irq_timer, missed_irq, (unsigned long)bp);
601 missed_irq_timer.function = missed_irq; 600 mod_timer(&missed_irq_timer, jiffies + sx_poll);
602 missed_irq_timer.data = (unsigned long) bp;
603 missed_irq_timer.expires = jiffies + sx_poll;
604 add_timer (&missed_irq_timer);
605#endif 601#endif
606 602
607 printk(KERN_INFO"sx%d: specialix IO8+ board detected at 0x%03x, IRQ %d, CD%d Rev. %c.\n", 603 printk(KERN_INFO"sx%d: specialix IO8+ board detected at 0x%03x, IRQ %d, CD%d Rev. %c.\n",
@@ -2559,7 +2555,7 @@ static void __exit specialix_exit_module(void)
2559 if (sx_board[i].flags & SX_BOARD_PRESENT) 2555 if (sx_board[i].flags & SX_BOARD_PRESENT)
2560 sx_release_io_range(&sx_board[i]); 2556 sx_release_io_range(&sx_board[i]);
2561#ifdef SPECIALIX_TIMER 2557#ifdef SPECIALIX_TIMER
2562 del_timer (&missed_irq_timer); 2558 del_timer_sync(&missed_irq_timer);
2563#endif 2559#endif
2564 2560
2565 func_exit(); 2561 func_exit();
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index bf76db1342c5..ce4db6f52362 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -1798,9 +1798,7 @@ static int startup(struct mgsl_struct * info)
1798 1798
1799 memset(&info->icount, 0, sizeof(info->icount)); 1799 memset(&info->icount, 0, sizeof(info->icount));
1800 1800
1801 init_timer(&info->tx_timer); 1801 setup_timer(&info->tx_timer, mgsl_tx_timeout, (unsigned long)info);
1802 info->tx_timer.data = (unsigned long)info;
1803 info->tx_timer.function = mgsl_tx_timeout;
1804 1802
1805 /* Allocate and claim adapter resources */ 1803 /* Allocate and claim adapter resources */
1806 retval = mgsl_claim_resources(info); 1804 retval = mgsl_claim_resources(info);
@@ -1851,7 +1849,7 @@ static void shutdown(struct mgsl_struct * info)
1851 wake_up_interruptible(&info->status_event_wait_q); 1849 wake_up_interruptible(&info->status_event_wait_q);
1852 wake_up_interruptible(&info->event_wait_q); 1850 wake_up_interruptible(&info->event_wait_q);
1853 1851
1854 del_timer(&info->tx_timer); 1852 del_timer_sync(&info->tx_timer);
1855 1853
1856 if (info->xmit_buf) { 1854 if (info->xmit_buf) {
1857 free_page((unsigned long) info->xmit_buf); 1855 free_page((unsigned long) info->xmit_buf);
@@ -5710,8 +5708,8 @@ static void usc_start_transmitter( struct mgsl_struct *info )
5710 5708
5711 usc_TCmd( info, TCmd_SendFrame ); 5709 usc_TCmd( info, TCmd_SendFrame );
5712 5710
5713 info->tx_timer.expires = jiffies + msecs_to_jiffies(5000); 5711 mod_timer(&info->tx_timer, jiffies +
5714 add_timer(&info->tx_timer); 5712 msecs_to_jiffies(5000));
5715 } 5713 }
5716 info->tx_active = 1; 5714 info->tx_active = 1;
5717 } 5715 }
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 54af763518fe..0a367cd4121f 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1825,8 +1825,7 @@ static void rx_async(struct slgt_info *info)
1825 if (i < count) { 1825 if (i < count) {
1826 /* receive buffer not completed */ 1826 /* receive buffer not completed */
1827 info->rbuf_index += i; 1827 info->rbuf_index += i;
1828 info->rx_timer.expires = jiffies + 1; 1828 mod_timer(&info->rx_timer, jiffies + 1);
1829 add_timer(&info->rx_timer);
1830 break; 1829 break;
1831 } 1830 }
1832 1831
@@ -3340,13 +3339,8 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev
3340 info->adapter_num = adapter_num; 3339 info->adapter_num = adapter_num;
3341 info->port_num = port_num; 3340 info->port_num = port_num;
3342 3341
3343 init_timer(&info->tx_timer); 3342 setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info);
3344 info->tx_timer.data = (unsigned long)info; 3343 setup_timer(&info->rx_timer, rx_timeout, (unsigned long)info);
3345 info->tx_timer.function = tx_timeout;
3346
3347 init_timer(&info->rx_timer);
3348 info->rx_timer.data = (unsigned long)info;
3349 info->rx_timer.function = rx_timeout;
3350 3344
3351 /* Copy configuration info to device instance data */ 3345 /* Copy configuration info to device instance data */
3352 info->pdev = pdev; 3346 info->pdev = pdev;
@@ -3794,10 +3788,9 @@ static void tx_start(struct slgt_info *info)
3794 } 3788 }
3795 } 3789 }
3796 3790
3797 if (info->params.mode == MGSL_MODE_HDLC) { 3791 if (info->params.mode == MGSL_MODE_HDLC)
3798 info->tx_timer.expires = jiffies + msecs_to_jiffies(5000); 3792 mod_timer(&info->tx_timer, jiffies +
3799 add_timer(&info->tx_timer); 3793 msecs_to_jiffies(5000));
3800 }
3801 } else { 3794 } else {
3802 tdma_reset(info); 3795 tdma_reset(info);
3803 /* set 1st descriptor address */ 3796 /* set 1st descriptor address */
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index ebde4e552335..ef93d055bdd7 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -2744,8 +2744,7 @@ static int startup(SLMP_INFO * info)
2744 2744
2745 change_params(info); 2745 change_params(info);
2746 2746
2747 info->status_timer.expires = jiffies + msecs_to_jiffies(10); 2747 mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10));
2748 add_timer(&info->status_timer);
2749 2748
2750 if (info->tty) 2749 if (info->tty)
2751 clear_bit(TTY_IO_ERROR, &info->tty->flags); 2750 clear_bit(TTY_IO_ERROR, &info->tty->flags);
@@ -3841,13 +3840,9 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev)
3841 info->bus_type = MGSL_BUS_TYPE_PCI; 3840 info->bus_type = MGSL_BUS_TYPE_PCI;
3842 info->irq_flags = IRQF_SHARED; 3841 info->irq_flags = IRQF_SHARED;
3843 3842
3844 init_timer(&info->tx_timer); 3843 setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info);
3845 info->tx_timer.data = (unsigned long)info; 3844 setup_timer(&info->status_timer, status_timeout,
3846 info->tx_timer.function = tx_timeout; 3845 (unsigned long)info);
3847
3848 init_timer(&info->status_timer);
3849 info->status_timer.data = (unsigned long)info;
3850 info->status_timer.function = status_timeout;
3851 3846
3852 /* Store the PCI9050 misc control register value because a flaw 3847 /* Store the PCI9050 misc control register value because a flaw
3853 * in the PCI9050 prevents LCR registers from being read if 3848 * in the PCI9050 prevents LCR registers from being read if
@@ -4291,8 +4286,8 @@ void tx_start(SLMP_INFO *info)
4291 write_reg(info, TXDMA + DIR, 0x40); /* enable Tx DMA interrupts (EOM) */ 4286 write_reg(info, TXDMA + DIR, 0x40); /* enable Tx DMA interrupts (EOM) */
4292 write_reg(info, TXDMA + DSR, 0xf2); /* clear Tx DMA IRQs, enable Tx DMA */ 4287 write_reg(info, TXDMA + DSR, 0xf2); /* clear Tx DMA IRQs, enable Tx DMA */
4293 4288
4294 info->tx_timer.expires = jiffies + msecs_to_jiffies(5000); 4289 mod_timer(&info->tx_timer, jiffies +
4295 add_timer(&info->tx_timer); 4290 msecs_to_jiffies(5000));
4296 } 4291 }
4297 else { 4292 else {
4298 tx_load_fifo(info); 4293 tx_load_fifo(info);
@@ -5574,10 +5569,7 @@ void status_timeout(unsigned long context)
5574 if (status) 5569 if (status)
5575 isr_io_pin(info,status); 5570 isr_io_pin(info,status);
5576 5571
5577 info->status_timer.data = (unsigned long)info; 5572 mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10));
5578 info->status_timer.function = status_timeout;
5579 info->status_timer.expires = jiffies + msecs_to_jiffies(10);
5580 add_timer(&info->status_timer);
5581} 5573}
5582 5574
5583 5575
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 33e1f66e39cb..2f572b97c16d 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1107,9 +1107,8 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend
1107 1107
1108 INIT_WORK(&chip->work, timeout_work); 1108 INIT_WORK(&chip->work, timeout_work);
1109 1109
1110 init_timer(&chip->user_read_timer); 1110 setup_timer(&chip->user_read_timer, user_reader_timeout,
1111 chip->user_read_timer.function = user_reader_timeout; 1111 (unsigned long)chip);
1112 chip->user_read_timer.data = (unsigned long) chip;
1113 1112
1114 memcpy(&chip->vendor, entry, sizeof(struct tpm_vendor_specific)); 1113 memcpy(&chip->vendor, entry, sizeof(struct tpm_vendor_specific));
1115 1114
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 13299b8fdbd6..d6694163b6f1 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -210,7 +210,7 @@ static int scrollback_delta;
210 */ 210 */
211int (*console_blank_hook)(int); 211int (*console_blank_hook)(int);
212 212
213static struct timer_list console_timer; 213static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
214static int blank_state; 214static int blank_state;
215static int blank_timer_expired; 215static int blank_timer_expired;
216enum { 216enum {
@@ -2625,8 +2625,6 @@ static int __init con_init(void)
2625 for (i = 0; i < MAX_NR_CONSOLES; i++) 2625 for (i = 0; i < MAX_NR_CONSOLES; i++)
2626 con_driver_map[i] = conswitchp; 2626 con_driver_map[i] = conswitchp;
2627 2627
2628 init_timer(&console_timer);
2629 console_timer.function = blank_screen_t;
2630 if (blankinterval) { 2628 if (blankinterval) {
2631 blank_state = blank_normal_wait; 2629 blank_state = blank_normal_wait;
2632 mod_timer(&console_timer, jiffies + blankinterval); 2630 mod_timer(&console_timer, jiffies + blankinterval);