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/dtlk.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/dtlk.c')
-rw-r--r-- | drivers/char/dtlk.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index d4005e94fe5f..d8dbdb916232 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c | |||
@@ -72,6 +72,7 @@ | |||
72 | #define TRACE_RET ((void) 0) | 72 | #define TRACE_RET ((void) 0) |
73 | #endif /* TRACING */ | 73 | #endif /* TRACING */ |
74 | 74 | ||
75 | static void dtlk_timer_tick(unsigned long data); | ||
75 | 76 | ||
76 | static int dtlk_major; | 77 | static int dtlk_major; |
77 | static int dtlk_port_lpc; | 78 | static int dtlk_port_lpc; |
@@ -81,7 +82,7 @@ static int dtlk_has_indexing; | |||
81 | static unsigned int dtlk_portlist[] = | 82 | static unsigned int dtlk_portlist[] = |
82 | {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0}; | 83 | {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0}; |
83 | static wait_queue_head_t dtlk_process_list; | 84 | static wait_queue_head_t dtlk_process_list; |
84 | static struct timer_list dtlk_timer; | 85 | static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0); |
85 | 86 | ||
86 | /* prototypes for file_operations struct */ | 87 | /* prototypes for file_operations struct */ |
87 | static ssize_t dtlk_read(struct file *, char __user *, | 88 | static ssize_t dtlk_read(struct file *, char __user *, |
@@ -117,7 +118,6 @@ static char dtlk_write_tts(char); | |||
117 | /* | 118 | /* |
118 | static void dtlk_handle_error(char, char, unsigned int); | 119 | static void dtlk_handle_error(char, char, unsigned int); |
119 | */ | 120 | */ |
120 | static void dtlk_timer_tick(unsigned long data); | ||
121 | 121 | ||
122 | static ssize_t dtlk_read(struct file *file, char __user *buf, | 122 | static ssize_t dtlk_read(struct file *file, char __user *buf, |
123 | size_t count, loff_t * ppos) | 123 | size_t count, loff_t * ppos) |
@@ -318,7 +318,7 @@ static int dtlk_release(struct inode *inode, struct file *file) | |||
318 | } | 318 | } |
319 | TRACE_RET; | 319 | TRACE_RET; |
320 | 320 | ||
321 | del_timer(&dtlk_timer); | 321 | del_timer_sync(&dtlk_timer); |
322 | 322 | ||
323 | return 0; | 323 | return 0; |
324 | } | 324 | } |
@@ -336,8 +336,6 @@ static int __init dtlk_init(void) | |||
336 | if (dtlk_dev_probe() == 0) | 336 | if (dtlk_dev_probe() == 0) |
337 | printk(", MAJOR %d\n", dtlk_major); | 337 | printk(", MAJOR %d\n", dtlk_major); |
338 | 338 | ||
339 | init_timer(&dtlk_timer); | ||
340 | dtlk_timer.function = dtlk_timer_tick; | ||
341 | init_waitqueue_head(&dtlk_process_list); | 339 | init_waitqueue_head(&dtlk_process_list); |
342 | 340 | ||
343 | return 0; | 341 | return 0; |