diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2007-02-12 03:52:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:30 -0500 |
commit | 40565f1962c5be9b9e285e05af01ab7771534868 (patch) | |
tree | ae84097778a8adfc5a9aad8a5428fe803d54346a /drivers/char/synclinkmp.c | |
parent | d096f3e9898d469493fc0afe88d7285c4bdc3ce2 (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/synclinkmp.c')
-rw-r--r-- | drivers/char/synclinkmp.c | 22 |
1 files changed, 7 insertions, 15 deletions
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 | ||