dect
/
linux-2.6
Archived
13
0
Fork 0

[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>
This commit is contained in:
Jiri Slaby 2007-02-12 00:52:31 -08:00 committed by Linus Torvalds
parent d096f3e989
commit 40565f1962
17 changed files with 75 additions and 123 deletions

View File

@ -376,10 +376,8 @@ via_dmablit_handler(drm_device_t *dev, int engine, int from_irq)
blitq->cur = cur; blitq->cur = cur;
blitq->num_outstanding--; blitq->num_outstanding--;
blitq->end = jiffies + DRM_HZ; blitq->end = jiffies + DRM_HZ;
if (!timer_pending(&blitq->poll_timer)) { if (!timer_pending(&blitq->poll_timer))
blitq->poll_timer.expires = jiffies+1; mod_timer(&blitq->poll_timer, jiffies + 1);
add_timer(&blitq->poll_timer);
}
} else { } else {
if (timer_pending(&blitq->poll_timer)) { if (timer_pending(&blitq->poll_timer)) {
del_timer(&blitq->poll_timer); del_timer(&blitq->poll_timer);
@ -478,8 +476,7 @@ via_dmablit_timer(unsigned long data)
via_dmablit_handler(dev, engine, 0); via_dmablit_handler(dev, engine, 0);
if (!timer_pending(&blitq->poll_timer)) { if (!timer_pending(&blitq->poll_timer)) {
blitq->poll_timer.expires = jiffies+1; mod_timer(&blitq->poll_timer, jiffies + 1);
add_timer(&blitq->poll_timer);
/* /*
* Rerun handler to delete timer if engines are off, and * 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); DRM_INIT_WAITQUEUE(&blitq->busy_queue);
INIT_WORK(&blitq->wq, via_dmablit_workqueue); INIT_WORK(&blitq->wq, via_dmablit_workqueue);
init_timer(&blitq->poll_timer); setup_timer(&blitq->poll_timer, via_dmablit_timer,
blitq->poll_timer.function = &via_dmablit_timer; (unsigned long)blitq);
blitq->poll_timer.data = (unsigned long) blitq;
} }
} }

View File

@ -72,6 +72,7 @@
#define TRACE_RET ((void) 0) #define TRACE_RET ((void) 0)
#endif /* TRACING */ #endif /* TRACING */
static void dtlk_timer_tick(unsigned long data);
static int dtlk_major; static int dtlk_major;
static int dtlk_port_lpc; static int dtlk_port_lpc;
@ -81,7 +82,7 @@ static int dtlk_has_indexing;
static unsigned int dtlk_portlist[] = static unsigned int dtlk_portlist[] =
{0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0}; {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
static wait_queue_head_t dtlk_process_list; 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 */ /* prototypes for file_operations struct */
static ssize_t dtlk_read(struct file *, char __user *, 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_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, static ssize_t dtlk_read(struct file *file, char __user *buf,
size_t count, loff_t * ppos) size_t count, loff_t * ppos)
@ -318,7 +318,7 @@ static int dtlk_release(struct inode *inode, struct file *file)
} }
TRACE_RET; TRACE_RET;
del_timer(&dtlk_timer); del_timer_sync(&dtlk_timer);
return 0; return 0;
} }
@ -336,8 +336,6 @@ static int __init dtlk_init(void)
if (dtlk_dev_probe() == 0) if (dtlk_dev_probe() == 0)
printk(", MAJOR %d\n", dtlk_major); printk(", MAJOR %d\n", dtlk_major);
init_timer(&dtlk_timer);
dtlk_timer.function = dtlk_timer_tick;
init_waitqueue_head(&dtlk_process_list); init_waitqueue_head(&dtlk_process_list);
return 0; return 0;

View File

@ -80,7 +80,7 @@ static int i2RetryFlushOutput(i2ChanStrPtr);
// Not a documented part of the library routines (careful...) but the Diagnostic // Not a documented part of the library routines (careful...) but the Diagnostic
// i2diag.c finds them useful to help the throughput in certain limited // i2diag.c finds them useful to help the throughput in certain limited
// single-threaded operations. // single-threaded operations.
static void iiSendPendingMail(i2eBordStrPtr); static inline void iiSendPendingMail(i2eBordStrPtr);
static void serviceOutgoingFifo(i2eBordStrPtr); static void serviceOutgoingFifo(i2eBordStrPtr);
// Functions defined in ip2.c as part of interrupt handling // Functions defined in ip2.c as part of interrupt handling
@ -150,6 +150,13 @@ i2Validate ( i2ChanStrPtr pCh )
== (CHANNEL_MAGIC | CHANNEL_SUPPORT)); == (CHANNEL_MAGIC | CHANNEL_SUPPORT));
} }
static void iiSendPendingMail_t(unsigned long data)
{
i2eBordStrPtr pB = (i2eBordStrPtr)data;
iiSendPendingMail(pB);
}
//****************************************************************************** //******************************************************************************
// Function: iiSendPendingMail(pB) // Function: iiSendPendingMail(pB)
// Parameters: Pointer to a board structure // Parameters: Pointer to a board structure
@ -184,12 +191,9 @@ iiSendPendingMail(i2eBordStrPtr pB)
/\/\|=mhw=|\/\/ */ /\/\|=mhw=|\/\/ */
if( ++pB->SendPendingRetry < 16 ) { if( ++pB->SendPendingRetry < 16 ) {
setup_timer(&pB->SendPendingTimer,
init_timer( &(pB->SendPendingTimer) ); iiSendPendingMail_t, (unsigned long)pB);
pB->SendPendingTimer.expires = jiffies + 1; mod_timer(&pB->SendPendingTimer, jiffies + 1);
pB->SendPendingTimer.function = (void*)(unsigned long)iiSendPendingMail;
pB->SendPendingTimer.data = (unsigned long)pB;
add_timer( &(pB->SendPendingTimer) );
} else { } else {
printk( KERN_ERR "IP2: iiSendPendingMail unable to queue outbound mail\n" ); 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. // soon as all the data is completely sent.
//****************************************************************************** //******************************************************************************
static void static void
i2DrainWakeup(i2ChanStrPtr pCh) i2DrainWakeup(unsigned long d)
{ {
i2ChanStrPtr pCh = (i2ChanStrPtr)d;
ip2trace (CHANN, ITRC_DRAIN, 10, 1, pCh->BookmarkTimer.expires ); ip2trace (CHANN, ITRC_DRAIN, 10, 1, pCh->BookmarkTimer.expires );
pCh->BookmarkTimer.expires = 0; pCh->BookmarkTimer.expires = 0;
@ -1292,14 +1298,12 @@ i2DrainOutput(i2ChanStrPtr pCh, int timeout)
} }
if ((timeout > 0) && (pCh->BookmarkTimer.expires == 0 )) { if ((timeout > 0) && (pCh->BookmarkTimer.expires == 0 )) {
// One per customer (channel) // One per customer (channel)
init_timer( &(pCh->BookmarkTimer) ); setup_timer(&pCh->BookmarkTimer, i2DrainWakeup,
pCh->BookmarkTimer.expires = jiffies + timeout; (unsigned long)pCh);
pCh->BookmarkTimer.function = (void*)(unsigned long)i2DrainWakeup;
pCh->BookmarkTimer.data = (unsigned long)pCh;
ip2trace (CHANN, ITRC_DRAIN, 1, 1, pCh->BookmarkTimer.expires ); 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 ); i2QueueCommands( PTYPE_INLINE, pCh, -1, 1, CMD_BMARK_REQ );

View File

@ -1005,9 +1005,7 @@ static int r3964_open(struct tty_struct *tty)
tty->disc_data = pInfo; tty->disc_data = pInfo;
tty->receive_room = 65536; tty->receive_room = 65536;
init_timer(&pInfo->tmr); setup_timer(&pInfo->tmr, on_timeout, (unsigned long)pInfo);
pInfo->tmr.data = (unsigned long)pInfo;
pInfo->tmr.function = on_timeout;
return 0; return 0;
} }

View File

@ -23,8 +23,11 @@
#define __NWBUTTON_C /* Tell the header file who we are */ #define __NWBUTTON_C /* Tell the header file who we are */
#include "nwbutton.h" #include "nwbutton.h"
static void button_sequence_finished (unsigned long parameters);
static int button_press_count; /* The count of button presses */ 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 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 char button_output_buffer[32]; /* Stores data to write out of device */
static int bcount; /* The number of bytes in the buffer */ 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) static irqreturn_t button_handler (int irq, void *dev_id)
{ {
if (button_press_count) {
del_timer (&button_timer);
}
button_press_count++; button_press_count++;
init_timer (&button_timer); mod_timer(&button_timer, jiffies + bdelay);
button_timer.function = button_sequence_finished;
button_timer.expires = (jiffies + bdelay);
add_timer (&button_timer);
return IRQ_HANDLED; return IRQ_HANDLED;
} }

