diff options
author | Nishanth Aravamudan <nacc@us.ibm.com> | 2005-07-09 04:13:22 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-07-28 06:22:13 -0400 |
commit | ef21ca24faf28df6d06939e77d5032a313490289 (patch) | |
tree | 1c6c719f4671b803f1288eb8cdca18587ec2eb62 /sound/pci/es1968.c | |
parent | 072c01194df6e4843582d09380b780987f642d6d (diff) |
[ALSA] sound/pci: fix-up sleeping paths
ENS1370/1+ driver,ES1968 driver,Intel8x0 driver,VIA82xx driver
VIA82xx-modem driver,AC97 Codec,ALI5451 driver,CS46xx driver
MIXART driver,RME HDSP driver,Trident driver,YMFPCI driver
Description: Fix-up sleeping in sound/pci. These changes fall under the
following two categories:
1) Replace schedule_timeout() with msleep() to guarantee the
task delays as expected. This also involved replacing/removing
custom sleep functions.
2) Do not assume jiffies will only increment by one if you
request a 1 jiffy sleep, i.e. use time_after/time_before in
while loops.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/es1968.c')
-rw-r--r-- | sound/pci/es1968.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 327a341e276b..9d7a28783930 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -664,11 +664,6 @@ static inline u16 maestro_read(es1968_t *chip, u16 reg) | |||
664 | return result; | 664 | return result; |
665 | } | 665 | } |
666 | 666 | ||
667 | #define big_mdelay(msec) do {\ | ||
668 | set_current_state(TASK_UNINTERRUPTIBLE);\ | ||
669 | schedule_timeout(((msec) * HZ + 999) / 1000);\ | ||
670 | } while (0) | ||
671 | |||
672 | /* Wait for the codec bus to be free */ | 667 | /* Wait for the codec bus to be free */ |
673 | static int snd_es1968_ac97_wait(es1968_t *chip) | 668 | static int snd_es1968_ac97_wait(es1968_t *chip) |
674 | { | 669 | { |
@@ -1809,8 +1804,7 @@ static void __devinit es1968_measure_clock(es1968_t *chip) | |||
1809 | snd_es1968_trigger_apu(chip, apu, ESM_APU_16BITLINEAR); | 1804 | snd_es1968_trigger_apu(chip, apu, ESM_APU_16BITLINEAR); |
1810 | do_gettimeofday(&start_time); | 1805 | do_gettimeofday(&start_time); |
1811 | spin_unlock_irq(&chip->reg_lock); | 1806 | spin_unlock_irq(&chip->reg_lock); |
1812 | set_current_state(TASK_UNINTERRUPTIBLE); | 1807 | msleep(50); |
1813 | schedule_timeout(HZ / 20); /* 50 msec */ | ||
1814 | spin_lock_irq(&chip->reg_lock); | 1808 | spin_lock_irq(&chip->reg_lock); |
1815 | offset = __apu_get_register(chip, apu, 5); | 1809 | offset = __apu_get_register(chip, apu, 5); |
1816 | do_gettimeofday(&stop_time); | 1810 | do_gettimeofday(&stop_time); |
@@ -2093,7 +2087,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip) | |||
2093 | outw(0x0000, ioaddr + 0x60); /* write 0 to gpio 0 */ | 2087 | outw(0x0000, ioaddr + 0x60); /* write 0 to gpio 0 */ |
2094 | udelay(20); | 2088 | udelay(20); |
2095 | outw(0x0001, ioaddr + 0x60); /* write 1 to gpio 1 */ | 2089 | outw(0x0001, ioaddr + 0x60); /* write 1 to gpio 1 */ |
2096 | big_mdelay(20); | 2090 | msleep(20); |
2097 | 2091 | ||
2098 | outw(save_68 | 0x1, ioaddr + 0x68); /* now restore .. */ | 2092 | outw(save_68 | 0x1, ioaddr + 0x68); /* now restore .. */ |
2099 | outw((inw(ioaddr + 0x38) & 0xfffc) | 0x1, ioaddr + 0x38); | 2093 | outw((inw(ioaddr + 0x38) & 0xfffc) | 0x1, ioaddr + 0x38); |
@@ -2109,7 +2103,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip) | |||
2109 | outw(0x0001, ioaddr + 0x60); /* write 1 to gpio */ | 2103 | outw(0x0001, ioaddr + 0x60); /* write 1 to gpio */ |
2110 | udelay(20); | 2104 | udelay(20); |
2111 | outw(0x0009, ioaddr + 0x60); /* write 9 to gpio */ | 2105 | outw(0x0009, ioaddr + 0x60); /* write 9 to gpio */ |
2112 | big_mdelay(500); | 2106 | msleep(500); |
2113 | //outw(inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38); | 2107 | //outw(inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38); |
2114 | outw(inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a); | 2108 | outw(inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a); |
2115 | outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c); | 2109 | outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c); |
@@ -2135,7 +2129,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip) | |||
2135 | 2129 | ||
2136 | if (w > 10000) { | 2130 | if (w > 10000) { |
2137 | outb(inb(ioaddr + 0x37) | 0x08, ioaddr + 0x37); /* do a software reset */ | 2131 | outb(inb(ioaddr + 0x37) | 0x08, ioaddr + 0x37); /* do a software reset */ |
2138 | big_mdelay(500); /* oh my.. */ | 2132 | msleep(500); /* oh my.. */ |
2139 | outb(inb(ioaddr + 0x37) & ~0x08, | 2133 | outb(inb(ioaddr + 0x37) & ~0x08, |
2140 | ioaddr + 0x37); | 2134 | ioaddr + 0x37); |
2141 | udelay(1); | 2135 | udelay(1); |