aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-09-10 09:32:58 -0400
committerTakashi Iwai <tiwai@suse.de>2009-09-10 09:32:58 -0400
commitfa285190025d0b9a35ed0f6233bfaa721281e0f4 (patch)
treeb82ba1f315aa10440af14c4adc64a24aa0e18325 /sound
parent9cd9f4276766e15be40d09f77e28656797a1b06f (diff)
parentcbbb05703da4b205bb17fde555d3b2926d8b3194 (diff)
Merge branch 'topic/oss' into for-linus
* topic/oss: ALSA: allocation may fail in snd_pcm_oss_change_params() sound: vwsnd: Fix setting of cfgval and ctlval in li_setup_dma() sound: fix OSS MIDI output data loss
Diffstat (limited to 'sound')
-rw-r--r--sound/core/oss/pcm_oss.c9
-rw-r--r--sound/oss/midibuf.c7
-rw-r--r--sound/oss/vwsnd.c6
3 files changed, 14 insertions, 8 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index d8b2d76125b4..d9c96353121a 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1043,10 +1043,15 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
1043 runtime->oss.channels = params_channels(params); 1043 runtime->oss.channels = params_channels(params);
1044 runtime->oss.rate = params_rate(params); 1044 runtime->oss.rate = params_rate(params);
1045 1045
1046 runtime->oss.params = 0;
1047 runtime->oss.prepare = 1;
1048 vfree(runtime->oss.buffer); 1046 vfree(runtime->oss.buffer);
1049 runtime->oss.buffer = vmalloc(runtime->oss.period_bytes); 1047 runtime->oss.buffer = vmalloc(runtime->oss.period_bytes);
1048 if (!runtime->oss.buffer) {
1049 err = -ENOMEM;
1050 goto failure;
1051 }
1052
1053 runtime->oss.params = 0;
1054 runtime->oss.prepare = 1;
1050 runtime->oss.buffer_used = 0; 1055 runtime->oss.buffer_used = 0;
1051 if (runtime->dma_area) 1056 if (runtime->dma_area)
1052 snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->dma_bytes)); 1057 snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->dma_bytes));
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c
index a40be0cf1d97..782b3b84dac6 100644
--- a/sound/oss/midibuf.c
+++ b/sound/oss/midibuf.c
@@ -127,15 +127,16 @@ static void midi_poll(unsigned long dummy)
127 for (dev = 0; dev < num_midis; dev++) 127 for (dev = 0; dev < num_midis; dev++)
128 if (midi_devs[dev] != NULL && midi_out_buf[dev] != NULL) 128 if (midi_devs[dev] != NULL && midi_out_buf[dev] != NULL)
129 { 129 {
130 int ok = 1; 130 while (DATA_AVAIL(midi_out_buf[dev]))
131
132 while (DATA_AVAIL(midi_out_buf[dev]) && ok)
133 { 131 {
132 int ok;
134 int c = midi_out_buf[dev]->queue[midi_out_buf[dev]->head]; 133 int c = midi_out_buf[dev]->queue[midi_out_buf[dev]->head];
135 134
136 spin_unlock_irqrestore(&lock,flags);/* Give some time to others */ 135 spin_unlock_irqrestore(&lock,flags);/* Give some time to others */
137 ok = midi_devs[dev]->outputc(dev, c); 136 ok = midi_devs[dev]->outputc(dev, c);
138 spin_lock_irqsave(&lock, flags); 137 spin_lock_irqsave(&lock, flags);
138 if (!ok)
139 break;
139 midi_out_buf[dev]->head = (midi_out_buf[dev]->head + 1) % MAX_QUEUE_SIZE; 140 midi_out_buf[dev]->head = (midi_out_buf[dev]->head + 1) % MAX_QUEUE_SIZE;
140 midi_out_buf[dev]->len--; 141 midi_out_buf[dev]->len--;
141 } 142 }
diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c
index 187f72750e8f..6713110bdc75 100644
--- a/sound/oss/vwsnd.c
+++ b/sound/oss/vwsnd.c
@@ -628,7 +628,7 @@ static void li_setup_dma(dma_chan_t *chan,
628 ASSERT(!(buffer_paddr & 0xFF)); 628 ASSERT(!(buffer_paddr & 0xFF));
629 chan->baseval = (buffer_paddr >> 8) | 1 << (37 - 8); 629 chan->baseval = (buffer_paddr >> 8) | 1 << (37 - 8);
630 630
631 chan->cfgval = (!LI_CCFG_LOCK | 631 chan->cfgval = ((chan->cfgval & ~LI_CCFG_LOCK) |
632 SHIFT_FIELD(desc->ad1843_slot, LI_CCFG_SLOT) | 632 SHIFT_FIELD(desc->ad1843_slot, LI_CCFG_SLOT) |
633 desc->direction | 633 desc->direction |
634 mode | 634 mode |
@@ -638,9 +638,9 @@ static void li_setup_dma(dma_chan_t *chan,
638 tmask = 13 - fragshift; /* See Lithium DMA Notes above. */ 638 tmask = 13 - fragshift; /* See Lithium DMA Notes above. */
639 ASSERT(size >= 2 && size <= 7); 639 ASSERT(size >= 2 && size <= 7);
640 ASSERT(tmask >= 1 && tmask <= 7); 640 ASSERT(tmask >= 1 && tmask <= 7);
641 chan->ctlval = (!LI_CCTL_RESET | 641 chan->ctlval = ((chan->ctlval & ~LI_CCTL_RESET) |
642 SHIFT_FIELD(size, LI_CCTL_SIZE) | 642 SHIFT_FIELD(size, LI_CCTL_SIZE) |
643 !LI_CCTL_DMA_ENABLE | 643 (chan->ctlval & ~LI_CCTL_DMA_ENABLE) |
644 SHIFT_FIELD(tmask, LI_CCTL_TMASK) | 644 SHIFT_FIELD(tmask, LI_CCTL_TMASK) |
645 SHIFT_FIELD(0, LI_CCTL_TPTR)); 645 SHIFT_FIELD(0, LI_CCTL_TPTR));
646 646