aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa5249.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/saa5249.c
parentV4L/DVB (8777): tea575x-tuner: replace video_exclusive_open/release (diff)
downloadlinux-dev-7d43cd53c851e3cf04d73108d4e7e25a1104c6f5.tar.xz
linux-dev-7d43cd53c851e3cf04d73108d4e7e25a1104c6f5.zip
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/saa5249.c')
-rw-r--r--drivers/media/video/saa5249.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index 96c0fdf1a051..dfd8a9338c55 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -110,6 +110,7 @@ struct saa5249_device
int disp_mode;
int virtual_mode;
struct i2c_client *client;
+ unsigned long in_use;
struct mutex lock;
};
@@ -631,34 +632,27 @@ static int saa5249_ioctl(struct inode *inode, struct file *file,
static int saa5249_open(struct inode *inode, struct file *file)
{
struct video_device *vd = video_devdata(file);
- struct saa5249_device *t=vd->priv;
- int err,pgbuf;
+ struct saa5249_device *t = vd->priv;
+ int pgbuf;
- 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, 0, 0, -1) || /* Select R11 */
- /* Turn off parity checks (we do this ourselves) */
+ if (i2c_senddata(t, 0, 0, -1) || /* Select R11 */
+ /* Turn off parity checks (we do this ourselves) */
i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) ||
- /* Display TV-picture, no virtual rows */
- i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1)) /* Set display to page 4 */
-
+ /* Display TV-picture, no virtual rows */
+ i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1))
+ /* Set display to page 4 */
{
- err = -EIO;
- goto fail;
+ clear_bit(0, &t->in_use);
+ return -EIO;
}
- for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++)
- {
+ for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) {
memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf));
memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs));
memset(t->vdau[pgbuf].laststat, 0, sizeof(t->vdau[0].laststat));
@@ -668,13 +662,7 @@ static int saa5249_open(struct inode *inode, struct file *file)
t->is_searching[pgbuf] = false;
}
t->virtual_mode = false;
- unlock_kernel();
return 0;
-
- fail:
- video_exclusive_release(inode,file);
- unlock_kernel();
- return err;
}
@@ -682,10 +670,11 @@ static int saa5249_open(struct inode *inode, struct file *file)
static int saa5249_release(struct inode *inode, struct file *file)
{
struct video_device *vd = video_devdata(file);
- struct saa5249_device *t=vd->priv;
+ struct saa5249_device *t = vd->priv;
+
i2c_senddata(t, 1, 0x20, -1); /* Turn off CCT */
i2c_senddata(t, 5, 3, 3, -1); /* Turn off TV-display */
- video_exclusive_release(inode,file);
+ clear_bit(0, &t->in_use);
return 0;
}