View File

@ -946,8 +946,7 @@ release_io:
return_with_timer: return_with_timer:
DEBUGP(7, dev, "<- monitor_card (returns with timer)\n"); DEBUGP(7, dev, "<- monitor_card (returns with timer)\n");
dev->timer.expires = jiffies + dev->mdelay; mod_timer(&dev->timer, jiffies + dev->mdelay);
add_timer(&dev->timer);
clear_bit(LOCK_MONITOR, &dev->flags); clear_bit(LOCK_MONITOR, &dev->flags);
} }
@ -1406,12 +1405,9 @@ static void start_monitor(struct cm4000_dev *dev)
DEBUGP(3, dev, "-> start_monitor\n"); DEBUGP(3, dev, "-> start_monitor\n");
if (!dev->monitor_running) { if (!dev->monitor_running) {
DEBUGP(5, dev, "create, init and add timer\n"); 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->monitor_running = 1;
dev->timer.expires = jiffies; mod_timer(&dev->timer, jiffies);
dev->timer.data = (unsigned long) dev;
dev->timer.function = monitor_card;
add_timer(&dev->timer);
} else } else
DEBUGP(5, dev, "monitor already running\n"); DEBUGP(5, dev, "monitor already running\n");
DEBUGP(3, dev, "<- start_monitor\n"); DEBUGP(3, dev, "<- start_monitor\n");

