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>
This commit is contained in:
parent
a2482377c9
commit
9c8e0a260e
2 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Reference in a new issue