summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa5246a.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-08-23 05:31:47 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 09:36:53 -0200
commit7d43cd53c851e3cf04d73108d4e7e25a1104c6f5 (patch)
tree4fcf2e3148065f1727b630deefef9612610bf789 /drivers/media/video/saa5246a.c
parent2f3d00250ae5b1d2727e2723da805290ec408503 (diff)
V4L/DVB (8780): v4l: replace the last uses of video_exclusive_open/release
Handle the video_exclusive_open/release functionality inside the driver. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa5246a.c')
-rw-r--r--drivers/media/video/saa5246a.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index e2c538ee88f..5f5aa2063e0 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -61,6 +61,7 @@ struct saa5246a_device
u8 pgbuf[NUM_DAUS][VTX_VIRTUALSIZE];
int is_searching[NUM_DAUS];
struct i2c_client *client;
+ unsigned long in_use;
struct mutex lock;
};
@@ -736,22 +737,14 @@ static int saa5246a_open(struct inode *inode, struct file *file)
{
struct video_device *vd = video_devdata(file);
struct saa5246a_device *t = vd->priv;
- int err;
- lock_kernel();
- err = video_exclusive_open(inode,file);
- if (err < 0) {
- unlock_kernel();
- return err;
- }
+ if (t->client == NULL)
+ return -ENODEV;
- if (t->client==NULL) {
- err = -ENODEV;
- goto fail;
- }
+ if (test_and_set_bit(0, &t->in_use))
+ return -EBUSY;
if (i2c_senddata(t, SAA5246A_REGISTER_R0,
-
R0_SELECT_R11 |
R0_PLL_TIME_CONSTANT_LONG |
R0_ENABLE_nODD_EVEN_OUTPUT |
@@ -777,17 +770,10 @@ static int saa5246a_open(struct inode *inode, struct file *file)
COMMAND_END))
{
- err = -EIO;
- goto fail;
+ clear_bit(0, &t->in_use);
+ return -EIO;
}
- unlock_kernel();
-
return 0;
-
-fail:
- video_exclusive_release(inode,file);
- unlock_kernel();
- return err;
}
static int saa5246a_release(struct inode *inode, struct file *file)
@@ -806,7 +792,7 @@ static int saa5246a_release(struct inode *inode, struct file *file)
R1_VCS_TO_SCS,
COMMAND_END);
- video_exclusive_release(inode,file);
+ clear_bit(0, &t->in_use);
return 0;
}