[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:
committed by
Linus Torvalds
parent
d096f3e989
commit
40565f1962
@@ -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 */
|
||||
|
Reference in New Issue
Block a user