aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa5246a.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-08-23 04:31:47 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:53 -0400
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 e2c538ee88f2..5f5aa2063e0e 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -61,6 +61,7 @@ struct saa5246a_device
61 u8 pgbuf[NUM_DAUS][VTX_VIRTUALSIZE]; 61 u8 pgbuf[NUM_DAUS][VTX_VIRTUALSIZE];
62 int is_searching[NUM_DAUS]; 62 int is_searching[NUM_DAUS];
63 struct i2c_client *client; 63 struct i2c_client *client;
64 unsigned long in_use;
64 struct mutex lock; 65 struct mutex lock;
65}; 66};
66 67
@@ -736,22 +737,14 @@ static int saa5246a_open(struct inode *inode, struct file *file)
736{ 737{
737 struct video_device *vd = video_devdata(file); 738 struct video_device *vd = video_devdata(file);
738 struct saa5246a_device *t = vd->priv; 739 struct saa5246a_device *t = vd->priv;
739 int err;
740 740
741 lock_kernel(); 741 if (t->client == NULL)
742 err = video_exclusive_open(inode,file); 742 return -ENODEV;
743 if (err < 0) {
744 unlock_kernel();
745 return err;
746 }
747 743
748 if (t->client==NULL) { 744 if (test_and_set_bit(0, &t->in_use))
749 err = -ENODEV; 745 return -EBUSY;
750 goto fail;
751 }
752 746
753 if (i2c_senddata(t, SAA5246A_REGISTER_R0, 747 if (i2c_senddata(t, SAA5246A_REGISTER_R0,
754
755 R0_SELECT_R11 | 748 R0_SELECT_R11 |
756 R0_PLL_TIME_CONSTANT_LONG | 749 R0_PLL_TIME_CONSTANT_LONG |
757 R0_ENABLE_nODD_EVEN_OUTPUT | 750 R0_ENABLE_nODD_EVEN_OUTPUT |
@@ -777,17 +770,10 @@ static int saa5246a_open(struct inode *inode, struct file *file)
777 770
778 COMMAND_END)) 771 COMMAND_END))
779 { 772 {
780 err = -EIO; 773 clear_bit(0, &t->in_use);
781 goto fail; 774 return -EIO;
782 } 775 }
783 unlock_kernel();
784
785 return 0; 776 return 0;
786
787fail:
788 video_exclusive_release(inode,file);
789 unlock_kernel();
790 return err;
791} 777}
792 778
793static int saa5246a_release(struct inode *inode, struct file *file) 779static int saa5246a_release(struct inode *inode, struct file *file)
@@ -806,7 +792,7 @@ static int saa5246a_release(struct inode *inode, struct file *file)
806 R1_VCS_TO_SCS, 792 R1_VCS_TO_SCS,
807 793
808 COMMAND_END); 794 COMMAND_END);
809 video_exclusive_release(inode,file); 795 clear_bit(0, &t->in_use);
810 return 0; 796 return 0;
811} 797}
812 798