View File

@ -632,8 +632,7 @@ static int reader_probe(struct pcmcia_device *link)
init_waitqueue_head(&dev->poll_wait); init_waitqueue_head(&dev->poll_wait);
init_waitqueue_head(&dev->read_wait); init_waitqueue_head(&dev->read_wait);
init_waitqueue_head(&dev->write_wait); init_waitqueue_head(&dev->write_wait);
init_timer(&dev->poll_timer); setup_timer(&dev->poll_timer, cm4040_do_poll, 0);
dev->poll_timer.function = &cm4040_do_poll;
ret = reader_config(link, i); ret = reader_config(link, i);
if (ret) if (ret)

View File

@ -1361,9 +1361,7 @@ static int startup(MGSLPC_INFO * info)
memset(&info->icount, 0, sizeof(info->icount)); memset(&info->icount, 0, sizeof(info->icount));
init_timer(&info->tx_timer); setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info);
info->tx_timer.data = (unsigned long)info;
info->tx_timer.function = tx_timeout;
/* Allocate and claim adapter resources */ /* Allocate and claim adapter resources */
retval = claim_resources(info); 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->status_event_wait_q);
wake_up_interruptible(&info->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) { if (info->tx_buf) {
free_page((unsigned long) info->tx_buf); free_page((unsigned long) info->tx_buf);
@ -3549,8 +3547,8 @@ static void tx_start(MGSLPC_INFO *info)
} else { } else {
info->tx_active = 1; info->tx_active = 1;
tx_ready(info); tx_ready(info);
info->tx_timer.expires = jiffies + msecs_to_jiffies(5000); mod_timer(&info->tx_timer, jiffies +
add_timer(&info->tx_timer); msecs_to_jiffies(5000));
} }
} }

