Commit 239af6cf authored by Linus Torvalds's avatar Linus Torvalds

Manual merge of sound config

parents 3480a142 4d06eb74
...@@ -50,6 +50,7 @@ typedef struct _snd_pcm_oss_runtime { ...@@ -50,6 +50,7 @@ typedef struct _snd_pcm_oss_runtime {
unsigned int maxfrags; unsigned int maxfrags;
unsigned int subdivision; /* requested subdivision */ unsigned int subdivision; /* requested subdivision */
size_t period_bytes; /* requested period size */ size_t period_bytes; /* requested period size */
size_t period_ptr; /* actual write pointer to period */
unsigned int periods; unsigned int periods;
size_t buffer_bytes; /* requested buffer size */ size_t buffer_bytes; /* requested buffer size */
size_t bytes; /* total # bytes processed */ size_t bytes; /* total # bytes processed */
......
...@@ -46,6 +46,7 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t; ...@@ -46,6 +46,7 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
#define SNDRV_RAWMIDI_LFLG_INPUT (1<<1) #define SNDRV_RAWMIDI_LFLG_INPUT (1<<1)
#define SNDRV_RAWMIDI_LFLG_OPEN (3<<0) #define SNDRV_RAWMIDI_LFLG_OPEN (3<<0)
#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) #define SNDRV_RAWMIDI_LFLG_APPEND (1<<2)
#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3)
typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t; typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t;
typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t; typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t;
......
...@@ -822,10 +822,9 @@ static ssize_t snd_ctl_read(struct file *file, char *buffer, size_t count, loff_ ...@@ -822,10 +822,9 @@ static ssize_t snd_ctl_read(struct file *file, char *buffer, size_t count, loff_
} }
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(&ctl->change_sleep, &wait); add_wait_queue(&ctl->change_sleep, &wait);
spin_unlock_irq(&ctl->read_lock);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(&ctl->read_lock);
schedule(); schedule();
set_current_state(TASK_RUNNING);
remove_wait_queue(&ctl->change_sleep, &wait); remove_wait_queue(&ctl->change_sleep, &wait);
if (signal_pending(current)) if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS; return result > 0 ? result : -ERESTARTSYS;
......
...@@ -129,13 +129,14 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) ...@@ -129,13 +129,14 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
} else } else
break; break;
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
up(&hw->open_mutex);
schedule(); schedule();
down(&hw->open_mutex);
if (signal_pending(current)) { if (signal_pending(current)) {
err = -ERESTARTSYS; err = -ERESTARTSYS;
break; break;
} }
} }
set_current_state(TASK_RUNNING);
remove_wait_queue(&hw->open_wait, &wait); remove_wait_queue(&hw->open_wait, &wait);
if (err >= 0) { if (err >= 0) {
err = snd_card_file_add(hw->card, file); err = snd_card_file_add(hw->card, file);
......
...@@ -697,8 +697,8 @@ int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file ...@@ -697,8 +697,8 @@ int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file
} }
if (file && (file->f_flags & O_NONBLOCK)) if (file && (file->f_flags & O_NONBLOCK))
return -EAGAIN; return -EAGAIN;
snd_power_unlock(card);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
snd_power_unlock(card);
schedule_timeout(30 * HZ); schedule_timeout(30 * HZ);
snd_power_lock(card); snd_power_lock(card);
} }
......
...@@ -142,7 +142,7 @@ static int snd_pcm_oss_format_from(int format) ...@@ -142,7 +142,7 @@ static int snd_pcm_oss_format_from(int format)
case AFMT_U16_LE: return SNDRV_PCM_FORMAT_U16_LE; case AFMT_U16_LE: return SNDRV_PCM_FORMAT_U16_LE;
case AFMT_U16_BE: return SNDRV_PCM_FORMAT_U16_BE; case AFMT_U16_BE: return SNDRV_PCM_FORMAT_U16_BE;
case AFMT_MPEG: return SNDRV_PCM_FORMAT_MPEG; case AFMT_MPEG: return SNDRV_PCM_FORMAT_MPEG;
default: return SNDRV_PCM_FORMAT_U8; default: return SNDRV_PCM_FORMAT_U8;
} }
} }
...@@ -554,6 +554,7 @@ static int snd_pcm_oss_prepare(snd_pcm_substream_t *substream) ...@@ -554,6 +554,7 @@ static int snd_pcm_oss_prepare(snd_pcm_substream_t *substream)
} }
runtime->oss.prepare = 0; runtime->oss.prepare = 0;
runtime->oss.prev_hw_ptr_interrupt = 0; runtime->oss.prev_hw_ptr_interrupt = 0;
runtime->oss.period_ptr = 0;
return 0; return 0;
} }
...@@ -818,6 +819,8 @@ static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char *bu ...@@ -818,6 +819,8 @@ static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char *bu
return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
runtime->oss.bytes += tmp; runtime->oss.bytes += tmp;
runtime->oss.buffer_used = 0; runtime->oss.buffer_used = 0;
runtime->oss.period_ptr += tmp;
runtime->oss.period_ptr %= runtime->oss.period_bytes;
} }
} else { } else {
tmp = snd_pcm_oss_write2(substream, (char *)buf, runtime->oss.period_bytes, 0); tmp = snd_pcm_oss_write2(substream, (char *)buf, runtime->oss.period_bytes, 0);
...@@ -941,6 +944,7 @@ static int snd_pcm_oss_sync1(snd_pcm_substream_t *substream, size_t size) ...@@ -941,6 +944,7 @@ static int snd_pcm_oss_sync1(snd_pcm_substream_t *substream, size_t size)
{ {
snd_pcm_runtime_t *runtime; snd_pcm_runtime_t *runtime;
ssize_t result = 0; ssize_t result = 0;
long res;
wait_queue_t wait; wait_queue_t wait;
runtime = substream->runtime; runtime = substream->runtime;
...@@ -957,12 +961,23 @@ static int snd_pcm_oss_sync1(snd_pcm_substream_t *substream, size_t size) ...@@ -957,12 +961,23 @@ static int snd_pcm_oss_sync1(snd_pcm_substream_t *substream, size_t size)
break; break;
result = 0; result = 0;
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule(); snd_pcm_stream_lock_irq(substream);
res = runtime->status->state;
snd_pcm_stream_unlock_irq(substream);
if (res != SNDRV_PCM_STATE_RUNNING) {
set_current_state(TASK_RUNNING);
break;
}
res = schedule_timeout(10 * HZ);
if (signal_pending(current)) { if (signal_pending(current)) {
result = -ERESTARTSYS; result = -ERESTARTSYS;
break; break;
} }
set_current_state(TASK_RUNNING); if (res == 0) {
snd_printk(KERN_ERR "OSS sync error - DMA timeout\n");
result = -EIO;
break;
}
} }
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
return result; return result;
...@@ -974,31 +989,44 @@ static int snd_pcm_oss_sync(snd_pcm_oss_file_t *pcm_oss_file) ...@@ -974,31 +989,44 @@ static int snd_pcm_oss_sync(snd_pcm_oss_file_t *pcm_oss_file)
unsigned int saved_f_flags; unsigned int saved_f_flags;
snd_pcm_substream_t *substream; snd_pcm_substream_t *substream;
snd_pcm_runtime_t *runtime; snd_pcm_runtime_t *runtime;
size_t size; snd_pcm_format_t format;
unsigned long width;
size_t size, size1;
substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
if (substream != NULL) { if (substream != NULL) {
if ((err = snd_pcm_oss_make_ready(substream)) < 0) if ((err = snd_pcm_oss_make_ready(substream)) < 0)
return err; return err;
runtime = substream->runtime; runtime = substream->runtime;
format = snd_pcm_oss_format_from(runtime->oss.format);
width = snd_pcm_format_physical_width(format);
if (runtime->oss.buffer_used > 0) { if (runtime->oss.buffer_used > 0) {
snd_pcm_format_set_silence(runtime->format, size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width;
snd_pcm_format_set_silence(format,
runtime->oss.buffer + runtime->oss.buffer_used, runtime->oss.buffer + runtime->oss.buffer_used,
bytes_to_samples(runtime, runtime->oss.period_bytes - runtime->oss.buffer_used)); size);
err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes);
if (err < 0) if (err < 0)
return err; return err;
} else if (runtime->oss.period_ptr > 0) {
size = runtime->oss.period_bytes - runtime->oss.period_ptr;
snd_pcm_format_set_silence(format,
runtime->oss.buffer,
size * 8 / width);
err = snd_pcm_oss_sync1(substream, size);
if (err < 0)
return err;
} }
size = runtime->control->appl_ptr % runtime->period_size; size = runtime->oss.period_bytes;
if (size > 0) { size1 = frames_to_bytes(runtime, runtime->period_size);
size = runtime->period_size - size; while (size < size1) {
size *= runtime->channels; snd_pcm_format_set_silence(format,
snd_pcm_format_set_silence(runtime->format,
runtime->oss.buffer, runtime->oss.buffer,
size); (8 * runtime->oss.period_bytes + 7) / width);
err = snd_pcm_oss_sync1(substream, samples_to_bytes(runtime, size)); err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes);
if (err < 0) if (err < 0)
return err; return err;
size += runtime->oss.period_bytes;
} }
saved_f_flags = substream->ffile->f_flags; saved_f_flags = substream->ffile->f_flags;
substream->ffile->f_flags &= ~O_NONBLOCK; substream->ffile->f_flags &= ~O_NONBLOCK;
...@@ -1786,7 +1814,6 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) ...@@ -1786,7 +1814,6 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
break; break;
} }
} }
set_current_state(TASK_RUNNING);
remove_wait_queue(&pcm->open_wait, &wait); remove_wait_queue(&pcm->open_wait, &wait);
up(&pcm->open_mutex); up(&pcm->open_mutex);
if (err < 0) if (err < 0)
......
...@@ -2106,11 +2106,11 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, ...@@ -2106,11 +2106,11 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(&runtime->sleep, &wait); add_wait_queue(&runtime->sleep, &wait);
while (1) { while (1) {
set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) { if (signal_pending(current)) {
state = SIGNALED; state = SIGNALED;
break; break;
} }
set_current_state(TASK_INTERRUPTIBLE);
snd_pcm_stream_unlock_irq(substream); snd_pcm_stream_unlock_irq(substream);
tout = schedule_timeout(10 * HZ); tout = schedule_timeout(10 * HZ);
snd_pcm_stream_lock_irq(substream); snd_pcm_stream_lock_irq(substream);
...@@ -2139,7 +2139,6 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, ...@@ -2139,7 +2139,6 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
} }
} }
_end_loop: _end_loop:
set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
switch (state) { switch (state) {
...@@ -2401,11 +2400,11 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void ...@@ -2401,11 +2400,11 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(&runtime->sleep, &wait); add_wait_queue(&runtime->sleep, &wait);
while (1) { while (1) {
set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) { if (signal_pending(current)) {
state = SIGNALED; state = SIGNALED;
break; break;
} }
set_current_state(TASK_INTERRUPTIBLE);
snd_pcm_stream_unlock_irq(substream); snd_pcm_stream_unlock_irq(substream);
tout = schedule_timeout(10 * HZ); tout = schedule_timeout(10 * HZ);
snd_pcm_stream_lock_irq(substream); snd_pcm_stream_lock_irq(substream);
...@@ -2435,7 +2434,6 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void ...@@ -2435,7 +2434,6 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void
} }
} }
_end_loop: _end_loop:
set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
switch (state) { switch (state) {
......
...@@ -1237,11 +1237,11 @@ static int snd_pcm_playback_drain(snd_pcm_substream_t * substream) ...@@ -1237,11 +1237,11 @@ static int snd_pcm_playback_drain(snd_pcm_substream_t * substream)
add_wait_queue(&runtime->sleep, &wait); add_wait_queue(&runtime->sleep, &wait);
while (1) { while (1) {
long tout; long tout;
set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) { if (signal_pending(current)) {
state = SIGNALED; state = SIGNALED;
break; break;
} }
set_current_state(TASK_INTERRUPTIBLE);
snd_pcm_stream_unlock_irq(substream); snd_pcm_stream_unlock_irq(substream);
tout = schedule_timeout(10 * HZ); tout = schedule_timeout(10 * HZ);
snd_pcm_stream_lock_irq(substream); snd_pcm_stream_lock_irq(substream);
...@@ -1254,7 +1254,6 @@ static int snd_pcm_playback_drain(snd_pcm_substream_t * substream) ...@@ -1254,7 +1254,6 @@ static int snd_pcm_playback_drain(snd_pcm_substream_t * substream)
break; break;
} }
} }
set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
switch (state) { switch (state) {
...@@ -1961,12 +1960,11 @@ int snd_pcm_open(struct inode *inode, struct file *file) ...@@ -1961,12 +1960,11 @@ int snd_pcm_open(struct inode *inode, struct file *file)
} }
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(&pcm->open_wait, &wait); add_wait_queue(&pcm->open_wait, &wait);
down(&pcm->open_mutex);
while (1) { while (1) {
down(&pcm->open_mutex);
err = snd_pcm_open_file(file, pcm, device >= SNDRV_MINOR_PCM_CAPTURE ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK, &pcm_file); err = snd_pcm_open_file(file, pcm, device >= SNDRV_MINOR_PCM_CAPTURE ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK, &pcm_file);
if (err >= 0) if (err >= 0)
break; break;
up(&pcm->open_mutex);
if (err == -EAGAIN) { if (err == -EAGAIN) {
if (file->f_flags & O_NONBLOCK) { if (file->f_flags & O_NONBLOCK) {
err = -EBUSY; err = -EBUSY;
...@@ -1975,13 +1973,14 @@ int snd_pcm_open(struct inode *inode, struct file *file) ...@@ -1975,13 +1973,14 @@ int snd_pcm_open(struct inode *inode, struct file *file)
} else } else
break; break;
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
up(&pcm->open_mutex);
schedule(); schedule();
down(&pcm->open_mutex);
if (signal_pending(current)) { if (signal_pending(current)) {
err = -ERESTARTSYS; err = -ERESTARTSYS;
break; break;
} }
} }
set_current_state(TASK_RUNNING);
remove_wait_queue(&pcm->open_wait, &wait); remove_wait_queue(&pcm->open_wait, &wait);
if (err < 0) if (err < 0)
goto __error; goto __error;
......
...@@ -191,7 +191,8 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, ...@@ -191,7 +191,8 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
err = -EFAULT; err = -EFAULT;
goto __error1; goto __error1;
} }
down(&rmidi->open_mutex); if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK))
down(&rmidi->open_mutex);
if (mode & SNDRV_RAWMIDI_LFLG_INPUT) { if (mode & SNDRV_RAWMIDI_LFLG_INPUT) {
if (!(rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT)) { if (!(rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT)) {
err = -ENXIO; err = -ENXIO;
...@@ -320,7 +321,8 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, ...@@ -320,7 +321,8 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
} else { } else {
soutput = NULL; soutput = NULL;
} }
up(&rmidi->open_mutex); if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK))
up(&rmidi->open_mutex);
if (rfile) { if (rfile) {
rfile->rmidi = rmidi; rfile->rmidi = rmidi;
rfile->input = sinput; rfile->input = sinput;
...@@ -338,7 +340,8 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, ...@@ -338,7 +340,8 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
kfree(output); kfree(output);
} }
module_put(rmidi->card->module); module_put(rmidi->card->module);
up(&rmidi->open_mutex); if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK))
up(&rmidi->open_mutex);
__error1: __error1:
return err; return err;
} }
...@@ -392,6 +395,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -392,6 +395,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
fflags = snd_rawmidi_file_flags(file); fflags = snd_rawmidi_file_flags(file);
if ((file->f_flags & O_APPEND) || maj != CONFIG_SND_MAJOR) /* OSS emul? */ if ((file->f_flags & O_APPEND) || maj != CONFIG_SND_MAJOR) /* OSS emul? */
fflags |= SNDRV_RAWMIDI_LFLG_APPEND; fflags |= SNDRV_RAWMIDI_LFLG_APPEND;
fflags |= SNDRV_RAWMIDI_LFLG_NOOPENLOCK;
rawmidi_file = snd_magic_kmalloc(snd_rawmidi_file_t, 0, GFP_KERNEL); rawmidi_file = snd_magic_kmalloc(snd_rawmidi_file_t, 0, GFP_KERNEL);
if (rawmidi_file == NULL) { if (rawmidi_file == NULL) {
snd_card_file_remove(card, file); snd_card_file_remove(card, file);
...@@ -399,6 +403,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -399,6 +403,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
} }
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(&rmidi->open_wait, &wait); add_wait_queue(&rmidi->open_wait, &wait);
down(&rmidi->open_mutex);
while (1) { while (1) {
subdevice = -1; subdevice = -1;
down_read(&card->controls_rwsem); down_read(&card->controls_rwsem);
...@@ -421,7 +426,9 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -421,7 +426,9 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
} else } else
break; break;
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
up(&rmidi->open_mutex);
schedule(); schedule();
down(&rmidi->open_mutex);
if (signal_pending(current)) { if (signal_pending(current)) {
err = -ERESTARTSYS; err = -ERESTARTSYS;
break; break;
...@@ -433,7 +440,6 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -433,7 +440,6 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
if (rawmidi_file->output && rawmidi_file->output->runtime) if (rawmidi_file->output && rawmidi_file->output->runtime)
rawmidi_file->output->runtime->oss = (maj == SOUND_MAJOR); rawmidi_file->output->runtime->oss = (maj == SOUND_MAJOR);
#endif #endif
set_current_state(TASK_RUNNING);
remove_wait_queue(&rmidi->open_wait, &wait); remove_wait_queue(&rmidi->open_wait, &wait);
if (err >= 0) { if (err >= 0) {
file->private_data = rawmidi_file; file->private_data = rawmidi_file;
...@@ -441,6 +447,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -441,6 +447,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
snd_card_file_remove(card, file); snd_card_file_remove(card, file);
snd_magic_kfree(rawmidi_file); snd_magic_kfree(rawmidi_file);
} }
up(&rmidi->open_mutex);
return err; return err;
} }
...@@ -950,10 +957,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char *buf, size_t count, loff ...@@ -950,10 +957,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char *buf, size_t count, loff
} }
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(&runtime->sleep, &wait); add_wait_queue(&runtime->sleep, &wait);
spin_unlock_irq(&runtime->lock);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(&runtime->lock);
schedule(); schedule();
set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
if (signal_pending(current)) if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS; return result > 0 ? result : -ERESTARTSYS;
...@@ -1179,8 +1185,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t coun ...@@ -1179,8 +1185,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t coun
} }
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(&runtime->sleep, &wait); add_wait_queue(&runtime->sleep, &wait);
spin_unlock_irq(&runtime->lock);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(&runtime->lock);
timeout = schedule_timeout(30 * HZ); timeout = schedule_timeout(30 * HZ);
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
if (signal_pending(current)) if (signal_pending(current))
...@@ -1206,8 +1212,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t coun ...@@ -1206,8 +1212,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t coun
unsigned int last_avail = runtime->avail; unsigned int last_avail = runtime->avail;
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(&runtime->sleep, &wait); add_wait_queue(&runtime->sleep, &wait);
spin_unlock_irq(&runtime->lock);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(&runtime->lock);
timeout = schedule_timeout(30 * HZ); timeout = schedule_timeout(30 * HZ);
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
if (signal_pending(current)) if (signal_pending(current))
......
...@@ -25,44 +25,6 @@ ...@@ -25,44 +25,6 @@
#if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG) #if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)
#if 0 /* NOT USED */
/* (interruptible) sleep_on during the specified spinlock */
void snd_seq_sleep_in_lock(wait_queue_head_t *p, spinlock_t *lock)
{
wait_queue_t wait;
set_current_state(TASK_INTERRUPTIBLE);
init_waitqueue_entry(&wait, current);
add_wait_queue(p, &wait);
spin_unlock(lock);
schedule();
spin_lock_irq(lock);
remove_wait_queue(p, &wait);
}
/* (interruptible) sleep_on with timeout during the specified spinlock */
long snd_seq_sleep_timeout_in_lock(wait_queue_head_t *p, spinlock_t *lock, long timeout)
{
wait_queue_t wait;
set_current_state(TASK_INTERRUPTIBLE);
init_waitqueue_entry(&wait, current);
add_wait_queue(p, &wait);
spin_unlock(lock);
timeout = schedule_timeout(timeout);
spin_lock_irq(lock);
remove_wait_queue(p, &wait);
return timeout;
}
#endif /* NOT USED */
/* wait until all locks are released */ /* wait until all locks are released */
void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line) void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
{ {
......
...@@ -1678,7 +1678,6 @@ static ssize_t snd_timer_user_read(struct file *file, char *buffer, size_t count ...@@ -1678,7 +1678,6 @@ static ssize_t snd_timer_user_read(struct file *file, char *buffer, size_t count
spin_lock_irq(&tu->qlock); spin_lock_irq(&tu->qlock);
remove_wait_queue(&tu->qchange_sleep, &wait); remove_wait_queue(&tu->qchange_sleep, &wait);
set_current_state(TASK_RUNNING);
if (signal_pending(current)) { if (signal_pending(current)) {
err = -ERESTARTSYS; err = -ERESTARTSYS;
......
...@@ -41,6 +41,20 @@ MODULE_DEVICES("{{ALSA,Dummy soundcard}}"); ...@@ -41,6 +41,20 @@ MODULE_DEVICES("{{ALSA,Dummy soundcard}}");
#define MAX_PCM_SUBSTREAMS 16 #define MAX_PCM_SUBSTREAMS 16
#define MAX_MIDI_DEVICES 2 #define MAX_MIDI_DEVICES 2
#if 0 /* emu10k1 emulation */
#define MAX_BUFFER_SIZE (128 * 1024)
static int emu10k1_playback_constraints(snd_pcm_runtime_t *runtime)
{
int err;
if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
return err;
if ((err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX)) < 0)
return err;
return 0;
}
#define add_playback_constraints emu10k1_playback_constraints
#endif
#if 0 /* RME9652 emulation */ #if 0 /* RME9652 emulation */
#define MAX_BUFFER_SIZE (26 * 64 * 1024) #define MAX_BUFFER_SIZE (26 * 64 * 1024)
#define USE_FORMATS SNDRV_PCM_FMTBIT_S32_LE #define USE_FORMATS SNDRV_PCM_FMTBIT_S32_LE
...@@ -102,6 +116,12 @@ MODULE_DEVICES("{{ALSA,Dummy soundcard}}"); ...@@ -102,6 +116,12 @@ MODULE_DEVICES("{{ALSA,Dummy soundcard}}");
#ifndef USE_PERIODS_MAX #ifndef USE_PERIODS_MAX
#define USE_PERIODS_MAX 1024 #define USE_PERIODS_MAX 1024
#endif #endif
#ifndef add_playback_constraints
#define add_playback_constraints(x) 0
#endif
#ifndef add_capture_constraints
#define add_capture_constraints(x) 0
#endif
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
...@@ -325,6 +345,7 @@ static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream) ...@@ -325,6 +345,7 @@ static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; snd_pcm_runtime_t *runtime = substream->runtime;
snd_card_dummy_pcm_t *dpcm; snd_card_dummy_pcm_t *dpcm;
int err;
dpcm = snd_magic_kcalloc(snd_card_dummy_pcm_t, 0, GFP_KERNEL); dpcm = snd_magic_kcalloc(snd_card_dummy_pcm_t, 0, GFP_KERNEL);
if (dpcm == NULL) if (dpcm == NULL)
...@@ -347,6 +368,11 @@ static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream) ...@@ -347,6 +368,11 @@ static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream)
} }
if (substream->pcm->device & 2) if (substream->pcm->device & 2)
runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID); runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID);
if ((err = add_playback_constraints(runtime)) < 0) {
snd_magic_kfree(dpcm);
return err;
}
return 0; return 0;
} }
...@@ -354,6 +380,7 @@ static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream) ...@@ -354,6 +380,7 @@ static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; snd_pcm_runtime_t *runtime = substream->runtime;
snd_card_dummy_pcm_t *dpcm; snd_card_dummy_pcm_t *dpcm;
int err;
dpcm = snd_magic_kcalloc(snd_card_dummy_pcm_t, 0, GFP_KERNEL); dpcm = snd_magic_kcalloc(snd_card_dummy_pcm_t, 0, GFP_KERNEL);
if (dpcm == NULL) if (dpcm == NULL)
...@@ -377,6 +404,11 @@ static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream) ...@@ -377,6 +404,11 @@ static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream)
} }
if (substream->pcm->device & 2) if (substream->pcm->device & 2)
runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID); runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID);
if ((err = add_capture_constraints(runtime)) < 0) {
snd_magic_kfree(dpcm);
return err;
}
return 0; return 0;
} }
......
...@@ -233,11 +233,7 @@ snd_emu8000_sample_new(snd_emux_t *rec, snd_sf_sample_t *sp, ...@@ -233,11 +233,7 @@ snd_emu8000_sample_new(snd_emux_t *rec, snd_sf_sample_t *sp,
/* we may take too long time in this loop. /* we may take too long time in this loop.
* so give controls back to kernel if needed. * so give controls back to kernel if needed.
*/ */
if (need_resched()) { cond_resched();
if (current->state != TASK_RUNNING)
set_current_state(TASK_RUNNING);
schedule();
}
if (i == sp->v.loopend && if (i == sp->v.loopend &&
(sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP))) (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP)))
......
...@@ -424,13 +424,9 @@ static int emu8k_pcm_trigger(snd_pcm_substream_t *subs, int cmd) ...@@ -424,13 +424,9 @@ static int emu8k_pcm_trigger(snd_pcm_substream_t *subs, int cmd)
*/ */
#define CHECK_SCHEDULER() \ #define CHECK_SCHEDULER() \
do { \ do { \
if (need_resched()) {\ cond_resched();\
if (current->state != TASK_RUNNING)\ if (signal_pending(current))\
set_current_state(TASK_RUNNING);\ return -EAGAIN;\
schedule();\
if (signal_pending(current))\
return -EAGAIN;\
}\
} while (0) } while (0)
......
...@@ -32,7 +32,6 @@ config SND_CS46XX_NEW_DSP ...@@ -32,7 +32,6 @@ config SND_CS46XX_NEW_DSP
config SND_CS4281 config SND_CS4281
tristate "Cirrus Logic (Sound Fusion) CS4281" tristate "Cirrus Logic (Sound Fusion) CS4281"
depends on SND depends on SND
select GAMEPORT
help help
Say 'Y' or 'M' to include support for Cirrus Logic CS4281. Say 'Y' or 'M' to include support for Cirrus Logic CS4281.
...@@ -86,7 +85,6 @@ config SND_HDSP ...@@ -86,7 +85,6 @@ config SND_HDSP
config SND_TRIDENT config SND_TRIDENT
tristate "Trident 4D-Wave DX/NX; SiS 7018" tristate "Trident 4D-Wave DX/NX; SiS 7018"
depends on SND depends on SND
select GAMEPORT
help help
Say 'Y' or 'M' to include support for Trident 4D-Wave DX/NX and Say 'Y' or 'M' to include support for Trident 4D-Wave DX/NX and
SiS 7018 soundcards. SiS 7018 soundcards.
...@@ -114,14 +112,12 @@ config SND_CMIPCI ...@@ -114,14 +112,12 @@ config SND_CMIPCI
config SND_ENS1370 config SND_ENS1370
tristate "(Creative) Ensoniq AudioPCI 1370" tristate "(Creative) Ensoniq AudioPCI 1370"
depends on SND depends on SND
select GAMEPORT
help help
Say 'Y' or 'M' to include support for Ensoniq AudioPCI ES1370. Say 'Y' or 'M' to include support for Ensoniq AudioPCI ES1370.
config SND_ENS1371 config SND_ENS1371
tristate "(Creative) Ensoniq AudioPCI 1371/1373" tristate "(Creative) Ensoniq AudioPCI 1371/1373"
depends on SND depends on SND
select GAMEPORT
help help
Say 'Y' or 'M' to include support for Ensoniq AudioPCI ES1371 and Say 'Y' or 'M' to include support for Ensoniq AudioPCI ES1371 and
Sound Blaster PCI 64 or 128 soundcards. Sound Blaster PCI 64 or 128 soundcards.
...@@ -129,7 +125,6 @@ config SND_ENS1371 ...@@ -129,7 +125,6 @@ config SND_ENS1371
config SND_ES1938 config SND_ES1938
tristate "ESS ES1938/1946/1969 (Solo-1)" tristate "ESS ES1938/1946/1969 (Solo-1)"
depends on SND depends on SND
select GAMEPORT
help help
Say 'Y' or 'M' to include support for ESS Solo-1 (ES1938, ES1946, ES1969) Say 'Y' or 'M' to include support for ESS Solo-1 (ES1938, ES1946, ES1969)
soundcard. soundcard.
...@@ -180,7 +175,6 @@ config SND_INTEL8X0 ...@@ -180,7 +175,6 @@ config SND_INTEL8X0
config SND_SONICVIBES config SND_SONICVIBES
tristate "S3 SonicVibes" tristate "S3 SonicVibes"
depends on SND depends on SND
select GAMEPORT
help help
Say 'Y' or 'M' to include support for S3 SonicVibes based soundcards. Say 'Y' or 'M' to include support for S3 SonicVibes based soundcards.
......
...@@ -2038,16 +2038,17 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, ...@@ -2038,16 +2038,17 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
break; break;
} }
} }
if (dxs_support[dev] == VIA_DXS_AUTO) if (chip_type != TYPE_VIA8233A) {
dxs_support[dev] = check_dxs_list(pci); if (dxs_support[dev] == VIA_DXS_AUTO)
/* force to use VIA8233 or 8233A model according to dxs_support[dev] = check_dxs_list(pci);
* dxs_support module option /* force to use VIA8233 or 8233A model according to
*/ * dxs_support module option
if (dxs_support[dev] == VIA_DXS_DISABLE) */
chip_type = TYPE_VIA8233A; if (dxs_support[dev] == VIA_DXS_DISABLE)
else chip_type = TYPE_VIA8233A;
chip_type = TYPE_VIA8233; else
chip_type = TYPE_VIA8233;
}
if (chip_type == TYPE_VIA8233A) if (chip_type == TYPE_VIA8233A)
strcpy(card->driver, "VIA8233A"); strcpy(card->driver, "VIA8233A");
else else
......
...@@ -378,11 +378,7 @@ static int vx2_load_xilinx_binary(vx_core_t *chip, const snd_hwdep_dsp_image_t * ...@@ -378,11 +378,7 @@ static int vx2_load_xilinx_binary(vx_core_t *chip, const snd_hwdep_dsp_image_t *
if (put_xilinx_data(chip, port, 8, data) < 0) if (put_xilinx_data(chip, port, 8, data) < 0)
return -EINVAL; return -EINVAL;
/* don't take too much time in this loop... */ /* don't take too much time in this loop... */
if (need_resched()) { cond_resched();
if (current->state != TASK_RUNNING)
set_current_state(TASK_RUNNING);
schedule();
}
} }
put_xilinx_data(chip, port, 4, 0xff); /* end signature */ put_xilinx_data(chip, port, 4, 0xff); /* end signature */
......
...@@ -1358,17 +1358,17 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned ...@@ -1358,17 +1358,17 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned
return -EINVAL; return -EINVAL;
} }
for (i = 0; i < num_ins; i++) {
if ((err = parse_audio_unit(state, desc[5 + i])) < 0)
return err;
}
if (num_ins == 1) /* only one ? nonsense! */ if (num_ins == 1) /* only one ? nonsense! */
return 0; return 0;
if (check_ignored_ctl(state, unitid, 0)) if (check_ignored_ctl(state, unitid, 0))
return 0; return 0;
for (i = 0; i < num_ins; i++) {
if ((err = parse_audio_unit(state, desc[5 + i])) < 0)
return err;
}
cval = snd_magic_kcalloc(usb_mixer_elem_info_t, 0, GFP_KERNEL); cval = snd_magic_kcalloc(usb_mixer_elem_info_t, 0, GFP_KERNEL);
if (! cval) { if (! cval) {
snd_printk(KERN_ERR "cannot malloc kcontrol\n"); snd_printk(KERN_ERR "cannot malloc kcontrol\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment