diff options
| author | Luca Falavigna <dktrkranz@gmail.com> | 2005-06-28 23:44:42 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-29 00:20:29 -0400 |
| commit | 47f176fdaf8924bc83fddcf9658f2fd3ef60d573 (patch) | |
| tree | ae54af35889451bf7873595180365182bd704ff1 | |
| parent | 8d451687ca57371d303c5554b377d7f5c2ac6ae0 (diff) | |
[PATCH] Using msleep() instead of HZ
Use msleep() in a few places.
Signed-off-by: Luca Falavigna <dktrkranz@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | drivers/char/rtc.c | 16 | ||||
| -rw-r--r-- | kernel/irq/autoprobe.c | 9 |
2 files changed, 8 insertions, 17 deletions
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index ff4f09804865..d8f9e94ae475 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
| @@ -78,6 +78,7 @@ | |||
| 78 | #include <linux/sysctl.h> | 78 | #include <linux/sysctl.h> |
| 79 | #include <linux/wait.h> | 79 | #include <linux/wait.h> |
| 80 | #include <linux/bcd.h> | 80 | #include <linux/bcd.h> |
| 81 | #include <linux/delay.h> | ||
| 81 | 82 | ||
| 82 | #include <asm/current.h> | 83 | #include <asm/current.h> |
| 83 | #include <asm/uaccess.h> | 84 | #include <asm/uaccess.h> |
| @@ -894,7 +895,6 @@ static int __init rtc_init(void) | |||
| 894 | struct proc_dir_entry *ent; | 895 | struct proc_dir_entry *ent; |
| 895 | #if defined(__alpha__) || defined(__mips__) | 896 | #if defined(__alpha__) || defined(__mips__) |
| 896 | unsigned int year, ctrl; | 897 | unsigned int year, ctrl; |
| 897 | unsigned long uip_watchdog; | ||
| 898 | char *guess = NULL; | 898 | char *guess = NULL; |
| 899 | #endif | 899 | #endif |
| 900 | #ifdef __sparc__ | 900 | #ifdef __sparc__ |
| @@ -1000,12 +1000,8 @@ no_irq: | |||
| 1000 | /* Each operating system on an Alpha uses its own epoch. | 1000 | /* Each operating system on an Alpha uses its own epoch. |
| 1001 | Let's try to guess which one we are using now. */ | 1001 | Let's try to guess which one we are using now. */ |
| 1002 | 1002 | ||
| 1003 | uip_watchdog = jiffies; | ||
| 1004 | if (rtc_is_updating() != 0) | 1003 | if (rtc_is_updating() != 0) |
| 1005 | while (jiffies - uip_watchdog < 2*HZ/100) { | 1004 | msleep(20); |
| 1006 | barrier(); | ||
| 1007 | cpu_relax(); | ||
| 1008 | } | ||
| 1009 | 1005 | ||
| 1010 | spin_lock_irq(&rtc_lock); | 1006 | spin_lock_irq(&rtc_lock); |
| 1011 | year = CMOS_READ(RTC_YEAR); | 1007 | year = CMOS_READ(RTC_YEAR); |
| @@ -1213,7 +1209,6 @@ static int rtc_proc_open(struct inode *inode, struct file *file) | |||
| 1213 | 1209 | ||
| 1214 | void rtc_get_rtc_time(struct rtc_time *rtc_tm) | 1210 | void rtc_get_rtc_time(struct rtc_time *rtc_tm) |
| 1215 | { | 1211 | { |
| 1216 | unsigned long uip_watchdog = jiffies; | ||
| 1217 | unsigned char ctrl; | 1212 | unsigned char ctrl; |
| 1218 | #ifdef CONFIG_MACH_DECSTATION | 1213 | #ifdef CONFIG_MACH_DECSTATION |
| 1219 | unsigned int real_year; | 1214 | unsigned int real_year; |
| @@ -1221,7 +1216,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
| 1221 | 1216 | ||
| 1222 | /* | 1217 | /* |
| 1223 | * read RTC once any update in progress is done. The update | 1218 | * read RTC once any update in progress is done. The update |
| 1224 | * can take just over 2ms. We wait 10 to 20ms. There is no need to | 1219 | * can take just over 2ms. We wait 20ms. There is no need to |
| 1225 | * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP. | 1220 | * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP. |
| 1226 | * If you need to know *exactly* when a second has started, enable | 1221 | * If you need to know *exactly* when a second has started, enable |
| 1227 | * periodic update complete interrupts, (via ioctl) and then | 1222 | * periodic update complete interrupts, (via ioctl) and then |
| @@ -1230,10 +1225,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
| 1230 | */ | 1225 | */ |
| 1231 | 1226 | ||
| 1232 | if (rtc_is_updating() != 0) | 1227 | if (rtc_is_updating() != 0) |
| 1233 | while (jiffies - uip_watchdog < 2*HZ/100) { | 1228 | msleep(20); |
| 1234 | barrier(); | ||
| 1235 | cpu_relax(); | ||
| 1236 | } | ||
| 1237 | 1229 | ||
| 1238 | /* | 1230 | /* |
| 1239 | * Only the values that we read from the RTC are set. We leave | 1231 | * Only the values that we read from the RTC are set. We leave |
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c index 98d62d8efeaf..3467097ca61a 100644 --- a/kernel/irq/autoprobe.c +++ b/kernel/irq/autoprobe.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/irq.h> | 9 | #include <linux/irq.h> |
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
| 12 | #include <linux/delay.h> | ||
| 12 | 13 | ||
| 13 | /* | 14 | /* |
| 14 | * Autodetection depends on the fact that any interrupt that | 15 | * Autodetection depends on the fact that any interrupt that |
| @@ -26,7 +27,7 @@ static DECLARE_MUTEX(probe_sem); | |||
| 26 | */ | 27 | */ |
| 27 | unsigned long probe_irq_on(void) | 28 | unsigned long probe_irq_on(void) |
| 28 | { | 29 | { |
| 29 | unsigned long val, delay; | 30 | unsigned long val; |
| 30 | irq_desc_t *desc; | 31 | irq_desc_t *desc; |
| 31 | unsigned int i; | 32 | unsigned int i; |
| 32 | 33 | ||
| @@ -45,8 +46,7 @@ unsigned long probe_irq_on(void) | |||
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | /* Wait for longstanding interrupts to trigger. */ | 48 | /* Wait for longstanding interrupts to trigger. */ |
| 48 | for (delay = jiffies + HZ/50; time_after(delay, jiffies); ) | 49 | msleep(20); |
| 49 | /* about 20ms delay */ barrier(); | ||
| 50 | 50 | ||
| 51 | /* | 51 | /* |
| 52 | * enable any unassigned irqs | 52 | * enable any unassigned irqs |
| @@ -68,8 +68,7 @@ unsigned long probe_irq_on(void) | |||
| 68 | /* | 68 | /* |
| 69 | * Wait for spurious interrupts to trigger | 69 | * Wait for spurious interrupts to trigger |
| 70 | */ | 70 | */ |
| 71 | for (delay = jiffies + HZ/10; time_after(delay, jiffies); ) | 71 | msleep(100); |
| 72 | /* about 100ms delay */ barrier(); | ||
| 73 | 72 | ||
| 74 | /* | 73 | /* |
| 75 | * Now filter out any obviously spurious interrupts | 74 | * Now filter out any obviously spurious interrupts |