View File

@ -418,8 +418,7 @@ static void rio_pollfunc(unsigned long data)
func_enter(); func_enter();
rio_interrupt(0, &p->RIOHosts[data]); rio_interrupt(0, &p->RIOHosts[data]);
p->RIOHosts[data].timer.expires = jiffies + rio_poll; mod_timer(&p->RIOHosts[data].timer, jiffies + rio_poll);
add_timer(&p->RIOHosts[data].timer);
func_exit(); func_exit();
} }
@ -1154,13 +1153,10 @@ static int __init rio_init(void)
/* Init the timer "always" to make sure that it can safely be /* Init the timer "always" to make sure that it can safely be
deleted when we unload... */ deleted when we unload... */
init_timer(&hp->timer); setup_timer(&hp->timer, rio_pollfunc, i);
if (!hp->Ivec) { if (!hp->Ivec) {
rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll); rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll);
hp->timer.data = i; mod_timer(&hp->timer, jiffies + rio_poll);
hp->timer.function = rio_pollfunc;
hp->timer.expires = jiffies + rio_poll;
add_timer(&hp->timer);
} }
} }
@ -1191,7 +1187,7 @@ static void __exit rio_exit(void)
rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec); rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec);
} }
/* It is safe/allowed to del_timer a non-active timer */ /* It is safe/allowed to del_timer a non-active timer */
del_timer(&hp->timer); del_timer_sync(&hp->timer);
if (hp->Caddr) if (hp->Caddr)
iounmap(hp->Caddr); iounmap(hp->Caddr);
if (hp->Type == RIO_PCI) if (hp->Type == RIO_PCI)

View File

