aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ac97
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/ac97
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/ac97')
-rw-r--r--sound/pci/ac97/ac97_codec.c15
1 files changed, 5 insertions, 10 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: