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/rio | |
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/rio')
-rw-r--r-- | drivers/char/rio/rio_linux.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index e79b2ede8510..85c161845260 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -418,8 +418,7 @@ static void rio_pollfunc(unsigned long data) | |||
418 | func_enter(); | 418 | func_enter(); |
419 | 419 | ||
420 | rio_interrupt(0, &p->RIOHosts[data]); | 420 | rio_interrupt(0, &p->RIOHosts[data]); |
421 | p->RIOHosts[data].timer.expires = jiffies + rio_poll; | 421 | mod_timer(&p->RIOHosts[data].timer, jiffies + rio_poll); |
422 | add_timer(&p->RIOHosts[data].timer); | ||
423 | 422 | ||
424 | func_exit(); | 423 | func_exit(); |
425 | } | 424 | } |
@@ -1154,13 +1153,10 @@ static int __init rio_init(void) | |||
1154 | /* Init the timer "always" to make sure that it can safely be | 1153 | /* Init the timer "always" to make sure that it can safely be |
1155 | deleted when we unload... */ | 1154 | deleted when we unload... */ |
1156 | 1155 | ||
1157 | init_timer(&hp->timer); | 1156 | setup_timer(&hp->timer, rio_pollfunc, i); |
1158 | if (!hp->Ivec) { | 1157 | if (!hp->Ivec) { |
1159 | rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll); | 1158 | rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll); |
1160 | hp->timer.data = i; | 1159 | mod_timer(&hp->timer, jiffies + rio_poll); |
1161 | hp->timer.function = rio_pollfunc; | ||
1162 | hp->timer.expires = jiffies + rio_poll; | ||
1163 | add_timer(&hp->timer); | ||
1164 | } | 1160 | } |
1165 | } | 1161 | } |
1166 | 1162 | ||
@@ -1191,7 +1187,7 @@ static void __exit rio_exit(void) | |||
1191 | rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec); | 1187 | rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec); |
1192 | } | 1188 | } |
1193 | /* It is safe/allowed to del_timer a non-active timer */ | 1189 | /* It is safe/allowed to del_timer a non-active timer */ |
1194 | del_timer(&hp->timer); | 1190 | del_timer_sync(&hp->timer); |
1195 | if (hp->Caddr) | 1191 | if (hp->Caddr) |
1196 | iounmap(hp->Caddr); | 1192 | iounmap(hp->Caddr); |
1197 | if (hp->Type == RIO_PCI) | 1193 | if (hp->Type == RIO_PCI) |