aboutsummaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-11-24 08:45:57 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-11-24 12:24:52 -0200
commit50f3beb50abe0cc0228363af804e50e710b3e5b0 (patch)
treefe189ffd9fd3caf67202a6f417d2da7e5ffe03d5 /drivers/media
parent7a8f4ccfd572a11f609439dc6a75165b441641bc (diff)
V4L/DVB (9742): em28xx-alsa: implement another locking schema
Instead of using a spinlock, it is better to call the proper pcm stream locking schema. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index ac3292d7646..dfac2e042a5 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -75,7 +75,9 @@ static void em28xx_audio_isocirq(struct urb *urb)
struct em28xx *dev = urb->context;
int i;
unsigned int oldptr;
+#ifdef NO_PCM_LOCK
unsigned long flags;
+#endif
int period_elapsed = 0;
int status;
unsigned char *cp;
@@ -96,9 +98,26 @@ static void em28xx_audio_isocirq(struct urb *urb)
if (!length)
continue;
+#ifdef NO_PCM_LOCK
spin_lock_irqsave(&dev->adev->slock, flags);
-
+#endif
oldptr = dev->adev->hwptr_done_capture;
+ if (oldptr + length >= runtime->buffer_size) {
+ unsigned int cnt =
+ runtime->buffer_size - oldptr;
+ memcpy(runtime->dma_area + oldptr * stride, cp,
+ cnt * stride);
+ memcpy(runtime->dma_area, cp + cnt * stride,
+ length * stride - cnt * stride);
+ } else {
+ memcpy(runtime->dma_area + oldptr * stride, cp,
+ length * stride);
+ }
+
+#ifndef NO_PCM_LOCK
+ snd_pcm_stream_lock(substream);
+#endif
+
dev->adev->hwptr_done_capture += length;
if (dev->adev->hwptr_done_capture >=
runtime->buffer_size)
@@ -113,19 +132,11 @@ static void em28xx_audio_isocirq(struct urb *urb)
period_elapsed = 1;
}
+#ifdef NO_PCM_LOCK
spin_unlock_irqrestore(&dev->adev->slock, flags);
-
- if (oldptr + length >= runtime->buffer_size) {
- unsigned int cnt =
- runtime->buffer_size - oldptr;
- memcpy(runtime->dma_area + oldptr * stride, cp,
- cnt * stride);
- memcpy(runtime->dma_area, cp + cnt * stride,
- length * stride - cnt * stride);
- } else {
- memcpy(runtime->dma_area + oldptr * stride, cp,
- length * stride);
- }
+#else
+ snd_pcm_stream_unlock(substream);
+#endif
}
if (period_elapsed)
snd_pcm_period_elapsed(substream);