aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rtc.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-02-12 03:52:31 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:30 -0500
commit40565f1962c5be9b9e285e05af01ab7771534868 (patch)
treeae84097778a8adfc5a9aad8a5428fe803d54346a /drivers/char/rtc.c
parentd096f3e9898d469493fc0afe88d7285c4bdc3ce2 (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/rtc.c')
-rw-r--r--drivers/char/rtc.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 664f36c98e6a..b6d3072dce5a 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -135,7 +135,9 @@ static struct fasync_struct *rtc_async_queue;
135static DECLARE_WAIT_QUEUE_HEAD(rtc_wait); 135static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
136 136
137#ifdef RTC_IRQ 137#ifdef RTC_IRQ
138static struct timer_list rtc_irq_timer; 138static void rtc_dropped_irq(unsigned long data);
139
140static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
139#endif 141#endif
140 142
141static ssize_t rtc_read(struct file *file, char __user *buf, 143static ssize_t rtc_read(struct file *file, char __user *buf,
@@ -150,8 +152,6 @@ static unsigned int rtc_poll(struct file *file, poll_table *wait);
150 152
151static void get_rtc_alm_time (struct rtc_time *alm_tm); 153static void get_rtc_alm_time (struct rtc_time *alm_tm);
152#ifdef RTC_IRQ 154#ifdef RTC_IRQ
153static void rtc_dropped_irq(unsigned long data);
154
155static void set_rtc_irq_bit_locked(unsigned char bit); 155static void set_rtc_irq_bit_locked(unsigned char bit);
156static void mask_rtc_irq_bit_locked(unsigned char bit); 156static void mask_rtc_irq_bit_locked(unsigned char bit);
157 157
@@ -454,8 +454,8 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
454 454
455 spin_lock_irqsave (&rtc_lock, flags); 455 spin_lock_irqsave (&rtc_lock, flags);
456 if (!(rtc_status & RTC_TIMER_ON)) { 456 if (!(rtc_status & RTC_TIMER_ON)) {
457 rtc_irq_timer.expires = jiffies + HZ/rtc_freq + 2*HZ/100; 457 mod_timer(&rtc_irq_timer, jiffies + HZ/rtc_freq +
458 add_timer(&rtc_irq_timer); 458 2*HZ/100);
459 rtc_status |= RTC_TIMER_ON; 459 rtc_status |= RTC_TIMER_ON;
460 } 460 }
461 set_rtc_irq_bit_locked(RTC_PIE); 461 set_rtc_irq_bit_locked(RTC_PIE);
@@ -1084,8 +1084,6 @@ no_irq:
1084 if (rtc_has_irq == 0) 1084 if (rtc_has_irq == 0)
1085 goto no_irq2; 1085 goto no_irq2;
1086 1086
1087 init_timer(&rtc_irq_timer);
1088 rtc_irq_timer.function = rtc_dropped_irq;
1089 spin_lock_irq(&rtc_lock); 1087 spin_lock_irq(&rtc_lock);
1090 rtc_freq = 1024; 1088 rtc_freq = 1024;
1091 if (!hpet_set_periodic_freq(rtc_freq)) { 1089 if (!hpet_set_periodic_freq(rtc_freq)) {