History

[PATCH] Using msleep() instead of HZ

Use msleep() in a few places.

Luca Falavigna committed 21 years ago

Commit 47f176f1 parent 8d451682 files · +8 −17Browse files

Unified · Split

2 files
  1. drivers/char/rtc.c +4 −12
  2. kernel/irq/autoprobe.c +4 −5
drivers/char/rtc.c+4−12
@@ -78,6 +78,7 @@ · 77 unmodified lines
7878 #include <linux/sysctl.h>
7979 #include <linux/wait.h>
8080 #include <linux/bcd.h>
81+#include <linux/delay.h>
8182
8283 #include <asm/current.h>
8384 #include <asm/uaccess.h>
@@ -894,7 +895,6 @@ static int __init rtc_init(void) · 810 unmodified lines
894895 struct proc_dir_entry *ent;
895896 #if defined(__alpha__) || defined(__mips__)
896897 unsigned int year, ctrl;
897− unsigned long uip_watchdog;
898898 char *guess = NULL;
899899 #endif
900900 #ifdef __sparc__
@@ -1000,12 +1000,8 @@ no_irq: · 99 unmodified lines
10001000 /* Each operating system on an Alpha uses its own epoch.
10011001 Let's try to guess which one we are using now. */
10021002
1003− uip_watchdog = jiffies;
10041003 if (rtc_is_updating() != 0)
1005− while (jiffies - uip_watchdog < 2*HZ/100) {
1006− barrier();
1007− cpu_relax();
1008− }
1004+ msleep(20);
10091005
10101006 spin_lock_irq(&rtc_lock);
10111007 year = CMOS_READ(RTC_YEAR);
@@ -1213,7 +1209,6 @@ static int rtc_proc_open(struct inode *inode, struct file *file) · 201 unmodified lines
12131209
12141210 void rtc_get_rtc_time(struct rtc_time *rtc_tm)
12151211 {
1216− unsigned long uip_watchdog = jiffies;
12171212 unsigned char ctrl;
12181213 #ifdef CONFIG_MACH_DECSTATION
12191214 unsigned int real_year;
@@ -1221,7 +1216,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) · 1 unmodified line
12211216
12221217 /*
12231218 * 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
12251220 * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
12261221 * If you need to know *exactly* when a second has started, enable
12271222 * periodic update complete interrupts, (via ioctl) and then
@@ -1230,10 +1225,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) · 2 unmodified lines
12301225 */
12311226
12321227 if (rtc_is_updating() != 0)
1233− while (jiffies - uip_watchdog < 2*HZ/100) {
1234− barrier();
1235− cpu_relax();
1236− }
1228+ msleep(20);
12371229
12381230 /*
12391231 * Only the values that we read from the RTC are set. We leave
kernel/irq/autoprobe.c+4−5
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <linux/irq.h>
1010 #include <linux/module.h>
1111 #include <linux/interrupt.h>
12+#include <linux/delay.h>
1213
1314 /*
1415 * Autodetection depends on the fact that any interrupt that
@@ -26,7 +27,7 @@ static DECLARE_MUTEX(probe_sem); · 11 unmodified lines
2627 */
2728 unsigned long probe_irq_on(void)
2829 {
29− unsigned long val, delay;
30+ unsigned long val;
3031 irq_desc_t *desc;
3132 unsigned int i;
3233
@@ -45,8 +46,7 @@ unsigned long probe_irq_on(void) · 12 unmodified lines
4546 }
4647
4748 /* Wait for longstanding interrupts to trigger. */
48− for (delay = jiffies + HZ/50; time_after(delay, jiffies); )
49− /* about 20ms delay */ barrier();
49+ msleep(20);
5050
5151 /*
5252 * enable any unassigned irqs
@@ -68,8 +68,7 @@ unsigned long probe_irq_on(void) · 15 unmodified lines
6868 /*
6969 * Wait for spurious interrupts to trigger
7070 */
71− for (delay = jiffies + HZ/10; time_after(delay, jiffies); )
72− /* about 100ms delay */ barrier();
71+ msleep(100);
7372
7473 /*
7574 * Now filter out any obviously spurious interrupts