diff options
-rw-r--r-- | sound/usb/6fire/pcm.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c index ba62c7468ba8..2110cbf35474 100644 --- a/sound/usb/6fire/pcm.c +++ b/sound/usb/6fire/pcm.c | |||
@@ -456,7 +456,7 @@ static int usb6fire_pcm_close(struct snd_pcm_substream *alsa_sub) | |||
456 | /* all substreams closed? if so, stop streaming */ | 456 | /* all substreams closed? if so, stop streaming */ |
457 | if (!rt->playback.instance && !rt->capture.instance) { | 457 | if (!rt->playback.instance && !rt->capture.instance) { |
458 | usb6fire_pcm_stream_stop(rt); | 458 | usb6fire_pcm_stream_stop(rt); |
459 | rt->rate = -1; | 459 | rt->rate = ARRAY_SIZE(rates); |
460 | } | 460 | } |
461 | } | 461 | } |
462 | mutex_unlock(&rt->stream_mutex); | 462 | mutex_unlock(&rt->stream_mutex); |
@@ -480,7 +480,6 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub) | |||
480 | struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub); | 480 | struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub); |
481 | struct pcm_substream *sub = usb6fire_pcm_get_substream(alsa_sub); | 481 | struct pcm_substream *sub = usb6fire_pcm_get_substream(alsa_sub); |
482 | struct snd_pcm_runtime *alsa_rt = alsa_sub->runtime; | 482 | struct snd_pcm_runtime *alsa_rt = alsa_sub->runtime; |
483 | int i; | ||
484 | int ret; | 483 | int ret; |
485 | 484 | ||
486 | if (rt->panic) | 485 | if (rt->panic) |
@@ -493,12 +492,10 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub) | |||
493 | sub->period_off = 0; | 492 | sub->period_off = 0; |
494 | 493 | ||
495 | if (rt->stream_state == STREAM_DISABLED) { | 494 | if (rt->stream_state == STREAM_DISABLED) { |
496 | for (i = 0; i < ARRAY_SIZE(rates); i++) | 495 | for (rt->rate = 0; rt->rate < ARRAY_SIZE(rates); rt->rate++) |
497 | if (alsa_rt->rate == rates[i]) { | 496 | if (alsa_rt->rate == rates[rt->rate]) |
498 | rt->rate = i; | ||
499 | break; | 497 | break; |
500 | } | 498 | if (rt->rate == ARRAY_SIZE(rates)) { |
501 | if (i == ARRAY_SIZE(rates)) { | ||
502 | mutex_unlock(&rt->stream_mutex); | 499 | mutex_unlock(&rt->stream_mutex); |
503 | snd_printk("invalid rate %d in prepare.\n", | 500 | snd_printk("invalid rate %d in prepare.\n", |
504 | alsa_rt->rate); | 501 | alsa_rt->rate); |
@@ -613,7 +610,7 @@ int __devinit usb6fire_pcm_init(struct sfire_chip *chip) | |||
613 | 610 | ||
614 | rt->chip = chip; | 611 | rt->chip = chip; |
615 | rt->stream_state = STREAM_DISABLED; | 612 | rt->stream_state = STREAM_DISABLED; |
616 | rt->rate = -1; | 613 | rt->rate = ARRAY_SIZE(rates); |
617 | init_waitqueue_head(&rt->stream_wait_queue); | 614 | init_waitqueue_head(&rt->stream_wait_queue); |
618 | mutex_init(&rt->stream_mutex); | 615 | mutex_init(&rt->stream_mutex); |
619 | 616 | ||