lkml.org 
[lkml]   [2008]   [Mar]   [10]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateMon, 10 Mar 2008 16:49:46 +0900 (JST)
SubjectRe: [PATCH] at73c213: Remove redundant private_free routine
FromAtsushi Nemoto <>
On Mon, 10 Mar 2008 16:13:54 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> snd_pcm_lib_preallocate_free_for_all() is called from snd_pcm_free()
> just after calling the private_free routine.  So there should be no
> need to call it in driver's private_free routine.
...
> -	pcm->private_data = chip;
> -	pcm->private_free = snd_at73c213_pcm_free;
>  	pcm->info_flags = SNDRV_PCM_INFO_BLOCK_TRANSFER;
>  	strcpy(pcm->name, "at73c213");
>  	chip->pcm = pcm;

Sorry, the patch was wrong.  The private_data field should still be
initialized.  Revised.

------------------------------------------------------
Subject: [PATCH] at73c213: Remove redundant private_free routine
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
snd_pcm_lib_preallocate_free_for_all() is called from snd_pcm_free()
just after calling the private_free routine.  So there should be no
need to call it in driver's private_free routine.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index 89d6e9c..bf3ea43 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -314,15 +314,6 @@ static struct snd_pcm_ops at73c213_playback_ops = {
 	.pointer	= snd_at73c213_pcm_pointer,
 };
 
-static void snd_at73c213_pcm_free(struct snd_pcm *pcm)
-{
-	struct snd_at73c213 *chip = snd_pcm_chip(pcm);
-	if (chip->pcm) {
-		snd_pcm_lib_preallocate_free_for_all(chip->pcm);
-		chip->pcm = NULL;
-	}
-}
-
 static int __devinit snd_at73c213_pcm_new(struct snd_at73c213 *chip, int device)
 {
 	struct snd_pcm *pcm;
@@ -334,7 +325,6 @@ static int __devinit snd_at73c213_pcm_new(struct snd_at73c213 *chip, int device)
 		goto out;
 
 	pcm->private_data = chip;
-	pcm->private_free = snd_at73c213_pcm_free;
 	pcm->info_flags = SNDRV_PCM_INFO_BLOCK_TRANSFER;
 	strcpy(pcm->name, "at73c213");
 	chip->pcm = pcm;

\
 
 \ /
  Last update: 2008-03-10 08:53    [W:1.233 / U:0.120 seconds]
©2003-2008 Jasper Spaans