ALSA: oxygen: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
Subsystems (4)
PATCH 1/2 ALSA: oxygen: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
The ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver.
Signed-off-by Lars-Peter Clausen <[email protected]>
--- sound/pci/oxygen/oxygen_pcm.c | 8 -------- 1 file changed, 8 deletions(-)
sound/pci/oxygen/oxygen_pcm.c +0 -8
@@ -676,11 +676,6 @@ static struct snd_pcm_ops oxygen_ac97_ops = { .pointer = oxygen_pointer, }; -static void oxygen_pcm_free (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -int oxygen_pcm_init (struct oxygen *chip) {struct snd_pcm *pcm;
@@ -705,7 +700,6 @@ int oxygen_pcm_init(struct oxygen *chip)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &oxygen_rec_b_ops); pcm->private_data = chip; - pcm->private_free = oxygen_pcm_free;strcpy (pcm->name,"Multichannel" );if (outs) snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
@@ -734,7 +728,6 @@ int oxygen_pcm_init(struct oxygen *chip)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &oxygen_rec_c_ops); pcm->private_data = chip; - pcm->private_free = oxygen_pcm_free;strcpy (pcm->name,"Digital" ); snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
@@ -765,7 +758,6 @@ int oxygen_pcm_init(struct oxygen *chip)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &oxygen_rec_b_ops); pcm->private_data = chip; - pcm->private_free = oxygen_pcm_free;strcpy (pcm->name, outs ?"Front Panel" :"Analog 2" ); snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
Signature · 1 line
1.8.0
PATCH 2/2 ALSA: ps3: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
The ALSA core takes care that all preallocated memory is freed when the card (and the PCM) itself is freed. There is no need to do this manually in the driver.
Signed-off-by Lars-Peter Clausen <[email protected]>
--- sound/ppc/snd_ps3.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/ppc/snd_ps3.c +1 -3
@@ -1044,7 +1044,7 @@ static int snd_ps3_driver_probe(struct ps3_system_bus_device *dev)if (!the_card.null_buffer_start_vaddr) {pr_info ("%s: nullbuffer alloc failed\n" , __func__); ret = -ENOMEM ; - goto clean_preallocate; + goto clean_card; } pr_debug("%s: null vaddr=%p dma=%#llx\n", __func__, the_card.null_buffer_start_vaddr,
@@ -1066,8 +1066,6 @@ clean_dma_map:PAGE_SIZE , the_card.null_buffer_start_vaddr, the_card.null_buffer_start_dma_addr); -clean_preallocate: -snd_pcm_lib_preallocate_free_for_all (the_card.pcm); clean_card:snd_card_free (the_card.card); clean_irq:
Signature · 1 line
1.8.0
Takashi Iwai
AppliedAt Fri, 2 Jan 2015 15:03:42 +0100,
Quoted 5 lines · Lars-Peter Clausen
The ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver.
Signed-off-by Lars-Peter Clausen <[email protected]>
Applied both patches. Thanks.
Takashi
Quoted 47 lines
--- sound/pci/oxygen/oxygen_pcm.c | 8 -------- 1 file changed, 8 deletions(-)sound/pci/oxygen/oxygen_pcm.c +0
-8@@ -676,11 +676,6 @@ static struct snd_pcm_ops oxygen_ac97_ops = { .pointer = oxygen_pointer, }; -static void oxygen_pcm_free (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -int oxygen_pcm_init (struct oxygen *chip) {struct snd_pcm *pcm;@@ -705,7 +700,6 @@ int oxygen_pcm_init(struct oxygen *chip)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &oxygen_rec_b_ops); pcm->private_data = chip; - pcm->private_free = oxygen_pcm_free;strcpy (pcm->name,"Multichannel" );if (outs) snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,@@ -734,7 +728,6 @@ int oxygen_pcm_init(struct oxygen *chip)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &oxygen_rec_c_ops); pcm->private_data = chip; - pcm->private_free = oxygen_pcm_free;strcpy (pcm->name,"Digital" ); snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),@@ -765,7 +758,6 @@ int oxygen_pcm_init(struct oxygen *chip)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &oxygen_rec_b_ops); pcm->private_data = chip; - pcm->private_free = oxygen_pcm_free;strcpy (pcm->name, outs ?"Front Panel" :"Analog 2" ); snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),Signature · 1 line
1.8.0