@ -106,6 +106,8 @@
/****** RocketPort Local Variables ******/ /****** RocketPort Local Variables ******/
static void rp_do_poll(unsigned long dummy);
static struct tty_driver *rocket_driver; static struct tty_driver *rocket_driver;
static struct rocket_version driver_version = { 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. */ static unsigned int xmit_flags[NUM_BOARDS]; /* Bit significant, indicates port had data to transmit. */
/* eg. Bit 0 indicates port 0 has xmit data, ... */ /* eg. Bit 0 indicates port 0 has xmit data, ... */
static atomic_t rp_num_ports_open; /* Number of serial ports open */ 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 board1; /* ISA addresses, retrieved from rocketport.conf */
static unsigned long board2; static unsigned long board2;
@ -2367,12 +2369,6 @@ static int __init rp_init(void)
if (!rocket_driver) if (!rocket_driver)
return -ENOMEM; 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 * Initialize the array of pointers to our own internal state
* structures. * structures.

View File

@ -135,7 +135,9 @@ static struct fasync_struct *rtc_async_queue;
static DECLARE_WAIT_QUEUE_HEAD(rtc_wait); static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
#ifdef RTC_IRQ #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 #endif
static ssize_t rtc_read(struct file *file, char __user *buf, 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); static void get_rtc_alm_time (struct rtc_time *alm_tm);
#ifdef RTC_IRQ #ifdef RTC_IRQ
static void rtc_dropped_irq(unsigned long data);
static void set_rtc_irq_bit_locked(unsigned char bit); static void set_rtc_irq_bit_locked(unsigned char bit);
static void mask_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); spin_lock_irqsave (&rtc_lock, flags);
if (!(rtc_status & RTC_TIMER_ON)) { if (!(rtc_status & RTC_TIMER_ON)) {
rtc_irq_timer.expires = jiffies + HZ/rtc_freq + 2*HZ/100; mod_timer(&rtc_irq_timer, jiffies + HZ/rtc_freq +
add_timer(&rtc_irq_timer); 2*HZ/100);
rtc_status |= RTC_TIMER_ON; rtc_status |= RTC_TIMER_ON;
} }
set_rtc_irq_bit_locked(RTC_PIE); set_rtc_irq_bit_locked(RTC_PIE);
@ -1084,8 +1084,6 @@ no_irq:
if (rtc_has_irq == 0) if (rtc_has_irq == 0)
goto no_irq2; goto no_irq2;
init_timer(&rtc_irq_timer);
rtc_irq_timer.function = rtc_dropped_irq;
spin_lock_irq(&rtc_lock); spin_lock_irq(&rtc_lock);
rtc_freq = 1024; rtc_freq = 1024;
if (!hpet_set_periodic_freq(rtc_freq)) { if (!hpet_set_periodic_freq(rtc_freq)) {

View File

@ -461,8 +461,7 @@ void missed_irq (unsigned long data)
sx_interrupt (((struct specialix_board *)data)->irq, sx_interrupt (((struct specialix_board *)data)->irq,
(void*)data); (void*)data);
} }
missed_irq_timer.expires = jiffies + sx_poll; mod_timer(&missed_irq_timer, jiffies + sx_poll);
add_timer (&missed_irq_timer);
} }
#endif #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) ); dprintk (SX_DEBUG_INIT, " GFCR = 0x%02x\n", sx_in_off(bp, CD186x_GFRCR) );
#ifdef SPECIALIX_TIMER #ifdef SPECIALIX_TIMER
init_timer (&missed_irq_timer); setup_timer(&missed_irq_timer, missed_irq, (unsigned long)bp);
missed_irq_timer.function = missed_irq; mod_timer(&missed_irq_timer, jiffies + sx_poll);
missed_irq_timer.data = (unsigned long) bp;
missed_irq_timer.expires = jiffies + sx_poll;
add_timer (&missed_irq_timer);
#endif #endif
printk(KERN_INFO"sx%d: specialix IO8+ board detected at 0x%03x, IRQ %d, CD%d Rev. %c.\n", 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) if (sx_board[i].flags & SX_BOARD_PRESENT)
sx_release_io_range(&sx_board[i]); sx_release_io_range(&sx_board[i]);
#ifdef SPECIALIX_TIMER #ifdef SPECIALIX_TIMER
del_timer (&missed_irq_timer); del_timer_sync(&missed_irq_timer);
#endif #endif
func_exit(); func_exit();

View File

@ -1798,9 +1798,7 @@ static int startup(struct mgsl_struct * info)
memset(&info->icount, 0, sizeof(info->icount)); memset(&info->icount, 0, sizeof(info->icount));
init_timer(&info->tx_timer); setup_timer(&info->tx_timer, mgsl_tx_timeout, (unsigned long)info);
info->tx_timer.data = (unsigned long)info;
info->tx_timer.function = mgsl_tx_timeout;
/* Allocate and claim adapter resources */ /* Allocate and claim adapter resources */
retval = mgsl_claim_resources(info); 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->status_event_wait_q);
wake_up_interruptible(&info->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) { if (info->xmit_buf) {
free_page((unsigned long) 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 ); usc_TCmd( info, TCmd_SendFrame );
info->tx_timer.expires = jiffies + msecs_to_jiffies(5000); mod_timer(&info->tx_timer, jiffies +
add_timer(&info->tx_timer); msecs_to_jiffies(5000));
} }
info->tx_active = 1; info->tx_active = 1;
} }

View File

