[PATCH] Char: timers cleanup
authorJiri Slaby <jirislaby@gmail.com>
Mon, 12 Feb 2007 08:52:31 +0000 (00:52 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 12 Feb 2007 17:48:30 +0000 (09:48 -0800)
- 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>
17 files changed:
drivers/char/drm/via_dmablit.c
drivers/char/dtlk.c
drivers/char/ip2/i2lib.c
drivers/char/n_r3964.c
drivers/char/nwbutton.c
drivers/char/pcmcia/cm4000_cs.c
drivers/char/pcmcia/cm4040_cs.c
drivers/char/pcmcia/synclink_cs.c
drivers/char/rio/rio_linux.c
drivers/char/rocket.c
drivers/char/rtc.c
drivers/char/specialix.c
drivers/char/synclink.c
drivers/char/synclink_gt.c
drivers/char/synclinkmp.c
drivers/char/tpm/tpm.c
drivers/char/vt.c

index 2054d5773717ac6952fcfcf84186930c022067a5..2881a06b6f558a614bcc9c9de1fd8a6822c923b7 100644 (file)
@@ -376,10 +376,8 @@ via_dmablit_handler(drm_device_t *dev, int engine, int from_irq)
                        blitq->cur = cur;
                        blitq->num_outstanding--;
                        blitq->end = jiffies + DRM_HZ;
-                       if (!timer_pending(&blitq->poll_timer)) {
-                               blitq->poll_timer.expires = jiffies+1;
-                               add_timer(&blitq->poll_timer);
-                       }
+                       if (!timer_pending(&blitq->poll_timer))
+                               mod_timer(&blitq->poll_timer, jiffies + 1);
                } else {
                        if (timer_pending(&blitq->poll_timer)) {
                                del_timer(&blitq->poll_timer);
@@ -478,8 +476,7 @@ via_dmablit_timer(unsigned long data)
        via_dmablit_handler(dev, engine, 0);
        
        if (!timer_pending(&blitq->poll_timer)) {
-               blitq->poll_timer.expires = jiffies+1;
-               add_timer(&blitq->poll_timer);
+               mod_timer(&blitq->poll_timer, jiffies + 1);
 
               /*
                * Rerun handler to delete timer if engines are off, and
@@ -574,9 +571,8 @@ via_init_dmablit(drm_device_t *dev)
                }
                DRM_INIT_WAITQUEUE(&blitq->busy_queue);
                INIT_WORK(&blitq->wq, via_dmablit_workqueue);
-               init_timer(&blitq->poll_timer);
-               blitq->poll_timer.function = &via_dmablit_timer;
-               blitq->poll_timer.data = (unsigned long) blitq;
+               setup_timer(&blitq->poll_timer, via_dmablit_timer,
+                               (unsigned long)blitq);
        }       
 }
 
index d4005e94fe5f36b90b56e3f7f299c3c82c3fef21..d8dbdb9162329c62bcb8821547cb70c2c94102ee 100644 (file)
@@ -72,6 +72,7 @@
 #define TRACE_RET ((void) 0)
 #endif                         /* TRACING */
 
+static void dtlk_timer_tick(unsigned long data);
 
 static int dtlk_major;
 static int dtlk_port_lpc;
@@ -81,7 +82,7 @@ static int dtlk_has_indexing;
 static unsigned int dtlk_portlist[] =
 {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
 static wait_queue_head_t dtlk_process_list;
-static struct timer_list dtlk_timer;
+static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0);
 
 /* prototypes for file_operations struct */
 static ssize_t dtlk_read(struct file *, char __user *,
@@ -117,7 +118,6 @@ static char dtlk_write_tts(char);
 /*
    static void dtlk_handle_error(char, char, unsigned int);
  */
-static void dtlk_timer_tick(unsigned long data);
 
 static ssize_t dtlk_read(struct file *file, char __user *buf,
                         size_t count, loff_t * ppos)
@@ -318,7 +318,7 @@ static int dtlk_release(struct inode *inode, struct file *file)
        }
        TRACE_RET;
        
-       del_timer(&dtlk_timer);
+       del_timer_sync(&dtlk_timer);
 
        return 0;
 }
@@ -336,8 +336,6 @@ static int __init dtlk_init(void)
        if (dtlk_dev_probe() == 0)
                printk(", MAJOR %d\n", dtlk_major);
 
-       init_timer(&dtlk_timer);
-       dtlk_timer.function = dtlk_timer_tick;
        init_waitqueue_head(&dtlk_process_list);
 
        return 0;
index 88b9d338da5352bb5acd5be3222c95aa3b6c479a..f86fa0c55d364b05131574d6b48a73be996d5872 100644 (file)
@@ -80,7 +80,7 @@ static int i2RetryFlushOutput(i2ChanStrPtr);
 // Not a documented part of the library routines (careful...) but the Diagnostic
 // i2diag.c finds them useful to help the throughput in certain limited
 // single-threaded operations.
-static void iiSendPendingMail(i2eBordStrPtr);
+static inline void iiSendPendingMail(i2eBordStrPtr);
 static void serviceOutgoingFifo(i2eBordStrPtr);
 
 // Functions defined in ip2.c as part of interrupt handling
@@ -150,6 +150,13 @@ i2Validate ( i2ChanStrPtr pCh )
                          == (CHANNEL_MAGIC | CHANNEL_SUPPORT));
 }
 
