aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha/kernel/srmcons.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 08:51:57 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 14:42:21 -0500
commit5e88e6c4e8b044a1d275f1a599128b95046d2968 (patch)
tree38c1e622a0ca33ea65333c4c701f4a9376c72861 /arch/alpha/kernel/srmcons.c
parent26b23209c0ea5503824df60b8f218fb04b80cad0 (diff)
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/kernel/srmcons.c')
-rw-r--r--arch/alpha/kernel/srmcons.c14
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)
79 } 79 }
80 80
81 spin_lock(&srmconsp->lock); 81 spin_lock(&srmconsp->lock);
82 if (srmconsp->tty) { 82 if (srmconsp->tty)
83 srmconsp->timer.expires = jiffies + incr; 83 mod_timer(&srmconsp->timer, jiffies + incr);
84 add_timer(&srmconsp->timer);
85 }
86 spin_unlock(&srmconsp->lock); 84 spin_unlock(&srmconsp->lock);
87 85
88 local_irq_restore(flags); 86 local_irq_restore(flags);
@@ -172,7 +170,8 @@ srmcons_get_private_struct(struct srmcons_private **ps)
172 else { 170 else {
173 srmconsp->tty = NULL; 171 srmconsp->tty = NULL;
174 spin_lock_init(&srmconsp->lock); 172 spin_lock_init(&srmconsp->lock);
175 init_timer(&srmconsp->timer); 173 setup_timer(&srmconsp->timer, srmcons_receive_chars,
174 (unsigned long)srmconsp);
176 } 175 }
177 176
178 spin_unlock_irqrestore(&srmconsp_lock, flags); 177 spin_unlock_irqrestore(&srmconsp_lock, flags);
@@ -199,10 +198,7 @@ srmcons_open(struct tty_struct *tty, struct file *filp)
199 tty->driver_data = srmconsp; 198 tty->driver_data = srmconsp;
200 199
201 srmconsp->tty = tty; 200 srmconsp->tty = tty;
202 srmconsp->timer.function = srmcons_receive_chars; 201 mod_timer(&srmconsp->timer, jiffies + 10);
203 srmconsp->timer.data = (unsigned long)srmconsp;
204 srmconsp->timer.expires = jiffies + 10;
205 add_timer(&srmconsp->timer);
206 } 202 }
207 203
208 spin_unlock_irqrestore(&srmconsp->lock, flags); 204 spin_unlock_irqrestore(&srmconsp->lock, flags);