From: Daniel Mack <zonque@gmail.com>
To: alsa-devel@alsa-project.org
Cc: Matt Porter <mporter@ti.com>,
broonie@opensource.wolfsonmicro.com, "Hebbar,
Gururaja" <gururaja.hebbar@ti.com>,
Anil Kumar <anilkumar.v@ti.com>, Daniel Mack <zonque@gmail.com>,
lrg@ti.com
Subject: [PATCH] ALSA: ASoC: davinci-pcm: stub out gen_pool functions for !CONFIG_GENERIC_ALLOCATOR
Date: Wed, 10 Oct 2012 14:49:48 +0200 [thread overview]
Message-ID: <1349873388-32331-1-git-send-email-zonque@gmail.com> (raw)
On platforms without CONFIG_GENERIC_ALLOCATOR, these functions can be
no-ops. The code that uses the memory buffers does the right thing if
they are NULL.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Cc: Matt Porter <mporter@ti.com>
Cc: Anil Kumar <anilkumar.v@ti.com>
---
Alternatively, the gen_pool functions could stub out themselves for
!CONFIG_GENERIC_ALLOCATOR.
sound/soc/davinci/davinci-pcm.c | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 01b3f17..afab81f 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -251,6 +251,7 @@ static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data)
}
}
+#ifdef CONFIG_GENERIC_ALLOCATOR
static int allocate_sram(struct snd_pcm_substream *substream,
struct gen_pool *sram_pool, unsigned size,
struct snd_pcm_hardware *ppcm)
@@ -284,6 +285,28 @@ exit1:
return -ENOMEM;
}
+static void davinci_free_sram(struct snd_pcm_substream *substream,
+ struct snd_dma_buffer *iram_dma)
+{
+ struct davinci_runtime_data *prtd = substream->runtime->private_data;
+ struct gen_pool *sram_pool = prtd->params->sram_pool;
+
+ gen_pool_free(sram_pool, (unsigned) iram_dma->area, iram_dma->bytes);
+}
+#else
+static int allocate_sram(struct snd_pcm_substream *substream,
+ struct gen_pool *sram_pool, unsigned size,
+ struct snd_pcm_hardware *ppcm)
+{
+ return 0;
+}
+
+static void davinci_free_sram(struct snd_pcm_substream *substream,
+ struct snd_dma_buffer *iram_dma)
+{
+}
+#endif
+
/*
* Only used with ping/pong.
* This is called after runtime->dma_addr, period_bytes and data_type are valid
@@ -813,11 +836,7 @@ static void davinci_pcm_free(struct snd_pcm *pcm)
buf->area = NULL;
iram_dma = buf->private_data;
if (iram_dma) {
- struct davinci_runtime_data *prtd =
- substream->runtime->private_data;
- struct gen_pool *sram_pool = prtd->params->sram_pool;
- gen_pool_free(sram_pool, (unsigned)iram_dma->area,
- iram_dma->bytes);
+ davinci_free_sram(substream, iram_dma);
kfree(iram_dma);
}
}
--
1.7.11.4
next reply other threads:[~2012-10-10 12:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-10 12:49 Daniel Mack [this message]
2012-10-10 13:27 ` [PATCH] ALSA: ASoC: davinci-pcm: stub out gen_pool functions for !CONFIG_GENERIC_ALLOCATOR Daniel Mack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349873388-32331-1-git-send-email-zonque@gmail.com \
--to=zonque@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=anilkumar.v@ti.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=gururaja.hebbar@ti.com \
--cc=lrg@ti.com \
--cc=mporter@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).