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/saa7134 | |
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/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-empress.c | 3 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index c0c5d7509c25..6f423d116fb4 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -79,9 +79,11 @@ static int ts_open(struct inode *inode, struct file *file) | |||
79 | struct saa7134_dev *dev; | 79 | struct saa7134_dev *dev; |
80 | int err; | 80 | int err; |
81 | 81 | ||
82 | lock_kernel(); | ||
82 | list_for_each_entry(dev, &saa7134_devlist, devlist) | 83 | list_for_each_entry(dev, &saa7134_devlist, devlist) |
83 | if (dev->empress_dev && dev->empress_dev->minor == minor) | 84 | if (dev->empress_dev && dev->empress_dev->minor == minor) |
84 | goto found; | 85 | goto found; |
86 | unlock_kernel(); | ||
85 | return -ENODEV; | 87 | return -ENODEV; |
86 | found: | 88 | found: |
87 | 89 | ||
@@ -103,6 +105,7 @@ static int ts_open(struct inode *inode, struct file *file) | |||
103 | done_up: | 105 | done_up: |
104 | mutex_unlock(&dev->empress_tsq.vb_lock); | 106 | mutex_unlock(&dev->empress_tsq.vb_lock); |
105 | done: | 107 | done: |
108 | unlock_kernel(); | ||
106 | return err; | 109 | return err; |
107 | } | 110 | } |
108 | 111 | ||
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 68c268981861..8fd31138f9ad 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1330,6 +1330,8 @@ static int video_open(struct inode *inode, struct file *file) | |||
1330 | struct saa7134_fh *fh; | 1330 | struct saa7134_fh *fh; |
1331 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1331 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1332 | int radio = 0; | 1332 | int radio = 0; |
1333 | |||
1334 | lock_kernel(); | ||
1333 | list_for_each_entry(dev, &saa7134_devlist, devlist) { | 1335 | list_for_each_entry(dev, &saa7134_devlist, devlist) { |
1334 | if (dev->video_dev && (dev->video_dev->minor == minor)) | 1336 | if (dev->video_dev && (dev->video_dev->minor == minor)) |
1335 | goto found; | 1337 | goto found; |
@@ -1342,6 +1344,7 @@ static int video_open(struct inode *inode, struct file *file) | |||
1342 | goto found; | 1344 | goto found; |
1343 | } | 1345 | } |
1344 | } | 1346 | } |
1347 | unlock_kernel(); | ||
1345 | return -ENODEV; | 1348 | return -ENODEV; |
1346 | found: | 1349 | found: |
1347 | 1350 | ||
@@ -1350,8 +1353,10 @@ static int video_open(struct inode *inode, struct file *file) | |||
1350 | 1353 | ||
1351 | /* allocate + initialize per filehandle data */ | 1354 | /* allocate + initialize per filehandle data */ |
1352 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); | 1355 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); |
1353 | if (NULL == fh) | 1356 | if (NULL == fh) { |
1357 | unlock_kernel(); | ||
1354 | return -ENOMEM; | 1358 | return -ENOMEM; |
1359 | } | ||
1355 | file->private_data = fh; | 1360 | file->private_data = fh; |
1356 | fh->dev = dev; | 1361 | fh->dev = dev; |
1357 | fh->radio = radio; | 1362 | fh->radio = radio; |
@@ -1384,6 +1389,7 @@ static int video_open(struct inode *inode, struct file *file) | |||
1384 | /* switch to video/vbi mode */ | 1389 | /* switch to video/vbi mode */ |
1385 | video_mux(dev,dev->ctl_input); | 1390 | video_mux(dev,dev->ctl_input); |
1386 | } | 1391 | } |
1392 | unlock_kernel(); | ||
1387 | return 0; | 1393 | return 0; |
1388 | } | 1394 | } |
1389 | 1395 | ||