X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fpci%2Ftrident%2Ftrident_main.c;h=cafa9abe7e73ab8e9dc07852d9e11f70077a762d;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=46d050d2bd6d93f6dfdcdd5d00ccef3c5b1e4054;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 46d050d2b..cafa9abe7 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -53,6 +53,9 @@ static int snd_trident_resume(snd_card_t *card, unsigned int state); #endif static int snd_trident_sis_reset(trident_t *trident); +static void snd_trident_clear_voices(trident_t * trident, unsigned short v_min, unsigned short v_max); +static int snd_trident_free(trident_t *trident); + /* * common I/O routines */ @@ -632,7 +635,7 @@ static void snd_trident_write_cvol_reg(trident_t * trident, snd_trident_voice_t Returns: Delta value. ---------------------------------------------------------------------------*/ -unsigned int snd_trident_convert_rate(unsigned int rate) +static unsigned int snd_trident_convert_rate(unsigned int rate) { unsigned int delta; @@ -692,7 +695,7 @@ static unsigned int snd_trident_convert_adc_rate(unsigned int rate) Returns: Delta value. ---------------------------------------------------------------------------*/ -unsigned int snd_trident_spurious_threshold(unsigned int rate, unsigned int period_size) +static unsigned int snd_trident_spurious_threshold(unsigned int rate, unsigned int period_size) { unsigned int res = (rate * period_size) / 48000; if (res < 64) @@ -713,7 +716,7 @@ unsigned int snd_trident_spurious_threshold(unsigned int rate, unsigned int peri Returns: Control value. ---------------------------------------------------------------------------*/ -unsigned int snd_trident_control_mode(snd_pcm_substream_t *substream) +static unsigned int snd_trident_control_mode(snd_pcm_substream_t *substream) { unsigned int CTRL; snd_pcm_runtime_t *runtime = substream->runtime; @@ -770,8 +773,8 @@ static int snd_trident_ioctl(snd_pcm_substream_t * substream, ---------------------------------------------------------------------------*/ -int snd_trident_allocate_pcm_mem(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_trident_allocate_pcm_mem(snd_pcm_substream_t * substream, + snd_pcm_hw_params_t * hw_params) { trident_t *trident = snd_pcm_substream_chip(substream); snd_pcm_runtime_t *runtime = substream->runtime; @@ -804,8 +807,8 @@ int snd_trident_allocate_pcm_mem(snd_pcm_substream_t * substream, ---------------------------------------------------------------------------*/ -int snd_trident_allocate_evoice(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_trident_allocate_evoice(snd_pcm_substream_t * substream, + snd_pcm_hw_params_t * hw_params) { trident_t *trident = snd_pcm_substream_chip(substream); snd_pcm_runtime_t *runtime = substream->runtime; @@ -3537,12 +3540,15 @@ int __devinit snd_trident_create(snd_card_t * card, if (pci_set_dma_mask(pci, 0x3fffffff) < 0 || pci_set_consistent_dma_mask(pci, 0x3fffffff) < 0) { snd_printk("architecture does not support 30bit PCI busmaster DMA\n"); + pci_disable_device(pci); return -ENXIO; } trident = kcalloc(1, sizeof(*trident), GFP_KERNEL); - if (trident == NULL) + if (trident == NULL) { + pci_disable_device(pci); return -ENOMEM; + } trident->device = (pci->vendor << 16) | pci->device; trident->card = card; trident->pci = pci; @@ -3564,6 +3570,7 @@ int __devinit snd_trident_create(snd_card_t * card, if ((err = pci_request_regions(pci, "Trident Audio")) < 0) { kfree(trident); + pci_disable_device(pci); return err; } trident->port = pci_resource_start(pci, 0); @@ -3607,10 +3614,13 @@ int __devinit snd_trident_create(snd_card_t * card, return err; } - if ((err = snd_trident_mixer(trident, pcm_spdif_device)) < 0) { + if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, trident, &ops)) < 0) { snd_trident_free(trident); return err; } + + if ((err = snd_trident_mixer(trident, pcm_spdif_device)) < 0) + return err; /* initialise synth voices */ for (i = 0; i < 64; i++) { @@ -3631,12 +3641,7 @@ int __devinit snd_trident_create(snd_card_t * card, snd_card_set_pm_callback(card, snd_trident_suspend, snd_trident_resume, trident); - snd_trident_proc_init(trident); - if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, trident, &ops)) < 0) { - snd_trident_free(trident); - return err; - } snd_card_set_dev(card, &pci->dev); *rtrident = trident; return 0; @@ -3646,7 +3651,7 @@ int __devinit snd_trident_create(snd_card_t * card, snd_trident_free Description: This routine will free the device specific class for - q the 4DWave card. + the 4DWave card. Paramters: trident - device specific private data for 4DWave card @@ -3654,7 +3659,7 @@ int __devinit snd_trident_create(snd_card_t * card, ---------------------------------------------------------------------------*/ -int snd_trident_free(trident_t *trident) +static int snd_trident_free(trident_t *trident) { #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) if (trident->gameport) { @@ -3675,13 +3680,13 @@ int snd_trident_free(trident_t *trident) snd_util_memhdr_free(trident->tlb.memhdr); if (trident->tlb.silent_page.area) snd_dma_free_pages(&trident->tlb.silent_page); - if (trident->tlb.shadow_entries) - vfree(trident->tlb.shadow_entries); + vfree(trident->tlb.shadow_entries); snd_dma_free_pages(&trident->tlb.buffer); } if (trident->irq >= 0) free_irq(trident->irq, (void *)trident); pci_release_regions(trident->pci); + pci_disable_device(trident->pci); kfree(trident); return 0; } @@ -3802,9 +3807,9 @@ static irqreturn_t snd_trident_interrupt(int irq, void *dev_id, struct pt_regs * } /*--------------------------------------------------------------------------- - snd_trident_attach_synthesizer, snd_trident_detach_synthesizer + snd_trident_attach_synthesizer - Description: Attach/detach synthesizer hooks + Description: Attach synthesizer hooks Paramters: trident - device specific private data for 4DWave card @@ -3823,17 +3828,6 @@ int snd_trident_attach_synthesizer(trident_t *trident) return 0; } -int snd_trident_detach_synthesizer(trident_t *trident) -{ -#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) - if (trident->seq_dev) { - snd_device_free(trident->card, trident->seq_dev); - trident->seq_dev = NULL; - } -#endif - return 0; -} - snd_trident_voice_t *snd_trident_alloc_voice(trident_t * trident, int type, int client, int port) { snd_trident_voice_t *pvoice; @@ -3906,7 +3900,7 @@ void snd_trident_free_voice(trident_t * trident, snd_trident_voice_t *voice) private_free(voice); } -void snd_trident_clear_voices(trident_t * trident, unsigned short v_min, unsigned short v_max) +static void snd_trident_clear_voices(trident_t * trident, unsigned short v_min, unsigned short v_max) { unsigned int i, val, mask[2] = { 0, 0 }; @@ -3949,7 +3943,7 @@ static int snd_trident_suspend(snd_card_t *card, unsigned int state) case TRIDENT_DEVICE_ID_SI7018: break; } - snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + pci_disable_device(trident->pci); return 0; } @@ -3984,7 +3978,6 @@ static int snd_trident_resume(snd_card_t *card, unsigned int state) snd_trident_enable_eso(trident); - snd_power_change_state(card, SNDRV_CTL_POWER_D0); trident->in_suspend = 0; return 0; } @@ -3995,9 +3988,7 @@ EXPORT_SYMBOL(snd_trident_free_voice); EXPORT_SYMBOL(snd_trident_start_voice); EXPORT_SYMBOL(snd_trident_stop_voice); EXPORT_SYMBOL(snd_trident_write_voice_regs); -EXPORT_SYMBOL(snd_trident_clear_voices); /* trident_memory.c symbols */ EXPORT_SYMBOL(snd_trident_synth_alloc); EXPORT_SYMBOL(snd_trident_synth_free); -EXPORT_SYMBOL(snd_trident_synth_bzero); EXPORT_SYMBOL(snd_trident_synth_copy_from_user);