LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] at73c213: Remove redundant private_free routine
@ 2008-03-10 7:13 Atsushi Nemoto
2008-03-10 7:49 ` Atsushi Nemoto
0 siblings, 1 reply; 3+ messages in thread
From: Atsushi Nemoto @ 2008-03-10 7:13 UTC (permalink / raw)
To: linux-kernel; +Cc: Hans-Christian Egtvedt, Haavard Skinnemoen, Andrew Victor
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..024db14 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;
@@ -333,8 +324,6 @@ static int __devinit snd_at73c213_pcm_new(struct snd_at73c213 *chip, int device)
if (retval < 0)
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] at73c213: Remove redundant private_free routine
2008-03-10 7:13 [PATCH] at73c213: Remove redundant private_free routine Atsushi Nemoto
@ 2008-03-10 7:49 ` Atsushi Nemoto
2008-03-10 9:43 ` Hans-Christian Egtvedt
0 siblings, 1 reply; 3+ messages in thread
From: Atsushi Nemoto @ 2008-03-10 7:49 UTC (permalink / raw)
To: linux-kernel; +Cc: hcegtvedt, hskinnemoen, avictor.za
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] at73c213: Remove redundant private_free routine
2008-03-10 7:49 ` Atsushi Nemoto
@ 2008-03-10 9:43 ` Hans-Christian Egtvedt
0 siblings, 0 replies; 3+ messages in thread
From: Hans-Christian Egtvedt @ 2008-03-10 9:43 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-kernel, hcegtvedt, hskinnemoen, avictor.za
On Mon, 2008-03-10 at 16:49 +0900, Atsushi Nemoto wrote:
> 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.
>
I spun this around, and it works fine on my system (AVR32 AT32AP7000 on
STK1000).
> ------------------------------------------------------
> 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.
>
Thanks for debugging the driver.
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Acked-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
> ---
> 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;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
With kind regards,
Hans-Christian Egtvedt, Applications Engineer
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-10 9:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-10 7:13 [PATCH] at73c213: Remove redundant private_free routine Atsushi Nemoto
2008-03-10 7:49 ` Atsushi Nemoto
2008-03-10 9:43 ` Hans-Christian Egtvedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).