+static void iiSendPendingMail_t(unsigned long data)
+{
+       i2eBordStrPtr pB = (i2eBordStrPtr)data;
+
+       iiSendPendingMail(pB);
+}
+
 //******************************************************************************
 // Function:   iiSendPendingMail(pB)
 // Parameters: Pointer to a board structure
@@ -184,12 +191,9 @@ iiSendPendingMail(i2eBordStrPtr pB)
                        /\/\|=mhw=|\/\/                         */
 
                        if( ++pB->SendPendingRetry < 16 ) {
-
-                               init_timer( &(pB->SendPendingTimer) );
-                               pB->SendPendingTimer.expires  = jiffies + 1;
-                               pB->SendPendingTimer.function = (void*)(unsigned long)iiSendPendingMail;
-                               pB->SendPendingTimer.data     = (unsigned long)pB;
-                               add_timer( &(pB->SendPendingTimer) );
+                               setup_timer(&pB->SendPendingTimer,
+                                       iiSendPendingMail_t, (unsigned long)pB);
+                               mod_timer(&pB->SendPendingTimer, jiffies + 1);
                        } else {
                                printk( KERN_ERR "IP2: iiSendPendingMail unable to queue outbound mail\n" );
                        }
@@ -1265,8 +1269,10 @@ i2RetryFlushOutput(i2ChanStrPtr pCh)
 // soon as all the data is completely sent.
 //******************************************************************************
 static void
-i2DrainWakeup(i2ChanStrPtr pCh)
+i2DrainWakeup(unsigned long d)
 {
+       i2ChanStrPtr pCh = (i2ChanStrPtr)d;
+
        ip2trace (CHANN, ITRC_DRAIN, 10, 1, pCh->BookmarkTimer.expires );
 
        pCh->BookmarkTimer.expires = 0;
@@ -1292,14 +1298,12 @@ i2DrainOutput(i2ChanStrPtr pCh, int timeout)
        }
        if ((timeout > 0) && (pCh->BookmarkTimer.expires == 0 )) {
                // One per customer (channel)
-               init_timer( &(pCh->BookmarkTimer) );
-               pCh->BookmarkTimer.expires  = jiffies + timeout;
-               pCh->BookmarkTimer.function = (void*)(unsigned long)i2DrainWakeup;
-               pCh->BookmarkTimer.data     = (unsigned long)pCh;
+               setup_timer(&pCh->BookmarkTimer, i2DrainWakeup,
+                               (unsigned long)pCh);
 
                ip2trace (CHANN, ITRC_DRAIN, 1, 1, pCh->BookmarkTimer.expires );
 
-               add_timer( &(pCh->BookmarkTimer) );
+               mod_timer(&pCh->BookmarkTimer, jiffies + timeout);
        }
        
        i2QueueCommands( PTYPE_INLINE, pCh, -1, 1, CMD_BMARK_REQ );
index fab1b7d42858ad5a258863a84b43cf12e150f500..65f2d3a96b85dd80e9400e9c730482596f009e9f 100644 (file)
@@ -1005,9 +1005,7 @@ static int r3964_open(struct tty_struct *tty)
        tty->disc_data = pInfo;
        tty->receive_room = 65536;
 
-       init_timer(&pInfo->tmr);
-       pInfo->tmr.data = (unsigned long)pInfo;
-       pInfo->tmr.function = on_timeout;
+       setup_timer(&pInfo->tmr, on_timeout, (unsigned long)pInfo);
 
        return 0;
 }
