diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-07-30 07:43:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:47 -0400 |
commit | d56dc61265d2527a63ab5b0f03199a43cd89ca36 (patch) | |
tree | bea2a5b12fc120ca6e8797b2f16ad9696e0f25dd /drivers/media/video/cx88 | |
parent | 95f73c5b57990c97047c200b8746ab62a360c5bc (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/cx88')
-rw-r--r-- | drivers/media/video/cx88/cx88-blackbird.c | 8 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-video.c | 10 |
2 files changed, 15 insertions, 3 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 9a1374a38ec7..1b7e2e44b802 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1057,12 +1057,15 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1057 | struct cx8802_driver *drv = NULL; | 1057 | struct cx8802_driver *drv = NULL; |
1058 | int err; | 1058 | int err; |
1059 | 1059 | ||
1060 | lock_kernel(); | ||
1060 | dev = cx8802_get_device(inode); | 1061 | dev = cx8802_get_device(inode); |
1061 | 1062 | ||
1062 | dprintk( 1, "%s\n", __func__); | 1063 | dprintk( 1, "%s\n", __func__); |
1063 | 1064 | ||
1064 | if (dev == NULL) | 1065 | if (dev == NULL) { |
1066 | unlock_kernel(); | ||
1065 | return -ENODEV; | 1067 | return -ENODEV; |
1068 | } | ||
1066 | 1069 | ||
1067 | /* Make sure we can acquire the hardware */ | 1070 | /* Make sure we can acquire the hardware */ |
1068 | drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD); | 1071 | drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD); |
@@ -1077,6 +1080,7 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1077 | if (blackbird_initialize_codec(dev) < 0) { | 1080 | if (blackbird_initialize_codec(dev) < 0) { |
1078 | if (drv) | 1081 | if (drv) |
1079 | drv->request_release(drv); | 1082 | drv->request_release(drv); |
1083 | unlock_kernel(); | ||
1080 | return -EINVAL; | 1084 | return -EINVAL; |
1081 | } | 1085 | } |
1082 | dprintk(1,"open minor=%d\n",minor); | 1086 | dprintk(1,"open minor=%d\n",minor); |
@@ -1086,6 +1090,7 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1086 | if (NULL == fh) { | 1090 | if (NULL == fh) { |
1087 | if (drv) | 1091 | if (drv) |
1088 | drv->request_release(drv); | 1092 | drv->request_release(drv); |
1093 | unlock_kernel(); | ||
1089 | return -ENOMEM; | 1094 | return -ENOMEM; |
1090 | } | 1095 | } |
1091 | file->private_data = fh; | 1096 | file->private_data = fh; |
@@ -1101,6 +1106,7 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1101 | /* FIXME: locking against other video device */ | 1106 | /* FIXME: locking against other video device */ |
1102 | cx88_set_scale(dev->core, dev->width, dev->height, | 1107 | cx88_set_scale(dev->core, dev->width, dev->height, |
1103 | fh->mpegq.field); | 1108 | fh->mpegq.field); |
1109 | unlock_kernel(); | ||
1104 | 1110 | ||
1105 | return 0; | 1111 | return 0; |
1106 | } | 1112 | } |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index ef4d56ea0027..61e03d4703f6 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -773,6 +773,7 @@ static int video_open(struct inode *inode, struct file *file) | |||
773 | enum v4l2_buf_type type = 0; | 773 | enum v4l2_buf_type type = 0; |
774 | int radio = 0; | 774 | int radio = 0; |
775 | 775 | ||
776 | lock_kernel(); | ||
776 | list_for_each_entry(h, &cx8800_devlist, devlist) { | 777 | list_for_each_entry(h, &cx8800_devlist, devlist) { |
777 | if (h->video_dev->minor == minor) { | 778 | if (h->video_dev->minor == minor) { |
778 | dev = h; | 779 | dev = h; |
@@ -788,8 +789,10 @@ static int video_open(struct inode *inode, struct file *file) | |||
788 | dev = h; | 789 | dev = h; |
789 | } | 790 | } |
790 | } | 791 | } |
791 | if (NULL == dev) | 792 | if (NULL == dev) { |
793 | unlock_kernel(); | ||
792 | return -ENODEV; | 794 | return -ENODEV; |
795 | } | ||
793 | 796 | ||
794 | core = dev->core; | 797 | core = dev->core; |
795 | 798 | ||
@@ -798,8 +801,10 @@ static int video_open(struct inode *inode, struct file *file) | |||
798 | 801 | ||
799 | /* allocate + initialize per filehandle data */ | 802 | /* allocate + initialize per filehandle data */ |
800 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); | 803 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); |
801 | if (NULL == fh) | 804 | if (NULL == fh) { |
805 | unlock_kernel(); | ||
802 | return -ENOMEM; | 806 | return -ENOMEM; |
807 | } | ||
803 | file->private_data = fh; | 808 | file->private_data = fh; |
804 | fh->dev = dev; | 809 | fh->dev = dev; |
805 | fh->radio = radio; | 810 | fh->radio = radio; |
@@ -832,6 +837,7 @@ static int video_open(struct inode *inode, struct file *file) | |||
832 | cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); | 837 | cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); |
833 | cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL); | 838 | cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL); |
834 | } | 839 | } |
840 | unlock_kernel(); | ||
835 | 841 | ||
836 | return 0; | 842 | return 0; |
837 | } | 843 | } |