diff options
author | James Courtier-Dutton <James@superbug.co.uk> | 2007-11-10 18:55:14 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 17:30:24 +0100 |
commit | c94fa4c9168e51a8dab8e72cb9f0d89673fc8d8c (patch) | |
tree | 08169553a3b69a284b322941131f406661e499e8 /sound/pci/emu10k1/emu10k1_synth.c | |
parent | [ALSA] emu10k1 - Use enum for emu_model types (diff) | |
download | linux-c94fa4c9168e51a8dab8e72cb9f0d89673fc8d8c.tar.xz linux-c94fa4c9168e51a8dab8e72cb9f0d89673fc8d8c.zip |
[ALSA] emu10k1: General cleanup, add new locks, fix alsa bug#3501, kernel bug#9304.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/emu10k1/emu10k1_synth.c')
-rw-r--r-- | sound/pci/emu10k1/emu10k1_synth.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/sound/pci/emu10k1/emu10k1_synth.c b/sound/pci/emu10k1/emu10k1_synth.c index 204995a1dfbd..ad7b71491fc4 100644 --- a/sound/pci/emu10k1/emu10k1_synth.c +++ b/sound/pci/emu10k1/emu10k1_synth.c @@ -30,7 +30,7 @@ MODULE_LICENSE("GPL"); */ static int snd_emu10k1_synth_new_device(struct snd_seq_device *dev) { - struct snd_emux *emu; + struct snd_emux *emux; struct snd_emu10k1 *hw; struct snd_emu10k1_synth_arg *arg; unsigned long flags; @@ -46,53 +46,56 @@ static int snd_emu10k1_synth_new_device(struct snd_seq_device *dev) else if (arg->max_voices > 64) arg->max_voices = 64; - if (snd_emux_new(&emu) < 0) + if (snd_emux_new(&emux) < 0) return -ENOMEM; - snd_emu10k1_ops_setup(emu); - emu->hw = hw = arg->hwptr; - emu->max_voices = arg->max_voices; - emu->num_ports = arg->seq_ports; - emu->pitch_shift = -501; - emu->memhdr = hw->memhdr; - emu->midi_ports = arg->seq_ports < 2 ? arg->seq_ports : 2; /* maximum two ports */ - emu->midi_devidx = hw->audigy ? 2 : 1; /* audigy has two external midis */ - emu->linear_panning = 0; - emu->hwdep_idx = 2; /* FIXED */ - - if (snd_emux_register(emu, dev->card, arg->index, "Emu10k1") < 0) { - snd_emux_free(emu); + snd_emu10k1_ops_setup(emux); + hw = arg->hwptr; + emux->hw = hw; + emux->max_voices = arg->max_voices; + emux->num_ports = arg->seq_ports; + emux->pitch_shift = -501; + emux->memhdr = hw->memhdr; + /* maximum two ports */ + emux->midi_ports = arg->seq_ports < 2 ? arg->seq_ports : 2; + /* audigy has two external midis */ + emux->midi_devidx = hw->audigy ? 2 : 1; + emux->linear_panning = 0; + emux->hwdep_idx = 2; /* FIXED */ + + if (snd_emux_register(emux, dev->card, arg->index, "Emu10k1") < 0) { + snd_emux_free(emux); return -ENOMEM; } spin_lock_irqsave(&hw->voice_lock, flags); - hw->synth = emu; + hw->synth = emux; hw->get_synth_voice = snd_emu10k1_synth_get_voice; spin_unlock_irqrestore(&hw->voice_lock, flags); - dev->driver_data = emu; + dev->driver_data = emux; return 0; } static int snd_emu10k1_synth_delete_device(struct snd_seq_device *dev) { - struct snd_emux *emu; + struct snd_emux *emux; struct snd_emu10k1 *hw; unsigned long flags; if (dev->driver_data == NULL) return 0; /* not registered actually */ - emu = dev->driver_data; + emux = dev->driver_data; - hw = emu->hw; + hw = emux->hw; spin_lock_irqsave(&hw->voice_lock, flags); hw->synth = NULL; hw->get_synth_voice = NULL; spin_unlock_irqrestore(&hw->voice_lock, flags); - snd_emux_free(emu); + snd_emux_free(emux); return 0; } |