Commit 47f176fd authored by Luca Falavigna's avatar Luca Falavigna Committed by Linus Torvalds

[PATCH] Using msleep() instead of HZ

Use msleep() in a few places.
Signed-off-by: default avatarLuca Falavigna <dktrkranz@gmail.com>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Acked-by: default avatarJeff Garzik <jgarzik@pobox.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8d451687
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/bcd.h> #include <linux/bcd.h>
#include <linux/delay.h>
#include <asm/current.h> #include <asm/current.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -894,7 +895,6 @@ static int __init rtc_init(void) ...@@ -894,7 +895,6 @@ static int __init rtc_init(void)
struct proc_dir_entry *ent; struct proc_dir_entry *ent;
#if defined(__alpha__) || defined(__mips__) #if defined(__alpha__) || defined(__mips__)
unsigned int year, ctrl; unsigned int year, ctrl;
unsigned long uip_watchdog;
char *guess = NULL; char *guess = NULL;
#endif #endif
#ifdef __sparc__ #ifdef __sparc__
...@@ -1000,12 +1000,8 @@ static int __init rtc_init(void) ...@@ -1000,12 +1000,8 @@ static int __init rtc_init(void)
/* Each operating system on an Alpha uses its own epoch. /* Each operating system on an Alpha uses its own epoch.
Let's try to guess which one we are using now. */ Let's try to guess which one we are using now. */
uip_watchdog = jiffies;
if (rtc_is_updating() != 0) if (rtc_is_updating() != 0)
while (jiffies - uip_watchdog < 2*HZ/100) { msleep(20);
barrier();
cpu_relax();
}
spin_lock_irq(&rtc_lock); spin_lock_irq(&rtc_lock);
year = CMOS_READ(RTC_YEAR); year = CMOS_READ(RTC_YEAR);
...@@ -1213,7 +1209,6 @@ static int rtc_proc_open(struct inode *inode, struct file *file) ...@@ -1213,7 +1209,6 @@ static int rtc_proc_open(struct inode *inode, struct file *file)
void rtc_get_rtc_time(struct rtc_time *rtc_tm) void rtc_get_rtc_time(struct rtc_time *rtc_tm)
{ {
unsigned long uip_watchdog = jiffies;
unsigned char ctrl; unsigned char ctrl;
#ifdef CONFIG_MACH_DECSTATION #ifdef CONFIG_MACH_DECSTATION
unsigned int real_year; unsigned int real_year;
...@@ -1221,7 +1216,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) ...@@ -1221,7 +1216,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
/* /*
* read RTC once any update in progress is done. The update * read RTC once any update in progress is done. The update
* can take just over 2ms. We wait 10 to 20ms. There is no need to * can take just over 2ms. We wait 20ms. There is no need to
* to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP. * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
* If you need to know *exactly* when a second has started, enable * If you need to know *exactly* when a second has started, enable
* periodic update complete interrupts, (via ioctl) and then * periodic update complete interrupts, (via ioctl) and then
...@@ -1230,10 +1225,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) ...@@ -1230,10 +1225,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
*/ */
if (rtc_is_updating() != 0) if (rtc_is_updating() != 0)
while (jiffies - uip_watchdog < 2*HZ/100) { msleep(20);
barrier();
cpu_relax();
}
/* /*
* Only the values that we read from the RTC are set. We leave * Only the values that we read from the RTC are set. We leave
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h>
/* /*
* Autodetection depends on the fact that any interrupt that * Autodetection depends on the fact that any interrupt that
...@@ -26,7 +27,7 @@ static DECLARE_MUTEX(probe_sem); ...@@ -26,7 +27,7 @@ static DECLARE_MUTEX(probe_sem);
*/ */
unsigned long probe_irq_on(void) unsigned long probe_irq_on(void)
{ {
unsigned long val, delay; unsigned long val;
irq_desc_t *desc; irq_desc_t *desc;
unsigned int i; unsigned int i;
...@@ -45,8 +46,7 @@ unsigned long probe_irq_on(void) ...@@ -45,8 +46,7 @@ unsigned long probe_irq_on(void)
} }
/* Wait for longstanding interrupts to trigger. */ /* Wait for longstanding interrupts to trigger. */
for (delay = jiffies + HZ/50; time_after(delay, jiffies); ) msleep(20);
/* about 20ms delay */ barrier();
/* /*
* enable any unassigned irqs * enable any unassigned irqs
...@@ -68,8 +68,7 @@ unsigned long probe_irq_on(void) ...@@ -68,8 +68,7 @@ unsigned long probe_irq_on(void)
/* /*
* Wait for spurious interrupts to trigger * Wait for spurious interrupts to trigger
*/ */
for (delay = jiffies + HZ/10; time_after(delay, jiffies); ) msleep(100);
/* about 100ms delay */ barrier();
/* /*
* Now filter out any obviously spurious interrupts * Now filter out any obviously spurious interrupts
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment