aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@us.ibm.com>2005-10-24 09:02:37 -0400
committerJaroslav Kysela <perex@suse.cz>2005-11-04 07:19:49 -0500
commit8433a509c0eb6bb1f33ce39c82c580b8901619ee (patch)
treef1554905dee5da4e840dfd674d5b004124496a22 /sound/pci
parentd78bec210f07b06f406b877b9179e0cc281ae8e6 (diff)
[ALSA] Fix schedule_timeout usage
Use schedule_timeout_{,un}interruptible() instead of set_current_state()/schedule_timeout() to reduce kernel size. Also use human-time conversion functions instead of hard-coded division to avoid rounding issues. Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ac97/ac97_codec.c15
-rw-r--r--sound/pci/ali5451/ali5451.c12
-rw-r--r--sound/pci/atiixp.c3
-rw-r--r--sound/pci/atiixp_modem.c3
-rw-r--r--sound/pci/cs4281.c6
-rw-r--r--sound/pci/ens1370.c3
-rw-r--r--sound/pci/fm801.c9
-rw-r--r--sound/pci/ice1712/pontis.c3
-rw-r--r--sound/pci/intel8x0.c3
-rw-r--r--sound/pci/intel8x0m.c3
-rw-r--r--sound/pci/maestro3.c9
-rw-r--r--sound/pci/mixart/mixart.c3
-rw-r--r--sound/pci/trident/trident_main.c3
-rw-r--r--sound/pci/via82xx.c6
-rw-r--r--sound/pci/via82xx_modem.c6
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c5
16 files changed, 31 insertions, 61 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index bbc409ae7ee9..3b589104510b 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1745,8 +1745,7 @@ static int ac97_reset_wait(ac97_t *ac97, int timeout, int with_modem)
1745 if ((snd_ac97_read(ac97, AC97_REC_GAIN) & 0x7fff) == 0x0a05) 1745 if ((snd_ac97_read(ac97, AC97_REC_GAIN) & 0x7fff) == 0x0a05)
1746 return 0; 1746 return 0;
1747 } 1747 }
1748 set_current_state(TASK_UNINTERRUPTIBLE); 1748 schedule_timeout_uninterruptible(1);
1749 schedule_timeout(1);
1750 } while (time_after_eq(end_time, jiffies)); 1749 } while (time_after_eq(end_time, jiffies));
1751 return -ENODEV; 1750 return -ENODEV;
1752} 1751}
@@ -1992,8 +1991,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
1992 do { 1991 do {
1993 if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) 1992 if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f)
1994 goto __ready_ok; 1993 goto __ready_ok;
1995 set_current_state(TASK_UNINTERRUPTIBLE); 1994 schedule_timeout_uninterruptible(1);
1996 schedule_timeout(1);
1997 } while (time_after_eq(end_time, jiffies)); 1995 } while (time_after_eq(end_time, jiffies));
1998 snd_printk(KERN_WARNING "AC'97 %d analog subsections not ready\n", ac97->num); 1996 snd_printk(KERN_WARNING "AC'97 %d analog subsections not ready\n", ac97->num);
1999 } 1997 }
@@ -2025,8 +2023,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
2025 do { 2023 do {
2026 if ((snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS) & tmp) == tmp) 2024 if ((snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS) & tmp) == tmp)
2027 goto __ready_ok; 2025 goto __ready_ok;
2028 set_current_state(TASK_UNINTERRUPTIBLE); 2026 schedule_timeout_uninterruptible(1);
2029 schedule_timeout(1);
2030 } while (time_after_eq(end_time, jiffies)); 2027 } while (time_after_eq(end_time, jiffies));
2031 snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS)); 2028 snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS));
2032 } 2029 }
@@ -2260,8 +2257,7 @@ void snd_ac97_resume(ac97_t *ac97)
2260 do { 2257 do {
2261 if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101) 2258 if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101)
2262 break; 2259 break;
2263 set_current_state(TASK_UNINTERRUPTIBLE); 2260 schedule_timeout_uninterruptible(1);
2264 schedule_timeout(1);
2265 } while (time_after_eq(end_time, jiffies)); 2261 } while (time_after_eq(end_time, jiffies));
2266 /* FIXME: extra delay */ 2262 /* FIXME: extra delay */
2267 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); 2263 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000);
@@ -2273,8 +2269,7 @@ void snd_ac97_resume(ac97_t *ac97)
2273 unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID); 2269 unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID);
2274 if (val != 0xffff && (val & 1) != 0) 2270 if (val != 0xffff && (val & 1) != 0)
2275 break; 2271 break;
2276 set_current_state(TASK_UNINTERRUPTIBLE); 2272 schedule_timeout_uninterruptible(1);
2277 schedule_timeout(1);
2278 } while (time_after_eq(end_time, jiffies)); 2273 } while (time_after_eq(end_time, jiffies));
2279 } 2274 }
2280__reset_ready: 2275__reset_ready:
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index e33653439cb5..4e76c4a636d9 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -398,10 +398,8 @@ static int snd_ali_codec_ready( ali_t *codec,
398 res = snd_ali_5451_peek(codec,port); 398 res = snd_ali_5451_peek(codec,port);
399 if (! (res & 0x8000)) 399 if (! (res & 0x8000))
400 return 0; 400 return 0;
401 if (sched) { 401 if (sched)
402 set_current_state(TASK_UNINTERRUPTIBLE); 402 schedule_timeout_uninterruptible(1);
403 schedule_timeout(1);
404 }
405 } while (time_after_eq(end_time, jiffies)); 403 } while (time_after_eq(end_time, jiffies));
406 snd_ali_5451_poke(codec, port, res & ~0x8000); 404 snd_ali_5451_poke(codec, port, res & ~0x8000);
407 snd_printdd("ali_codec_ready: codec is not ready.\n "); 405 snd_printdd("ali_codec_ready: codec is not ready.\n ");
@@ -421,10 +419,8 @@ static int snd_ali_stimer_ready(ali_t *codec, int sched)
421 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); 419 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER);
422 if (dwChk2 != dwChk1) 420 if (dwChk2 != dwChk1)
423 return 0; 421 return 0;
424 if (sched) { 422 if (sched)
425 set_current_state(TASK_UNINTERRUPTIBLE); 423 schedule_timeout_uninterruptible(1);
426 schedule_timeout(1);
427 }
428 } while (time_after_eq(end_time, jiffies)); 424 } while (time_after_eq(end_time, jiffies));
429 snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); 425 snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n");
430 return -EIO; 426 return -EIO;
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index a9314363abd8..f5dad9248e39 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -330,8 +330,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
330 330
331/* delay for one tick */ 331/* delay for one tick */
332#define do_delay() do { \ 332#define do_delay() do { \
333 set_current_state(TASK_UNINTERRUPTIBLE); \ 333 schedule_timeout_uninterruptible(1); \
334 schedule_timeout(1); \
335} while (0) 334} while (0)
336 335
337 336
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 210eb676945c..0cf202079571 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -307,8 +307,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
307 307
308/* delay for one tick */ 308/* delay for one tick */
309#define do_delay() do { \ 309#define do_delay() do { \
310 set_current_state(TASK_UNINTERRUPTIBLE); \ 310 schedule_timeout_uninterruptible(1); \
311 schedule_timeout(1); \
312} while (0) 311} while (0)
313 312
314 313
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index dc87e0144b5a..aea2c47712f9 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -523,8 +523,7 @@ static void snd_cs4281_delay(unsigned int delay)
523 delay = 1; 523 delay = 1;
524 end_time = jiffies + delay; 524 end_time = jiffies + delay;
525 do { 525 do {
526 set_current_state(TASK_UNINTERRUPTIBLE); 526 schedule_timeout_uninterruptible(1);
527 schedule_timeout(1);
528 } while (time_after_eq(end_time, jiffies)); 527 } while (time_after_eq(end_time, jiffies));
529 } else { 528 } else {
530 udelay(delay); 529 udelay(delay);
@@ -533,8 +532,7 @@ static void snd_cs4281_delay(unsigned int delay)
533 532
534static inline void snd_cs4281_delay_long(void) 533static inline void snd_cs4281_delay_long(void)
535{ 534{
536 set_current_state(TASK_UNINTERRUPTIBLE); 535 schedule_timeout_uninterruptible(1);
537 schedule_timeout(1);
538} 536}
539 537
540static inline void snd_cs4281_pokeBA0(cs4281_t *chip, unsigned long offset, unsigned int val) 538static inline void snd_cs4281_pokeBA0(cs4281_t *chip, unsigned long offset, unsigned int val)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index b4d0a9c2b0b5..92ff7c510f2b 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -576,8 +576,7 @@ static void snd_es1370_codec_write(ak4531_t *ak4531,
576 outw(ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); 576 outw(ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC));
577 return; 577 return;
578 } 578 }
579 set_current_state(TASK_UNINTERRUPTIBLE); 579 schedule_timeout_uninterruptible(1);
580 schedule_timeout(1);
581 } while (time_after(end_time, jiffies)); 580 } while (time_after(end_time, jiffies));
582 snd_printk(KERN_ERR "codec write timeout, status = 0x%x\n", inl(ES_REG(ensoniq, STATUS))); 581 snd_printk(KERN_ERR "codec write timeout, status = 0x%x\n", inl(ES_REG(ensoniq, STATUS)));
583} 582}
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 47dbe317069f..4c7c8d225c7f 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1303,8 +1303,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
1303 do { 1303 do {
1304 if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8)) 1304 if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8))
1305 goto __ac97_secondary; 1305 goto __ac97_secondary;
1306 set_current_state(TASK_UNINTERRUPTIBLE); 1306 schedule_timeout_uninterruptible(1);
1307 schedule_timeout(1);
1308 } while (time_after(timeout, jiffies)); 1307 } while (time_after(timeout, jiffies));
1309 snd_printk(KERN_ERR "Primary AC'97 codec not found\n"); 1308 snd_printk(KERN_ERR "Primary AC'97 codec not found\n");
1310 snd_fm801_free(chip); 1309 snd_fm801_free(chip);
@@ -1329,8 +1328,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
1329 goto __ac97_ok; 1328 goto __ac97_ok;
1330 } 1329 }
1331 } 1330 }
1332 set_current_state(TASK_UNINTERRUPTIBLE); 1331 schedule_timeout_uninterruptible(1);
1333 schedule_timeout(1);
1334 } while (time_after(timeout, jiffies)); 1332 } while (time_after(timeout, jiffies));
1335 } 1333 }
1336 1334
@@ -1343,8 +1341,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
1343 do { 1341 do {
1344 if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8)) 1342 if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8))
1345 goto __ac97_ok; 1343 goto __ac97_ok;
1346 set_current_state(TASK_UNINTERRUPTIBLE); 1344 schedule_timeout_uninterruptible(1);
1347 schedule_timeout(1);
1348 } while (time_after(timeout, jiffies)); 1345 } while (time_after(timeout, jiffies));
1349 snd_printk(KERN_ERR "Primary AC'97 codec not responding\n"); 1346 snd_printk(KERN_ERR "Primary AC'97 codec not responding\n");
1350 snd_fm801_free(chip); 1347 snd_fm801_free(chip);
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c
index a5f852b1f575..773a1ecb75ce 100644
--- a/sound/pci/ice1712/pontis.c
+++ b/sound/pci/ice1712/pontis.c
@@ -794,8 +794,7 @@ static int __devinit pontis_init(ice1712_t *ice)
794 /* initialize WM8776 codec */ 794 /* initialize WM8776 codec */
795 for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) 795 for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2)
796 wm_put(ice, wm_inits[i], wm_inits[i+1]); 796 wm_put(ice, wm_inits[i], wm_inits[i+1]);
797 set_current_state(TASK_UNINTERRUPTIBLE); 797 schedule_timeout_uninterruptible(1);
798 schedule_timeout(1);
799 for (i = 0; i < ARRAY_SIZE(wm_inits2); i += 2) 798 for (i = 0; i < ARRAY_SIZE(wm_inits2); i += 2)
800 wm_put(ice, wm_inits2[i], wm_inits2[i+1]); 799 wm_put(ice, wm_inits2[i], wm_inits2[i+1]);
801 800
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 383a3ac5ecba..c2f050215321 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2144,8 +2144,7 @@ static void do_ali_reset(intel8x0_t *chip)
2144} 2144}
2145 2145
2146#define do_delay(chip) do {\ 2146#define do_delay(chip) do {\
2147 set_current_state(TASK_UNINTERRUPTIBLE);\ 2147 schedule_timeout_uninterruptible(1);\
2148 schedule_timeout(1);\
2149} while (0) 2148} while (0)
2150 2149
2151static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) 2150static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing)
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 49a9f4d08963..acfb197a833c 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -890,8 +890,7 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
890 */ 890 */
891 891
892#define do_delay(chip) do {\ 892#define do_delay(chip) do {\
893 set_current_state(TASK_UNINTERRUPTIBLE);\ 893 schedule_timeout_uninterruptible(1);\
894 schedule_timeout(1);\
895} while (0) 894} while (0)
896 895
897static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) 896static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index ad77b4145824..99eb76c56f81 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2046,8 +2046,7 @@ static void snd_m3_ac97_reset(m3_t *chip)
2046 outw(0, io + GPIO_DATA); 2046 outw(0, io + GPIO_DATA);
2047 outw(dir | GPO_PRIMARY_AC97, io + GPIO_DIRECTION); 2047 outw(dir | GPO_PRIMARY_AC97, io + GPIO_DIRECTION);
2048 2048
2049 set_current_state(TASK_UNINTERRUPTIBLE); 2049 schedule_timeout_uninterruptible(msecs_to_jiffies(delay1));
2050 schedule_timeout((delay1 * HZ) / 1000);
2051 2050
2052 outw(GPO_PRIMARY_AC97, io + GPIO_DATA); 2051 outw(GPO_PRIMARY_AC97, io + GPIO_DATA);
2053 udelay(5); 2052 udelay(5);
@@ -2055,8 +2054,7 @@ static void snd_m3_ac97_reset(m3_t *chip)
2055 outw(IO_SRAM_ENABLE | SERIAL_AC_LINK_ENABLE, io + RING_BUS_CTRL_A); 2054 outw(IO_SRAM_ENABLE | SERIAL_AC_LINK_ENABLE, io + RING_BUS_CTRL_A);
2056 outw(~0, io + GPIO_MASK); 2055 outw(~0, io + GPIO_MASK);
2057 2056
2058 set_current_state(TASK_UNINTERRUPTIBLE); 2057 schedule_timeout_uninterruptible(msecs_to_jiffies(delay2));
2059 schedule_timeout((delay2 * HZ) / 1000);
2060 2058
2061 if (! snd_m3_try_read_vendor(chip)) 2059 if (! snd_m3_try_read_vendor(chip))
2062 break; 2060 break;
@@ -2101,8 +2099,7 @@ static int __devinit snd_m3_mixer(m3_t *chip)
2101 2099
2102 /* seems ac97 PCM needs initialization.. hack hack.. */ 2100 /* seems ac97 PCM needs initialization.. hack hack.. */
2103 snd_ac97_write(chip->ac97, AC97_PCM, 0x8000 | (15 << 8) | 15); 2101 snd_ac97_write(chip->ac97, AC97_PCM, 0x8000 | (15 << 8) | 15);
2104 set_current_state(TASK_UNINTERRUPTIBLE); 2102 schedule_timeout_uninterruptible(msecs_to_jiffies(100));
2105 schedule_timeout(HZ / 10);
2106 snd_ac97_write(chip->ac97, AC97_PCM, 0); 2103 snd_ac97_write(chip->ac97, AC97_PCM, 0);
2107 2104
2108 memset(&id, 0, sizeof(id)); 2105 memset(&id, 0, sizeof(id));
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 1a62c7f6c52b..c341c99ec783 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -451,8 +451,7 @@ static int mixart_sync_nonblock_events(mixart_mgr_t *mgr)
451 snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n"); 451 snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n");
452 return -EBUSY; 452 return -EBUSY;
453 } 453 }
454 set_current_state(TASK_UNINTERRUPTIBLE); 454 schedule_timeout_uninterruptible(1);
455 schedule_timeout(1);
456 } 455 }
457 return 0; 456 return 0;
458} 457}
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 08226f523eb8..b9b93c7faafd 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -3207,8 +3207,7 @@ static inline void snd_trident_free_gameport(trident_t *chip) { }
3207 */ 3207 */
3208static inline void do_delay(trident_t *chip) 3208static inline void do_delay(trident_t *chip)
3209{ 3209{
3210 set_current_state(TASK_UNINTERRUPTIBLE); 3210 schedule_timeout_uninterruptible(1);
3211 schedule_timeout(1);
3212} 3211}
3213 3212
3214/* 3213/*
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 9b2bea866d1b..523eace250f7 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2027,8 +2027,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
2027 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); 2027 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
2028 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ 2028 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
2029 break; 2029 break;
2030 set_current_state(TASK_UNINTERRUPTIBLE); 2030 schedule_timeout_uninterruptible(1);
2031 schedule_timeout(1);
2032 } while (time_before(jiffies, end_time)); 2031 } while (time_before(jiffies, end_time));
2033 2032
2034 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) 2033 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
@@ -2047,8 +2046,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
2047 chip->ac97_secondary = 1; 2046 chip->ac97_secondary = 1;
2048 goto __ac97_ok2; 2047 goto __ac97_ok2;
2049 } 2048 }
2050 set_current_state(TASK_INTERRUPTIBLE); 2049 schedule_timeout_interruptible(1);
2051 schedule_timeout(1);
2052 } while (time_before(jiffies, end_time)); 2050 } while (time_before(jiffies, end_time));
2053 /* This is ok, the most of motherboards have only one codec */ 2051 /* This is ok, the most of motherboards have only one codec */
2054 2052
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index bc7330ace96a..011f0fb63bf9 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -968,8 +968,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
968 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); 968 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
969 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ 969 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
970 break; 970 break;
971 set_current_state(TASK_UNINTERRUPTIBLE); 971 schedule_timeout_uninterruptible(1);
972 schedule_timeout(1);
973 } while (time_before(jiffies, end_time)); 972 } while (time_before(jiffies, end_time));
974 973
975 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) 974 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
@@ -987,8 +986,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
987 chip->ac97_secondary = 1; 986 chip->ac97_secondary = 1;
988 goto __ac97_ok2; 987 goto __ac97_ok2;
989 } 988 }
990 set_current_state(TASK_INTERRUPTIBLE); 989 schedule_timeout_interruptible(1);
991 schedule_timeout(1);
992 } while (time_before(jiffies, end_time)); 990 } while (time_before(jiffies, end_time));
993 /* This is ok, the most of motherboards have only one codec */ 991 /* This is ok, the most of motherboards have only one codec */
994 992
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index a53117733d51..88a43e091d77 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -92,7 +92,7 @@ static int snd_ymfpci_codec_ready(ymfpci_t *chip, int secondary)
92 if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0) 92 if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0)
93 return 0; 93 return 0;
94 set_current_state(TASK_UNINTERRUPTIBLE); 94 set_current_state(TASK_UNINTERRUPTIBLE);
95 schedule_timeout(1); 95 schedule_timeout_uninterruptible(1);
96 } while (time_before(jiffies, end_time)); 96 } while (time_before(jiffies, end_time));
97 snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg)); 97 snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg));
98 return -EBUSY; 98 return -EBUSY;
@@ -728,8 +728,7 @@ static void snd_ymfpci_irq_wait(ymfpci_t *chip)
728 init_waitqueue_entry(&wait, current); 728 init_waitqueue_entry(&wait, current);
729 add_wait_queue(&chip->interrupt_sleep, &wait); 729 add_wait_queue(&chip->interrupt_sleep, &wait);
730 atomic_inc(&chip->interrupt_sleep_count); 730 atomic_inc(&chip->interrupt_sleep_count);
731 set_current_state(TASK_UNINTERRUPTIBLE); 731 schedule_timeout_uninterruptible(msecs_to_jiffies(50));
732 schedule_timeout(HZ/20);
733 remove_wait_queue(&chip->interrupt_sleep, &wait); 732 remove_wait_queue(&chip->interrupt_sleep, &wait);
734 } 733 }
735} 734}