diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-03-05 14:51:57 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 11:42:21 -0800 |
commit | 5e88e6c4e8b044a1d275f1a599128b95046d2968 (patch) | |
tree | 38c1e622a0ca33ea65333c4c701f4a9376c72861 /arch/alpha | |
parent | 26b23209c0ea5503824df60b8f218fb04b80cad0 (diff) | |
download | linux-stable-5e88e6c4e8b044a1d275f1a599128b95046d2968.tar.gz linux-stable-5e88e6c4e8b044a1d275f1a599128b95046d2968.tar.bz2 linux-stable-5e88e6c4e8b044a1d275f1a599128b95046d2968.zip |
ALPHA: srmcons, use timer functions
It makes the code more readable. We move the setup to the allocation
location because we need to initialize timers only once.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/alpha')
-rw-r--r-- | arch/alpha/kernel/srmcons.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c index 783f4e50c111..f1fdf178bcb4 100644 --- a/arch/alpha/kernel/srmcons.c +++ b/arch/alpha/kernel/srmcons.c @@ -79,10 +79,8 @@ srmcons_receive_chars(unsigned long data) } spin_lock(&srmconsp->lock); - if (srmconsp->tty) { - srmconsp->timer.expires = jiffies + incr; - add_timer(&srmconsp->timer); - } + if (srmconsp->tty) + mod_timer(&srmconsp->timer, jiffies + incr); spin_unlock(&srmconsp->lock); local_irq_restore(flags); @@ -172,7 +170,8 @@ srmcons_get_private_struct(struct srmcons_private **ps) else { srmconsp->tty = NULL; spin_lock_init(&srmconsp->lock); - init_timer(&srmconsp->timer); + setup_timer(&srmconsp->timer, srmcons_receive_chars, + (unsigned long)srmconsp); } spin_unlock_irqrestore(&srmconsp_lock, flags); @@ -199,10 +198,7 @@ srmcons_open(struct tty_struct *tty, struct file *filp) tty->driver_data = srmconsp; srmconsp->tty = tty; - srmconsp->timer.function = srmcons_receive_chars; - srmconsp->timer.data = (unsigned long)srmconsp; - srmconsp->timer.expires = jiffies + 10; - add_timer(&srmconsp->timer); + mod_timer(&srmconsp->timer, jiffies + 10); } spin_unlock_irqrestore(&srmconsp->lock, flags); |