index 2d264971d839809d70ba8fe780ed3ba6ef89ff33..2604246501e499eda6568527e4c64d8b5a13bc48 100644 (file)
 #define __NWBUTTON_C           /* Tell the header file who we are */
 #include "nwbutton.h"
 
+static void button_sequence_finished (unsigned long parameters);
+
 static int button_press_count;         /* The count of button presses */
-static struct timer_list button_timer; /* Times for the end of a sequence */ 
+/* Times for the end of a sequence */
+static DEFINE_TIMER(button_timer, button_sequence_finished, 0, 0);
 static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
 static char button_output_buffer[32];  /* Stores data to write out of device */
 static int bcount;                     /* The number of bytes in the buffer */
@@ -146,14 +149,8 @@ static void button_sequence_finished (unsigned long parameters)
 
 static irqreturn_t button_handler (int irq, void *dev_id)
 {
-       if (button_press_count) {
-               del_timer (&button_timer);
-       }
        button_press_count++;
-       init_timer (&button_timer);
-       button_timer.function = button_sequence_finished;
-       button_timer.expires = (jiffies + bdelay);
-       add_timer (&button_timer);
+       mod_timer(&button_timer, jiffies + bdelay);
 
        return IRQ_HANDLED;
 }
index 211c93fda6fc6c789bbe5edc55b4c0618ae98661..e91b43a014b09edf096ce80e8d40ec2f1fee4880 100644 (file)
@@ -946,8 +946,7 @@ release_io:
 
 return_with_timer:
        DEBUGP(7, dev, "<- monitor_card (returns with timer)\n");
-       dev->timer.expires = jiffies + dev->mdelay;
-       add_timer(&dev->timer);
+       mod_timer(&dev->timer, jiffies + dev->mdelay);
        clear_bit(LOCK_MONITOR, &dev->flags);
 }
 
@@ -1406,12 +1405,9 @@ static void start_monitor(struct cm4000_dev *dev)
        DEBUGP(3, dev, "-> start_monitor\n");
        if (!dev->monitor_running) {
                DEBUGP(5, dev, "create, init and add timer\n");
-               init_timer(&dev->timer);
+               setup_timer(&dev->timer, monitor_card, (unsigned long)dev);
                dev->monitor_running = 1;
-               dev->timer.expires = jiffies;
-               dev->timer.data = (unsigned long) dev;
-               dev->timer.function = monitor_card;
-               add_timer(&dev->timer);
+               mod_timer(&dev->timer, jiffies);
        } else
                DEBUGP(5, dev, "monitor already running\n");
        DEBUGP(3, dev, "<- start_monitor\n");
index 9b1ff7e8f896b9257163e6b32549b4cb455dc5f0..0e82968c2f38ee74c30e6c0a779f365d2c5f5a52 100644 (file)
@@ -632,8 +632,7 @@ static int reader_probe(struct pcmcia_device *link)
        init_waitqueue_head(&dev->poll_wait);
        init_waitqueue_head(&dev->read_wait);
        init_waitqueue_head(&dev->write_wait);
-       init_timer(&dev->poll_timer);
-       dev->poll_timer.function = &cm4040_do_poll;
+       setup_timer(&dev->poll_timer, cm4040_do_poll, 0);
 
        ret = reader_config(link, i);
        if (ret)
index 4ab2c98f978cb5eab5321c3a3a7cde9ae6addfca..8d025e9b5bceea3039f2c53e0dab3186e23ecebf 100644 (file)
@@ -1361,9 +1361,7 @@ static int startup(MGSLPC_INFO * info)
        
        memset(&info->icount, 0, sizeof(info->icount));
 
-       init_timer(&info->tx_timer);
-       info->tx_timer.data = (unsigned long)info;
-       info->tx_timer.function = tx_timeout;
+       setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info);
 
        /* Allocate and claim adapter resources */
        retval = claim_resources(info);
@@ -1408,7 +1406,7 @@ static void shutdown(MGSLPC_INFO * info)
        wake_up_interruptible(&info->status_event_wait_q);
        wake_up_interruptible(&info->event_wait_q);
 
-       del_timer(&info->tx_timer);     
+       del_timer_sync(&info->tx_timer);
 
        if (info->tx_buf) {
                free_page((unsigned long) info->tx_buf);
@@ -3549,8 +3547,8 @@ static void tx_start(MGSLPC_INFO *info)
                } else {
                        info->tx_active = 1;
                        tx_ready(info);
-                       info->tx_timer.expires = jiffies + msecs_to_jiffies(5000);
-                       add_timer(&info->tx_timer);     
+                       mod_timer(&info->tx_timer, jiffies +
+                                       msecs_to_jiffies(5000));
                }
        }
 
