summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2010-01-07 00:56:14 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 15:10:44 -0300
commit94b12d9ea555851632deee1c2b06c4f281a45e12 (patch)
treed98767316a132848927458384058f17f5f6d972f
parentc71fd169a13d34f26997b27183b510e0b7fc2623 (diff)
V4L/DVB: cx18-alsa: Fix the rates definition and move some buffer freeing code.
Clarify the rates available for the device, and move the freeing of the buffer to the free routine instead of the close (per Takashi's suggestion). Thanks to Takashi Iwai for reviewing and providing feedback. This work was sponsored by ONELAN Limited. Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/cx18/cx18-alsa-pcm.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/media/video/cx18/cx18-alsa-pcm.c b/drivers/media/video/cx18/cx18-alsa-pcm.c
index e613826d5a4..6e56df94e34 100644
--- a/drivers/media/video/cx18/cx18-alsa-pcm.c
+++ b/drivers/media/video/cx18/cx18-alsa-pcm.c
@@ -55,7 +55,7 @@ static struct snd_pcm_hardware snd_cx18_hw_capture = {
.formats = SNDRV_PCM_FMTBIT_S16_LE,
- .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_KNOT,
+ .rates = SNDRV_PCM_RATE_48000,
.rate_min = 48000,
.rate_max = 48000,
@@ -196,7 +196,6 @@ static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream)
static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream)
{
- unsigned long flags;
struct snd_cx18_card *cxsc = snd_pcm_substream_chip(substream);
struct v4l2_device *v4l2_dev = cxsc->v4l2_dev;
struct cx18 *cx = to_cx18(v4l2_dev);
@@ -212,14 +211,6 @@ static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream)
cx->pcm_announce_callback = NULL;
- spin_lock_irqsave(&cxsc->slock, flags);
- if (substream->runtime->dma_area) {
- dprintk("freeing pcm capture region\n");
- vfree(substream->runtime->dma_area);
- substream->runtime->dma_area = NULL;
- }
- spin_unlock_irqrestore(&cxsc->slock, flags);
-
return 0;
}
@@ -265,6 +256,17 @@ static int snd_cx18_pcm_hw_params(struct snd_pcm_substream *substream,
static int snd_cx18_pcm_hw_free(struct snd_pcm_substream *substream)
{
+ struct snd_cx18_card *cxsc = snd_pcm_substream_chip(substream);
+ unsigned long flags;
+
+ spin_lock_irqsave(&cxsc->slock, flags);
+ if (substream->runtime->dma_area) {
+ dprintk("freeing pcm capture region\n");
+ vfree(substream->runtime->dma_area);
+ substream->runtime->dma_area = NULL;
+ }
+ spin_unlock_irqrestore(&cxsc->slock, flags);
+
return 0;
}