aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFrederic CAND <frederic.cand@anevia.com>2008-10-30 04:50:05 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-11-11 08:11:27 -0200
commit9c8e0a260ed7c8935d7ee8dd51cd1971ef516385 (patch)
treec5182b4a37912391215c00e9a2fcad46de83a47b /drivers
parenta2482377c9df89daa0cb94252bd1e8829c0e9c2f (diff)
V4L/DVB (9496): cx88-blackbird: bugfix: cx88-blackbird-mpeg-users
Allows multiple access to the mpeg device Signed-off-by: Frederic CAND <frederic.cand@anevia.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c8
-rw-r--r--drivers/media/video/cx88/cx88.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index ae77450f126..d3ae5b4dfca 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1078,7 +1078,7 @@ static int mpeg_open(struct inode *inode, struct file *file)
}
}
- if (blackbird_initialize_codec(dev) < 0) {
+ if (!atomic_read(&dev->core->mpeg_users) && blackbird_initialize_codec(dev) < 0) {
if (drv)
drv->request_release(drv);
unlock_kernel();
@@ -1109,6 +1109,8 @@ static int mpeg_open(struct inode *inode, struct file *file)
fh->mpegq.field);
unlock_kernel();
+ atomic_inc(&dev->core->mpeg_users);
+
return 0;
}
@@ -1118,7 +1120,7 @@ static int mpeg_release(struct inode *inode, struct file *file)
struct cx8802_dev *dev = fh->dev;
struct cx8802_driver *drv = NULL;
- if (dev->mpeg_active)
+ if (dev->mpeg_active && atomic_read(&dev->core->mpeg_users) == 1)
blackbird_stop_codec(dev);
cx8802_cancel_buffers(fh->dev);
@@ -1138,6 +1140,8 @@ static int mpeg_release(struct inode *inode, struct file *file)
if (drv)
drv->request_release(drv);
+ atomic_dec(&dev->core->mpeg_users);
+
return 0;
}
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 76207c2856b..f4240965be3 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -352,6 +352,7 @@ struct cx88_core {
/* various v4l controls */
u32 freq;
atomic_t users;
+ atomic_t mpeg_users;
/* cx88-video needs to access cx8802 for hybrid tuner pll access. */
struct cx8802_dev *dvbdev;