index e79b2ede8510c6cecbffffa1c0ba72f2823de580..85c1618452605819fa2110f9a68cb208dc46df84 100644 (file)
@@ -418,8 +418,7 @@ static void rio_pollfunc(unsigned long data)
        func_enter();
 
        rio_interrupt(0, &p->RIOHosts[data]);
-       p->RIOHosts[data].timer.expires = jiffies + rio_poll;
-       add_timer(&p->RIOHosts[data].timer);
+       mod_timer(&p->RIOHosts[data].timer, jiffies + rio_poll);
 
        func_exit();
 }
@@ -1154,13 +1153,10 @@ static int __init rio_init(void)
                /* Init the timer "always" to make sure that it can safely be
                   deleted when we unload... */
 
-               init_timer(&hp->timer);
+               setup_timer(&hp->timer, rio_pollfunc, i);
                if (!hp->Ivec) {
                        rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll);
-                       hp->timer.data = i;
-                       hp->timer.function = rio_pollfunc;
-                       hp->timer.expires = jiffies + rio_poll;
-                       add_timer(&hp->timer);
+                       mod_timer(&hp->timer, jiffies + rio_poll);
                }
        }
 
@@ -1191,7 +1187,7 @@ static void __exit rio_exit(void)
                        rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec);
                }
                /* It is safe/allowed to del_timer a non-active timer */
-               del_timer(&hp->timer);
+               del_timer_sync(&hp->timer);
                if (hp->Caddr)
                        iounmap(hp->Caddr);
                if (hp->Type == RIO_PCI)
index 106f225e745fa72f07a8689f11eff4f1b0bdcb06..76357c855ce3b0324c5dd26873ec85cf3971cc78 100644 (file)
 
 /****** RocketPort Local Variables ******/
 
