Commit 5f3b74c6 authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update

D:2003/09/02 19:06:12
C:Trident driver
A:Takashi Iwai <tiwai@suse.de>
F:pci/trident/trident_main.c:1.46->1.47 
L: Clemens Ladisch <clemens@ladisch.de>:
L:
L:- reduces stack usage in snd_trident_mixer()
parent 3189c6f5
...@@ -2958,10 +2958,12 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device ...@@ -2958,10 +2958,12 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
ac97_t _ac97; ac97_t _ac97;
snd_card_t * card = trident->card; snd_card_t * card = trident->card;
snd_kcontrol_t *kctl; snd_kcontrol_t *kctl;
snd_ctl_elem_value_t uctl; snd_ctl_elem_value_t *uctl;
int idx, err, retries = 2; int idx, err, retries = 2;
memset(&uctl, 0, sizeof(uctl)); uctl = (snd_ctl_elem_value_t *)snd_kcalloc(sizeof(*uctl), GFP_KERNEL);
if (!uctl)
return -ENOMEM;
memset(&_ac97, 0, sizeof(_ac97)); memset(&_ac97, 0, sizeof(_ac97));
_ac97.write = snd_trident_codec_write; _ac97.write = snd_trident_codec_write;
...@@ -2973,12 +2975,12 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device ...@@ -2973,12 +2975,12 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
if ((err = snd_ac97_mixer(trident->card, &_ac97, &trident->ac97)) < 0) { if ((err = snd_ac97_mixer(trident->card, &_ac97, &trident->ac97)) < 0) {
if (trident->device == TRIDENT_DEVICE_ID_SI7018) { if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
if ((err = snd_trident_sis_reset(trident)) < 0) if ((err = snd_trident_sis_reset(trident)) < 0)
return err; goto __out;
if (retries-- > 0) if (retries-- > 0)
goto __again; goto __again;
return -EIO; err = -EIO;
} }
return err; goto __out;
} }
/* secondary codec? */ /* secondary codec? */
...@@ -3002,11 +3004,11 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device ...@@ -3002,11 +3004,11 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
if (trident->device != TRIDENT_DEVICE_ID_SI7018) { if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_vol_wave_control, trident))) < 0) if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_vol_wave_control, trident))) < 0)
return err; goto __out;
kctl->put(kctl, &uctl); kctl->put(kctl, uctl);
if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_vol_music_control, trident))) < 0) if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_vol_music_control, trident))) < 0)
return err; goto __out;
kctl->put(kctl, &uctl); kctl->put(kctl, uctl);
outl(trident->musicvol_wavevol = 0x00000000, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL)); outl(trident->musicvol_wavevol = 0x00000000, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL));
} else { } else {
outl(trident->musicvol_wavevol = 0xffff0000, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL)); outl(trident->musicvol_wavevol = 0xffff0000, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL));
...@@ -3019,59 +3021,68 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device ...@@ -3019,59 +3021,68 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
tmix->voice = NULL; tmix->voice = NULL;
} }
if ((trident->ctl_vol = snd_ctl_new1(&snd_trident_pcm_vol_control, trident)) == NULL) if ((trident->ctl_vol = snd_ctl_new1(&snd_trident_pcm_vol_control, trident)) == NULL)
return -ENOMEM; goto __nomem;
if ((err = snd_ctl_add(card, trident->ctl_vol))) if ((err = snd_ctl_add(card, trident->ctl_vol)))
return err; goto __out;
if ((trident->ctl_pan = snd_ctl_new1(&snd_trident_pcm_pan_control, trident)) == NULL) if ((trident->ctl_pan = snd_ctl_new1(&snd_trident_pcm_pan_control, trident)) == NULL)
return -ENOMEM; goto __nomem;
if ((err = snd_ctl_add(card, trident->ctl_pan))) if ((err = snd_ctl_add(card, trident->ctl_pan)))
return err; goto __out;
if ((trident->ctl_rvol = snd_ctl_new1(&snd_trident_pcm_rvol_control, trident)) == NULL) if ((trident->ctl_rvol = snd_ctl_new1(&snd_trident_pcm_rvol_control, trident)) == NULL)
return -ENOMEM; goto __nomem;
if ((err = snd_ctl_add(card, trident->ctl_rvol))) if ((err = snd_ctl_add(card, trident->ctl_rvol)))
return err; goto __out;
if ((trident->ctl_cvol = snd_ctl_new1(&snd_trident_pcm_cvol_control, trident)) == NULL) if ((trident->ctl_cvol = snd_ctl_new1(&snd_trident_pcm_cvol_control, trident)) == NULL)
return -ENOMEM; goto __nomem;
if ((err = snd_ctl_add(card, trident->ctl_cvol))) if ((err = snd_ctl_add(card, trident->ctl_cvol)))
return err; goto __out;
if (trident->device == TRIDENT_DEVICE_ID_NX) { if (trident->device == TRIDENT_DEVICE_ID_NX) {
if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_ac97_rear_control, trident))) < 0) if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_ac97_rear_control, trident))) < 0)
return err; goto __out;
kctl->put(kctl, &uctl); kctl->put(kctl, uctl);
} }
if (trident->device == TRIDENT_DEVICE_ID_NX || trident->device == TRIDENT_DEVICE_ID_SI7018) { if (trident->device == TRIDENT_DEVICE_ID_NX || trident->device == TRIDENT_DEVICE_ID_SI7018) {
if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_spdif_control, trident))) < 0) if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_spdif_control, trident))) < 0)
return err; goto __out;
if (trident->ac97->ext_id & AC97_EI_SPDIF) if (trident->ac97->ext_id & AC97_EI_SPDIF)
kctl->id.index++; kctl->id.index++;
if (trident->ac97_sec && (trident->ac97_sec->ext_id & AC97_EI_SPDIF)) if (trident->ac97_sec && (trident->ac97_sec->ext_id & AC97_EI_SPDIF))
kctl->id.index++; kctl->id.index++;
idx = kctl->id.index; idx = kctl->id.index;
kctl->put(kctl, &uctl); kctl->put(kctl, uctl);
if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_spdif_default, trident))) < 0) if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_spdif_default, trident))) < 0)
return err; goto __out;
kctl->id.index = idx; kctl->id.index = idx;
kctl->id.device = pcm_spdif_device; kctl->id.device = pcm_spdif_device;
if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_spdif_mask, trident))) < 0) if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_spdif_mask, trident))) < 0)
return err; goto __out;
kctl->id.index = idx; kctl->id.index = idx;
kctl->id.device = pcm_spdif_device; kctl->id.device = pcm_spdif_device;
if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_spdif_stream, trident))) < 0) if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_spdif_stream, trident))) < 0)
return err; goto __out;
kctl->id.index = idx; kctl->id.index = idx;
kctl->id.device = pcm_spdif_device; kctl->id.device = pcm_spdif_device;
trident->spdif_pcm_ctl = kctl; trident->spdif_pcm_ctl = kctl;
} }
return 0; err = 0;
goto __out;
__nomem:
err = -ENOMEM;
__out:
kfree(uctl);
return err;
} }
/* /*
......
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