@ -1825,8 +1825,7 @@ static void rx_async(struct slgt_info *info)
if (i < count) { if (i < count) {
/* receive buffer not completed */ /* receive buffer not completed */
info->rbuf_index += i; info->rbuf_index += i;
info->rx_timer.expires = jiffies + 1; mod_timer(&info->rx_timer, jiffies + 1);
add_timer(&info->rx_timer);
break; 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->adapter_num = adapter_num;
info->port_num = port_num; info->port_num = port_num;
init_timer(&info->tx_timer); setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info);
info->tx_timer.data = (unsigned long)info; setup_timer(&info->rx_timer, rx_timeout, (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;
/* Copy configuration info to device instance data */ /* Copy configuration info to device instance data */
info->pdev = pdev; info->pdev = pdev;
@ -3794,10 +3788,9 @@ static void tx_start(struct slgt_info *info)
} }
} }
if (info->params.mode == MGSL_MODE_HDLC) { if (info->params.mode == MGSL_MODE_HDLC)
info->tx_timer.expires = jiffies + msecs_to_jiffies(5000); mod_timer(&info->tx_timer, jiffies +
add_timer(&info->tx_timer); msecs_to_jiffies(5000));
}
} else { } else {
tdma_reset(info); tdma_reset(info);
/* set 1st descriptor address */ /* set 1st descriptor address */

View File

@ -2744,8 +2744,7 @@ static int startup(SLMP_INFO * info)
change_params(info); change_params(info);
info->status_timer.expires = jiffies + msecs_to_jiffies(10); mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10));
add_timer(&info->status_timer);
if (info->tty) if (info->tty)
clear_bit(TTY_IO_ERROR, &info->tty->flags); 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->bus_type = MGSL_BUS_TYPE_PCI;
info->irq_flags = IRQF_SHARED; info->irq_flags = IRQF_SHARED;
init_timer(&info->tx_timer); setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info);
info->tx_timer.data = (unsigned long)info; setup_timer(&info->status_timer, status_timeout,
info->tx_timer.function = tx_timeout; (unsigned long)info);
init_timer(&info->status_timer);
info->status_timer.data = (unsigned long)info;
info->status_timer.function = status_timeout;
/* Store the PCI9050 misc control register value because a flaw /* Store the PCI9050 misc control register value because a flaw
* in the PCI9050 prevents LCR registers from being read if * 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 + DIR, 0x40); /* enable Tx DMA interrupts (EOM) */
write_reg(info, TXDMA + DSR, 0xf2); /* clear Tx DMA IRQs, enable Tx DMA */ write_reg(info, TXDMA + DSR, 0xf2); /* clear Tx DMA IRQs, enable Tx DMA */
info->tx_timer.expires = jiffies + msecs_to_jiffies(5000); mod_timer(&info->tx_timer, jiffies +
add_timer(&info->tx_timer); msecs_to_jiffies(5000));
} }
else { else {
tx_load_fifo(info); tx_load_fifo(info);
@ -5574,10 +5569,7 @@ void status_timeout(unsigned long context)
if (status) if (status)
isr_io_pin(info,status); isr_io_pin(info,status);
info->status_timer.data = (unsigned long)info; mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10));
info->status_timer.function = status_timeout;
info->status_timer.expires = jiffies + msecs_to_jiffies(10);
add_timer(&info->status_timer);
} }

View 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_WORK(&chip->work, timeout_work);
init_timer(&chip->user_read_timer); setup_timer(&chip->user_read_timer, user_reader_timeout,
chip->user_read_timer.function = user_reader_timeout; (unsigned long)chip);
chip->user_read_timer.data = (unsigned long) chip;
memcpy(&chip->vendor, entry, sizeof(struct tpm_vendor_specific)); memcpy(&chip->vendor, entry, sizeof(struct tpm_vendor_specific));

View File

@ -210,7 +210,7 @@ static int scrollback_delta;
*/ */
int (*console_blank_hook)(int); 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_state;
static int blank_timer_expired; static int blank_timer_expired;
enum { enum {
@ -2625,8 +2625,6 @@ static int __init con_init(void)
for (i = 0; i < MAX_NR_CONSOLES; i++) for (i = 0; i < MAX_NR_CONSOLES; i++)
con_driver_map[i] = conswitchp; con_driver_map[i] = conswitchp;
init_timer(&console_timer);
console_timer.function = blank_screen_t;
if (blankinterval) { if (blankinterval) {
blank_state = blank_normal_wait; blank_state = blank_normal_wait;
mod_timer(&console_timer, jiffies + blankinterval); mod_timer(&console_timer, jiffies + blankinterval);