+static void rp_do_poll(unsigned long dummy);
+
 static struct tty_driver *rocket_driver;
 
 static struct rocket_version driver_version = {        
@@ -116,7 +118,7 @@ static struct r_port *rp_table[MAX_RP_PORTS];              /*  The main repository of
 static unsigned int xmit_flags[NUM_BOARDS];           /*  Bit significant, indicates port had data to transmit. */
                                                       /*  eg.  Bit 0 indicates port 0 has xmit data, ...        */
 static atomic_t rp_num_ports_open;                    /*  Number of serial ports open                           */
-static struct timer_list rocket_timer;
+static DEFINE_TIMER(rocket_timer, rp_do_poll, 0, 0);
 
 static unsigned long board1;                          /* ISA addresses, retrieved from rocketport.conf          */
 static unsigned long board2;
@@ -2367,12 +2369,6 @@ static int __init rp_init(void)
        if (!rocket_driver)
                return -ENOMEM;
 
-       /*
-        * Set up the timer channel.
-        */
-       init_timer(&rocket_timer);
-       rocket_timer.function = rp_do_poll;
-
        /*
         * Initialize the array of pointers to our own internal state
         * structures.
index 664f36c98e6acc4f257759aaff8c5586f48653e2..b6d3072dce5aabd956c5eef07c010f7ec8db7c7c 100644 (file)
@@ -135,7 +135,9 @@ static struct fasync_struct *rtc_async_queue;
 static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
 
 #ifdef RTC_IRQ
-static struct timer_list rtc_irq_timer;
+static void rtc_dropped_irq(unsigned long data);
+
+static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
 #endif
 
 static 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);
 
 static void get_rtc_alm_time (struct rtc_time *alm_tm);
 #ifdef RTC_IRQ
-static void rtc_dropped_irq(unsigned long data);
-
 static void set_rtc_irq_bit_locked(unsigned char bit);
 static void mask_rtc_irq_bit_locked(unsigned char bit);
 
@@ -454,8 +454,8 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
 
                spin_lock_irqsave (&rtc_lock, flags);
                if (!(rtc_status & RTC_TIMER_ON)) {
-                       rtc_irq_timer.expires = jiffies + HZ/rtc_freq + 2*HZ/100;
-                       add_timer(&rtc_irq_timer);
+                       mod_timer(&rtc_irq_timer, jiffies + HZ/rtc_freq +
+                                       2*HZ/100);
                        rtc_status |= RTC_TIMER_ON;
                }
                set_rtc_irq_bit_locked(RTC_PIE);
@@ -1084,8 +1084,6 @@ no_irq:
        if (rtc_has_irq == 0)
                goto no_irq2;
 
-       init_timer(&rtc_irq_timer);
-       rtc_irq_timer.function = rtc_dropped_irq;
        spin_lock_irq(&rtc_lock);
        rtc_freq = 1024;
        if (!hpet_set_periodic_freq(rtc_freq)) {
index f1688fe81ac7b6187b66455be492315043131876..baf7234b6e662fd8277368ecdf854ca2246de4d6 100644 (file)
@@ -461,8 +461,7 @@ void missed_irq (unsigned long data)
                sx_interrupt (((struct specialix_board *)data)->irq,
                                (void*)data);
        }
-       missed_irq_timer.expires = jiffies + sx_poll;
-       add_timer (&missed_irq_timer);
+       mod_timer(&missed_irq_timer, jiffies + sx_poll);
 }
 #endif
 
@@ -597,11 +596,8 @@ static int sx_probe(struct specialix_board *bp)
        dprintk (SX_DEBUG_INIT, " GFCR = 0x%02x\n", sx_in_off(bp, CD186x_GFRCR) );
 
 #ifdef SPECIALIX_TIMER
-       init_timer (&missed_irq_timer);
-       missed_irq_timer.function = missed_irq;
-       missed_irq_timer.data = (unsigned long) bp;
-       missed_irq_timer.expires = jiffies + sx_poll;
-       add_timer (&missed_irq_timer);
+       setup_timer(&missed_irq_timer, missed_irq, (unsigned long)bp);
+       mod_timer(&missed_irq_timer, jiffies + sx_poll);
 #endif
 
        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)
                if (sx_board[i].flags & SX_BOARD_PRESENT)
                        sx_release_io_range(&sx_board[i]);
 #ifdef SPECIALIX_TIMER
-       del_timer (&missed_irq_timer);
+       del_timer_sync(&missed_irq_timer);
 #endif
 
        func_exit();
index bf76db1342c5883efe06d6f56230f8ea482f8c95..ce4db6f523627ebf0f1ca7841e65a30922c12204 100644 (file)
@@ -1798,9 +1798,7 @@ static int startup(struct mgsl_struct * info)
        
        memset(&info->icount, 0, sizeof(info->icount));
 
-       init_timer(&info->tx_timer);
-       info->tx_timer.data = (unsigned long)info;
-       info->tx_timer.function = mgsl_tx_timeout;
+       setup_timer(&info->tx_timer, mgsl_tx_timeout, (unsigned long)info);
        
        /* Allocate and claim adapter resources */
        retval = mgsl_claim_resources(info);
@@ -1851,7 +1849,7 @@ static void shutdown(struct mgsl_struct * info)
        wake_up_interruptible(&info->status_event_wait_q);
        wake_up_interruptible(&info->event_wait_q);
 
-       del_timer(&info->tx_timer);     
+       del_timer_sync(&info->tx_timer);
 
        if (info->xmit_buf) {
                free_page((unsigned long) info->xmit_buf);
@@ -5710,8 +5708,8 @@ static void usc_start_transmitter( struct mgsl_struct *info )
                        
                        usc_TCmd( info, TCmd_SendFrame );
                        
-                       info->tx_timer.expires = jiffies + msecs_to_jiffies(5000);
-                       add_timer(&info->tx_timer);     
+                       mod_timer(&info->tx_timer, jiffies +
+                                       msecs_to_jiffies(5000));
                }
                info->tx_active = 1;
        }
index 54af763518fefde65774091d6dc8591c025f53c1..0a367cd4121ffc0ab127bcc64e4838da82d98c79 100644 (file)
@@ -1825,8 +1825,7 @@ static void rx_async(struct slgt_info *info)
                if (i < count) {
                        /* receive buffer not completed */
                        info->rbuf_index += i;
-                       info->rx_timer.expires = jiffies + 1;
-                       add_timer(&info->rx_timer);
+                       mod_timer(&info->rx_timer, jiffies + 1);
                        break;
                }
 
@@ -3340,13 +3339,8 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev
                info->adapter_num = adapter_num;
                info->port_num = port_num;
 
