diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-08-23 04:31:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:53 -0400 |
commit | 7d43cd53c851e3cf04d73108d4e7e25a1104c6f5 (patch) | |
tree | 4fcf2e3148065f1727b630deefef9612610bf789 /drivers/media/video/saa5249.c | |
parent | 2f3d00250ae5b1d2727e2723da805290ec408503 (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/saa5249.c')
-rw-r--r-- | drivers/media/video/saa5249.c | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 96c0fdf1a05..dfd8a9338c5 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c | |||
@@ -110,6 +110,7 @@ struct saa5249_device | |||
110 | int disp_mode; | 110 | int disp_mode; |
111 | int virtual_mode; | 111 | int virtual_mode; |
112 | struct i2c_client *client; | 112 | struct i2c_client *client; |
113 | unsigned long in_use; | ||
113 | struct mutex lock; | 114 | struct mutex lock; |
114 | }; | 115 | }; |
115 | 116 | ||
@@ -631,34 +632,27 @@ static int saa5249_ioctl(struct inode *inode, struct file *file, | |||
631 | static int saa5249_open(struct inode *inode, struct file *file) | 632 | static int saa5249_open(struct inode *inode, struct file *file) |
632 | { | 633 | { |
633 | struct video_device *vd = video_devdata(file); | 634 | struct video_device *vd = video_devdata(file); |
634 | struct saa5249_device *t=vd->priv; | 635 | struct saa5249_device *t = vd->priv; |
635 | int err,pgbuf; | 636 | int pgbuf; |
636 | 637 | ||
637 | lock_kernel(); | 638 | if (t->client == NULL) |
638 | err = video_exclusive_open(inode,file); | 639 | return -ENODEV; |
639 | if (err < 0) { | ||
640 | unlock_kernel(); | ||
641 | return err; | ||
642 | } | ||
643 | 640 | ||
644 | if (t->client==NULL) { | 641 | if (test_and_set_bit(0, &t->in_use)) |
645 | err = -ENODEV; | 642 | return -EBUSY; |
646 | goto fail; | ||
647 | } | ||
648 | 643 | ||
649 | if (i2c_senddata(t, 0, 0, -1) || /* Select R11 */ | 644 | if (i2c_senddata(t, 0, 0, -1) || /* Select R11 */ |
650 | /* Turn off parity checks (we do this ourselves) */ | 645 | /* Turn off parity checks (we do this ourselves) */ |
651 | i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) || | 646 | i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) || |
652 | /* Display TV-picture, no virtual rows */ | 647 | /* Display TV-picture, no virtual rows */ |
653 | 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 */ | 648 | i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1)) |
654 | 649 | /* Set display to page 4 */ | |
655 | { | 650 | { |
656 | err = -EIO; | 651 | clear_bit(0, &t->in_use); |
657 | goto fail; | 652 | return -EIO; |
658 | } | 653 | } |
659 | 654 | ||
660 | for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) | 655 | for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) { |
661 | { | ||
662 | memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); | 656 | memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); |
663 | memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); | 657 | memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); |
664 | memset(t->vdau[pgbuf].laststat, 0, sizeof(t->vdau[0].laststat)); | 658 | 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) | |||
668 | t->is_searching[pgbuf] = false; | 662 | t->is_searching[pgbuf] = false; |
669 | } | 663 | } |
670 | t->virtual_mode = false; | 664 | t->virtual_mode = false; |
671 | unlock_kernel(); | ||
672 | return 0; | 665 | return 0; |
673 | |||
674 | fail: | ||
675 | video_exclusive_release(inode,file); | ||
676 | unlock_kernel(); | ||
677 | return err; | ||
678 | } | 666 | } |
679 | 667 | ||
680 | 668 | ||
@@ -682,10 +670,11 @@ static int saa5249_open(struct inode *inode, struct file *file) | |||
682 | static int saa5249_release(struct inode *inode, struct file *file) | 670 | static int saa5249_release(struct inode *inode, struct file *file) |
683 | { | 671 | { |
684 | struct video_device *vd = video_devdata(file); | 672 | struct video_device *vd = video_devdata(file); |
685 | struct saa5249_device *t=vd->priv; | 673 | struct saa5249_device *t = vd->priv; |
674 | |||
686 | i2c_senddata(t, 1, 0x20, -1); /* Turn off CCT */ | 675 | i2c_senddata(t, 1, 0x20, -1); /* Turn off CCT */ |
687 | i2c_senddata(t, 5, 3, 3, -1); /* Turn off TV-display */ | 676 | i2c_senddata(t, 5, 3, 3, -1); /* Turn off TV-display */ |
688 | video_exclusive_release(inode,file); | 677 | clear_bit(0, &t->in_use); |
689 | return 0; | 678 | return 0; |
690 | } | 679 | } |
691 | 680 | ||