aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-07-30 07:43:36 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:47 -0400
commitd56dc61265d2527a63ab5b0f03199a43cd89ca36 (patch)
treebea2a5b12fc120ca6e8797b2f16ad9696e0f25dd /drivers/media/video/cx23885
parent95f73c5b57990c97047c200b8746ab62a360c5bc (diff)
V4L/DVB (8613): v4l: move BKL down to the driver level.
The BKL is now moved from the video_open function in v4l2-dev.c to the various drivers. It seems about a third of the drivers already has a lock of some sort protecting the open(), another third uses video_exclusive_open (yuck!) and the last third required adding the BKL in their open function. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx23885')
-rw-r--r--drivers/media/video/cx23885/cx23885-417.c10
-rw-r--r--drivers/media/video/cx23885/cx23885-video.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c
index 7b0e8c01692e..93777d06d0ac 100644
--- a/drivers/media/video/cx23885/cx23885-417.c
+++ b/drivers/media/video/cx23885/cx23885-417.c
@@ -1583,6 +1583,7 @@ static int mpeg_open(struct inode *inode, struct file *file)
1583 1583
1584 dprintk(2, "%s()\n", __func__); 1584 dprintk(2, "%s()\n", __func__);
1585 1585
1586 lock_kernel();
1586 list_for_each(list, &cx23885_devlist) { 1587 list_for_each(list, &cx23885_devlist) {
1587 h = list_entry(list, struct cx23885_dev, devlist); 1588 h = list_entry(list, struct cx23885_dev, devlist);
1588 if (h->v4l_device->minor == minor) { 1589 if (h->v4l_device->minor == minor) {
@@ -1591,13 +1592,17 @@ static int mpeg_open(struct inode *inode, struct file *file)
1591 } 1592 }
1592 } 1593 }
1593 1594
1594 if (dev == NULL) 1595 if (dev == NULL) {
1596 unlock_kernel();
1595 return -ENODEV; 1597 return -ENODEV;
1598 }
1596 1599
1597 /* allocate + initialize per filehandle data */ 1600 /* allocate + initialize per filehandle data */
1598 fh = kzalloc(sizeof(*fh), GFP_KERNEL); 1601 fh = kzalloc(sizeof(*fh), GFP_KERNEL);
1599 if (NULL == fh) 1602 if (NULL == fh) {
1603 unlock_kernel();
1600 return -ENOMEM; 1604 return -ENOMEM;
1605 }
1601 1606
1602 file->private_data = fh; 1607 file->private_data = fh;
1603 fh->dev = dev; 1608 fh->dev = dev;
@@ -1608,6 +1613,7 @@ static int mpeg_open(struct inode *inode, struct file *file)
1608 V4L2_FIELD_INTERLACED, 1613 V4L2_FIELD_INTERLACED,
1609 sizeof(struct cx23885_buffer), 1614 sizeof(struct cx23885_buffer),
1610 fh); 1615 fh);
1616 unlock_kernel();
1611 1617
1612 return 0; 1618 return 0;
1613} 1619}
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c
index 6047c78d84bf..d9bef1a54d1f 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -731,6 +731,7 @@ static int video_open(struct inode *inode, struct file *file)
731 enum v4l2_buf_type type = 0; 731 enum v4l2_buf_type type = 0;
732 int radio = 0; 732 int radio = 0;
733 733
734 lock_kernel();
734 list_for_each(list, &cx23885_devlist) { 735 list_for_each(list, &cx23885_devlist) {
735 h = list_entry(list, struct cx23885_dev, devlist); 736 h = list_entry(list, struct cx23885_dev, devlist);
736 if (h->video_dev->minor == minor) { 737 if (h->video_dev->minor == minor) {
@@ -748,16 +749,20 @@ static int video_open(struct inode *inode, struct file *file)
748 dev = h; 749 dev = h;
749 } 750 }
750 } 751 }
751 if (NULL == dev) 752 if (NULL == dev) {
753 unlock_kernel();
752 return -ENODEV; 754 return -ENODEV;
755 }
753 756
754 dprintk(1, "open minor=%d radio=%d type=%s\n", 757 dprintk(1, "open minor=%d radio=%d type=%s\n",
755 minor, radio, v4l2_type_names[type]); 758 minor, radio, v4l2_type_names[type]);
756 759
757 /* allocate + initialize per filehandle data */ 760 /* allocate + initialize per filehandle data */
758 fh = kzalloc(sizeof(*fh), GFP_KERNEL); 761 fh = kzalloc(sizeof(*fh), GFP_KERNEL);
759 if (NULL == fh) 762 if (NULL == fh) {
763 unlock_kernel();
760 return -ENOMEM; 764 return -ENOMEM;
765 }
761 file->private_data = fh; 766 file->private_data = fh;
762 fh->dev = dev; 767 fh->dev = dev;
763 fh->radio = radio; 768 fh->radio = radio;
@@ -775,6 +780,7 @@ static int video_open(struct inode *inode, struct file *file)
775 780
776 dprintk(1, "post videobuf_queue_init()\n"); 781 dprintk(1, "post videobuf_queue_init()\n");
777 782
783 unlock_kernel();
778 784
779 return 0; 785 return 0;
780} 786}