-               init_timer(&info->tx_timer);
-               info->tx_timer.data = (unsigned long)info;
-               info->tx_timer.function = tx_timeout;
-
-               init_timer(&info->rx_timer);
-               info->rx_timer.data = (unsigned long)info;
-               info->rx_timer.function = rx_timeout;
+               setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info);
+               setup_timer(&info->rx_timer, rx_timeout, (unsigned long)info);
 
                /* Copy configuration info to device instance data */
                info->pdev = pdev;
@@ -3794,10 +3788,9 @@ static void tx_start(struct slgt_info *info)
                                }
                        }
 
-                       if (info->params.mode == MGSL_MODE_HDLC) {
-                               info->tx_timer.expires = jiffies + msecs_to_jiffies(5000);
-                               add_timer(&info->tx_timer);
-                       }
+                       if (info->params.mode == MGSL_MODE_HDLC)
+                               mod_timer(&info->tx_timer, jiffies +
+                                               msecs_to_jiffies(5000));
                } else {
                        tdma_reset(info);
                        /* set 1st descriptor address */
index ebde4e55233560eacc7513de2571e3b0213a3c47..ef93d055bdd79dc64ba7889b64e87e2a67f3c597 100644 (file)
@@ -2744,8 +2744,7 @@ static int startup(SLMP_INFO * info)
 
        change_params(info);
 
-       info->status_timer.expires = jiffies + msecs_to_jiffies(10);
-       add_timer(&info->status_timer);
+       mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10));
 
        if (info->tty)
                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)
                info->bus_type = MGSL_BUS_TYPE_PCI;
                info->irq_flags = IRQF_SHARED;
 
-               init_timer(&info->tx_timer);
-               info->tx_timer.data = (unsigned long)info;
-               info->tx_timer.function = tx_timeout;
-
-               init_timer(&info->status_timer);
-               info->status_timer.data = (unsigned long)info;
-               info->status_timer.function = status_timeout;
+               setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info);
+               setup_timer(&info->status_timer, status_timeout,
+                               (unsigned long)info);
 
                /* Store the PCI9050 misc control register value because a flaw
                 * in the PCI9050 prevents LCR registers from being read if
@@ -4291,8 +4286,8 @@ void tx_start(SLMP_INFO *info)
                        write_reg(info, TXDMA + DIR, 0x40);             /* enable Tx DMA interrupts (EOM) */
                        write_reg(info, TXDMA + DSR, 0xf2);             /* clear Tx DMA IRQs, enable Tx DMA */
        
-                       info->tx_timer.expires = jiffies + msecs_to_jiffies(5000);
-                       add_timer(&info->tx_timer);
+                       mod_timer(&info->tx_timer, jiffies +
+                                       msecs_to_jiffies(5000));
                }
                else {
                        tx_load_fifo(info);
@@ -5574,10 +5569,7 @@ void status_timeout(unsigned long context)
        if (status)
                isr_io_pin(info,status);
 
-       info->status_timer.data = (unsigned long)info;
-       info->status_timer.function = status_timeout;
-       info->status_timer.expires = jiffies + msecs_to_jiffies(10);
-       add_timer(&info->status_timer);
+       mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10));
 }
 
 
index 33e1f66e39cb62550a762724b8dcbfd4d7d5326b..2f572b97c16d94390adb7507b4cc4befc1f95adc 100644 (file)
@@ -1107,9 +1107,8 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend
 
        INIT_WORK(&chip->work, timeout_work);
 
-       init_timer(&chip->user_read_timer);
-       chip->user_read_timer.function = user_reader_timeout;
-       chip->user_read_timer.data = (unsigned long) chip;
+       setup_timer(&chip->user_read_timer, user_reader_timeout,
+                       (unsigned long)chip);
 
        memcpy(&chip->vendor, entry, sizeof(struct tpm_vendor_specific));
 
index 13299b8fdbd673218e01494982d5c0e8df50d9c2..d6694163b6f1db001c8392859194caec1653672c 100644 (file)
@@ -210,7 +210,7 @@ static int scrollback_delta;
  */
 int (*console_blank_hook)(int);
 
-static struct timer_list console_timer;
+static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
 static int blank_state;
 static int blank_timer_expired;
 enum {
@@ -2625,8 +2625,6 @@ static int __init con_init(void)
        for (i = 0; i < MAX_NR_CONSOLES; i++)
                con_driver_map[i] = conswitchp;
 
-       init_timer(&console_timer);
-       console_timer.function = blank_screen_t;
        if (blankinterval) {
                blank_state = blank_normal_wait;
                mod_timer(&console_timer, jiffies + blankinterval);