diff options
author | Nishanth Aravamudan <nacc@us.ibm.com> | 2005-07-09 04:54:37 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-07-28 06:22:22 -0400 |
commit | b27c187f95cd6c9f13f26a5088bea384ac557b45 (patch) | |
tree | c5d1ff785bda8fa11575ecb71453e53426b6e780 /sound/usb | |
parent | 989a0b248bbf32c89e60dc6f02219e446b320712 (diff) |
[ALSA] Fix-up sleeping in sound/usb
USB generic driver,USB USX2Y
Description: Fix-up sleeping in sound/usb. Replace big_mdelay() with
msleep() to guarantee the task delays as expected. This also involved
replacing/removing custom sleep functions.
Patch is compile-tested.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/usbaudio.c | 4 | ||||
-rw-r--r-- | sound/usb/usx2y/usX2Yhwdep.c | 3 | ||||
-rw-r--r-- | sound/usb/usx2y/usx2yhwdeppcm.c | 6 |
3 files changed, 5 insertions, 8 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 3eaa08e3e6a6..f2b760d8d77e 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -792,7 +792,7 @@ static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime) | |||
792 | */ | 792 | */ |
793 | static int wait_clear_urbs(snd_usb_substream_t *subs) | 793 | static int wait_clear_urbs(snd_usb_substream_t *subs) |
794 | { | 794 | { |
795 | int timeout = HZ; | 795 | unsigned long end_time = jiffies + msecs_to_jiffies(1000); |
796 | unsigned int i; | 796 | unsigned int i; |
797 | int alive; | 797 | int alive; |
798 | 798 | ||
@@ -812,7 +812,7 @@ static int wait_clear_urbs(snd_usb_substream_t *subs) | |||
812 | break; | 812 | break; |
813 | set_current_state(TASK_UNINTERRUPTIBLE); | 813 | set_current_state(TASK_UNINTERRUPTIBLE); |
814 | schedule_timeout(1); | 814 | schedule_timeout(1); |
815 | } while (--timeout > 0); | 815 | } while (time_before(jiffies, end_time)); |
816 | if (alive) | 816 | if (alive) |
817 | snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive); | 817 | snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive); |
818 | return 0; | 818 | return 0; |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index bef9b0c142c4..0281a362857a 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -232,8 +232,7 @@ static int snd_usX2Y_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *dsp) | |||
232 | if (err) | 232 | if (err) |
233 | return err; | 233 | return err; |
234 | if (dsp->index == 1) { | 234 | if (dsp->index == 1) { |
235 | set_current_state(TASK_UNINTERRUPTIBLE); | 235 | msleep(250); // give the device some time |
236 | schedule_timeout(HZ/4); // give the device some time | ||
237 | err = usX2Y_AsyncSeq04_init(priv); | 236 | err = usX2Y_AsyncSeq04_init(priv); |
238 | if (err) { | 237 | if (err) { |
239 | snd_printk("usX2Y_AsyncSeq04_init error \n"); | 238 | snd_printk("usX2Y_AsyncSeq04_init error \n"); |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index bb2c8e9000c6..ef28061287f2 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -50,6 +50,7 @@ | |||
50 | Currently rawusb dma pcm buffer transport (this file) is only available to snd-usb-usx2y. | 50 | Currently rawusb dma pcm buffer transport (this file) is only available to snd-usb-usx2y. |
51 | */ | 51 | */ |
52 | 52 | ||
53 | #include <linux/delay.h> | ||
53 | #include "usbusx2yaudio.c" | 54 | #include "usbusx2yaudio.c" |
54 | 55 | ||
55 | #if defined(USX2Y_NRPACKS_VARIABLE) || (!defined(USX2Y_NRPACKS_VARIABLE) && USX2Y_NRPACKS == 1) | 56 | #if defined(USX2Y_NRPACKS_VARIABLE) || (!defined(USX2Y_NRPACKS_VARIABLE) && USX2Y_NRPACKS == 1) |
@@ -520,11 +521,8 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream) | |||
520 | usX2Y->hwdep_pcm_shm->playback_iso_start = -1; | 521 | usX2Y->hwdep_pcm_shm->playback_iso_start = -1; |
521 | if (atomic_read(&subs->state) < state_PREPARED) { | 522 | if (atomic_read(&subs->state) < state_PREPARED) { |
522 | while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) > usX2Y->hwdep_pcm_shm->captured_iso_frames) { | 523 | while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) > usX2Y->hwdep_pcm_shm->captured_iso_frames) { |
523 | signed long timeout; | ||
524 | snd_printd("Wait: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", usX2Y_iso_frames_per_buffer(runtime, usX2Y), usX2Y->hwdep_pcm_shm->captured_iso_frames); | 524 | snd_printd("Wait: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", usX2Y_iso_frames_per_buffer(runtime, usX2Y), usX2Y->hwdep_pcm_shm->captured_iso_frames); |
525 | set_current_state(TASK_INTERRUPTIBLE); | 525 | if (msleep_interruptible(10)) { |
526 | timeout = schedule_timeout(HZ/100 + 1); | ||
527 | if (signal_pending(current)) { | ||
528 | err = -ERESTARTSYS; | 526 | err = -ERESTARTSYS; |
529 | goto up_prepare_mutex; | 527 | goto up_prepare_mutex; |
530 | } | 528 | } |