diff options
Diffstat (limited to 'drivers')
26 files changed, 146 insertions, 25 deletions
diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index 70c65a74592..3a4eb444a7c 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c | |||
@@ -407,15 +407,18 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file) | |||
407 | { | 407 | { |
408 | struct dsbr100_device *radio=video_get_drvdata(video_devdata(file)); | 408 | struct dsbr100_device *radio=video_get_drvdata(video_devdata(file)); |
409 | 409 | ||
410 | lock_kernel(); | ||
410 | radio->users = 1; | 411 | radio->users = 1; |
411 | radio->muted = 1; | 412 | radio->muted = 1; |
412 | 413 | ||
413 | if (dsbr100_start(radio)<0) { | 414 | if (dsbr100_start(radio)<0) { |
414 | warn("Radio did not start up properly"); | 415 | warn("Radio did not start up properly"); |
415 | radio->users = 0; | 416 | radio->users = 0; |
417 | unlock_kernel(); | ||
416 | return -EIO; | 418 | return -EIO; |
417 | } | 419 | } |
418 | dsbr100_setfreq(radio, radio->curfreq); | 420 | dsbr100_setfreq(radio, radio->curfreq); |
421 | unlock_kernel(); | ||
419 | return 0; | 422 | return 0; |
420 | } | 423 | } |
421 | 424 | ||
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 16c7ef20265..337d5579383 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -1074,6 +1074,7 @@ static int si470x_fops_open(struct inode *inode, struct file *file) | |||
1074 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); | 1074 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); |
1075 | int retval; | 1075 | int retval; |
1076 | 1076 | ||
1077 | lock_kernel(); | ||
1077 | radio->users++; | 1078 | radio->users++; |
1078 | 1079 | ||
1079 | retval = usb_autopm_get_interface(radio->intf); | 1080 | retval = usb_autopm_get_interface(radio->intf); |
@@ -1090,6 +1091,7 @@ static int si470x_fops_open(struct inode *inode, struct file *file) | |||
1090 | } | 1091 | } |
1091 | 1092 | ||
1092 | done: | 1093 | done: |
1094 | unlock_kernel(); | ||
1093 | return retval; | 1095 | return retval; |
1094 | } | 1096 | } |
1095 | 1097 | ||
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 933eaef41ea..c3526d0258f 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -3227,6 +3227,7 @@ static int bttv_open(struct inode *inode, struct file *file) | |||
3227 | 3227 | ||
3228 | dprintk(KERN_DEBUG "bttv: open minor=%d\n",minor); | 3228 | dprintk(KERN_DEBUG "bttv: open minor=%d\n",minor); |
3229 | 3229 | ||
3230 | lock_kernel(); | ||
3230 | for (i = 0; i < bttv_num; i++) { | 3231 | for (i = 0; i < bttv_num; i++) { |
3231 | if (bttvs[i].video_dev && | 3232 | if (bttvs[i].video_dev && |
3232 | bttvs[i].video_dev->minor == minor) { | 3233 | bttvs[i].video_dev->minor == minor) { |
@@ -3241,16 +3242,20 @@ static int bttv_open(struct inode *inode, struct file *file) | |||
3241 | break; | 3242 | break; |
3242 | } | 3243 | } |
3243 | } | 3244 | } |
3244 | if (NULL == btv) | 3245 | if (NULL == btv) { |
3246 | unlock_kernel(); | ||
3245 | return -ENODEV; | 3247 | return -ENODEV; |
3248 | } | ||
3246 | 3249 | ||
3247 | dprintk(KERN_DEBUG "bttv%d: open called (type=%s)\n", | 3250 | dprintk(KERN_DEBUG "bttv%d: open called (type=%s)\n", |
3248 | btv->c.nr,v4l2_type_names[type]); | 3251 | btv->c.nr,v4l2_type_names[type]); |
3249 | 3252 | ||
3250 | /* allocate per filehandle data */ | 3253 | /* allocate per filehandle data */ |
3251 | fh = kmalloc(sizeof(*fh),GFP_KERNEL); | 3254 | fh = kmalloc(sizeof(*fh),GFP_KERNEL); |
3252 | if (NULL == fh) | 3255 | if (NULL == fh) { |
3256 | unlock_kernel(); | ||
3253 | return -ENOMEM; | 3257 | return -ENOMEM; |
3258 | } | ||
3254 | file->private_data = fh; | 3259 | file->private_data = fh; |
3255 | *fh = btv->init; | 3260 | *fh = btv->init; |
3256 | fh->type = type; | 3261 | fh->type = type; |
@@ -3290,6 +3295,7 @@ static int bttv_open(struct inode *inode, struct file *file) | |||
3290 | bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); | 3295 | bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); |
3291 | 3296 | ||
3292 | bttv_field_count(btv); | 3297 | bttv_field_count(btv); |
3298 | unlock_kernel(); | ||
3293 | return 0; | 3299 | return 0; |
3294 | } | 3300 | } |
3295 | 3301 | ||
@@ -3430,21 +3436,26 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3430 | 3436 | ||
3431 | dprintk("bttv: open minor=%d\n",minor); | 3437 | dprintk("bttv: open minor=%d\n",minor); |
3432 | 3438 | ||
3439 | lock_kernel(); | ||
3433 | for (i = 0; i < bttv_num; i++) { | 3440 | for (i = 0; i < bttv_num; i++) { |
3434 | if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) { | 3441 | if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) { |
3435 | btv = &bttvs[i]; | 3442 | btv = &bttvs[i]; |
3436 | break; | 3443 | break; |
3437 | } | 3444 | } |
3438 | } | 3445 | } |
3439 | if (NULL == btv) | 3446 | if (NULL == btv) { |
3447 | unlock_kernel(); | ||
3440 | return -ENODEV; | 3448 | return -ENODEV; |
3449 | } | ||
3441 | 3450 | ||
3442 | dprintk("bttv%d: open called (radio)\n",btv->c.nr); | 3451 | dprintk("bttv%d: open called (radio)\n",btv->c.nr); |
3443 | 3452 | ||
3444 | /* allocate per filehandle data */ | 3453 | /* allocate per filehandle data */ |
3445 | fh = kmalloc(sizeof(*fh), GFP_KERNEL); | 3454 | fh = kmalloc(sizeof(*fh), GFP_KERNEL); |
3446 | if (NULL == fh) | 3455 | if (NULL == fh) { |
3456 | unlock_kernel(); | ||
3447 | return -ENOMEM; | 3457 | return -ENOMEM; |
3458 | } | ||
3448 | file->private_data = fh; | 3459 | file->private_data = fh; |
3449 | *fh = btv->init; | 3460 | *fh = btv->init; |
3450 | v4l2_prio_open(&btv->prio, &fh->prio); | 3461 | v4l2_prio_open(&btv->prio, &fh->prio); |
@@ -3457,6 +3468,7 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3457 | audio_input(btv,TVAUDIO_INPUT_RADIO); | 3468 | audio_input(btv,TVAUDIO_INPUT_RADIO); |
3458 | 3469 | ||
3459 | mutex_unlock(&btv->lock); | 3470 | mutex_unlock(&btv->lock); |
3471 | unlock_kernel(); | ||
3460 | return 0; | 3472 | return 0; |
3461 | } | 3473 | } |
3462 | 3474 | ||
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 5405c30dbb0..e9994c81df6 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -1476,9 +1476,12 @@ static int cafe_v4l_open(struct inode *inode, struct file *filp) | |||
1476 | { | 1476 | { |
1477 | struct cafe_camera *cam; | 1477 | struct cafe_camera *cam; |
1478 | 1478 | ||
1479 | lock_kernel(); | ||
1479 | cam = cafe_find_dev(iminor(inode)); | 1480 | cam = cafe_find_dev(iminor(inode)); |
1480 | if (cam == NULL) | 1481 | if (cam == NULL) { |
1482 | unlock_kernel(); | ||
1481 | return -ENODEV; | 1483 | return -ENODEV; |
1484 | } | ||
1482 | filp->private_data = cam; | 1485 | filp->private_data = cam; |
1483 | 1486 | ||
1484 | mutex_lock(&cam->s_mutex); | 1487 | mutex_lock(&cam->s_mutex); |
@@ -1490,6 +1493,7 @@ static int cafe_v4l_open(struct inode *inode, struct file *filp) | |||
1490 | } | 1493 | } |
1491 | (cam->users)++; | 1494 | (cam->users)++; |
1492 | mutex_unlock(&cam->s_mutex); | 1495 | mutex_unlock(&cam->s_mutex); |
1496 | unlock_kernel(); | ||
1493 | return 0; | 1497 | return 0; |
1494 | } | 1498 | } |
1495 | 1499 | ||
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index 7b0e8c01692..93777d06d0a 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 6047c78d84b..d9bef1a54d1 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 | } |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 9a1374a38ec..1b7e2e44b80 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 ef4d56ea002..61e03d4703f 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 | } |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 49ab0629702..600b340e355 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -1512,6 +1512,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) | |||
1512 | struct em28xx_fh *fh; | 1512 | struct em28xx_fh *fh; |
1513 | enum v4l2_buf_type fh_type = 0; | 1513 | enum v4l2_buf_type fh_type = 0; |
1514 | 1514 | ||
1515 | lock_kernel(); | ||
1515 | list_for_each_entry(h, &em28xx_devlist, devlist) { | 1516 | list_for_each_entry(h, &em28xx_devlist, devlist) { |
1516 | if (h->vdev->minor == minor) { | 1517 | if (h->vdev->minor == minor) { |
1517 | dev = h; | 1518 | dev = h; |
@@ -1527,8 +1528,10 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) | |||
1527 | dev = h; | 1528 | dev = h; |
1528 | } | 1529 | } |
1529 | } | 1530 | } |
1530 | if (NULL == dev) | 1531 | if (NULL == dev) { |
1532 | unlock_kernel(); | ||
1531 | return -ENODEV; | 1533 | return -ENODEV; |
1534 | } | ||
1532 | 1535 | ||
1533 | em28xx_videodbg("open minor=%d type=%s users=%d\n", | 1536 | em28xx_videodbg("open minor=%d type=%s users=%d\n", |
1534 | minor, v4l2_type_names[fh_type], dev->users); | 1537 | minor, v4l2_type_names[fh_type], dev->users); |
@@ -1537,6 +1540,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) | |||
1537 | fh = kzalloc(sizeof(struct em28xx_fh), GFP_KERNEL); | 1540 | fh = kzalloc(sizeof(struct em28xx_fh), GFP_KERNEL); |
1538 | if (!fh) { | 1541 | if (!fh) { |
1539 | em28xx_errdev("em28xx-video.c: Out of memory?!\n"); | 1542 | em28xx_errdev("em28xx-video.c: Out of memory?!\n"); |
1543 | unlock_kernel(); | ||
1540 | return -ENOMEM; | 1544 | return -ENOMEM; |
1541 | } | 1545 | } |
1542 | mutex_lock(&dev->lock); | 1546 | mutex_lock(&dev->lock); |
@@ -1573,6 +1577,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) | |||
1573 | sizeof(struct em28xx_buffer), fh); | 1577 | sizeof(struct em28xx_buffer), fh); |
1574 | 1578 | ||
1575 | mutex_unlock(&dev->lock); | 1579 | mutex_unlock(&dev->lock); |
1580 | unlock_kernel(); | ||
1576 | 1581 | ||
1577 | return errCode; | 1582 | return errCode; |
1578 | } | 1583 | } |
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index a9ef7802eb5..cdaff2fdf39 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c | |||
@@ -845,15 +845,19 @@ static int meye_open(struct inode *inode, struct file *file) | |||
845 | { | 845 | { |
846 | int i, err; | 846 | int i, err; |
847 | 847 | ||
848 | lock_kernel(); | ||
848 | err = video_exclusive_open(inode, file); | 849 | err = video_exclusive_open(inode, file); |
849 | if (err < 0) | 850 | if (err < 0) { |
851 | unlock_kernel(); | ||
850 | return err; | 852 | return err; |
853 | } | ||
851 | 854 | ||
852 | mchip_hic_stop(); | 855 | mchip_hic_stop(); |
853 | 856 | ||
854 | if (mchip_dma_alloc()) { | 857 | if (mchip_dma_alloc()) { |
855 | printk(KERN_ERR "meye: mchip framebuffer allocation failed\n"); | 858 | printk(KERN_ERR "meye: mchip framebuffer allocation failed\n"); |
856 | video_exclusive_release(inode, file); | 859 | video_exclusive_release(inode, file); |
860 | unlock_kernel(); | ||
857 | return -ENOBUFS; | 861 | return -ENOBUFS; |
858 | } | 862 | } |
859 | 863 | ||
@@ -861,6 +865,7 @@ static int meye_open(struct inode *inode, struct file *file) | |||
861 | meye.grab_buffer[i].state = MEYE_BUF_UNUSED; | 865 | meye.grab_buffer[i].state = MEYE_BUF_UNUSED; |
862 | kfifo_reset(meye.grabq); | 866 | kfifo_reset(meye.grabq); |
863 | kfifo_reset(meye.doneq); | 867 | kfifo_reset(meye.doneq); |
868 | unlock_kernel(); | ||
864 | return 0; | 869 | return 0; |
865 | } | 870 | } |
866 | 871 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 00306faeac0..26ffaa276c5 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | |||
@@ -932,6 +932,7 @@ static int pvr2_v4l2_open(struct inode *inode, struct file *file) | |||
932 | unsigned int input_cnt,idx; | 932 | unsigned int input_cnt,idx; |
933 | int ret = 0; | 933 | int ret = 0; |
934 | 934 | ||
935 | lock_kernel(); | ||
935 | dip = container_of(video_devdata(file),struct pvr2_v4l2_dev,devbase); | 936 | dip = container_of(video_devdata(file),struct pvr2_v4l2_dev,devbase); |
936 | 937 | ||
937 | vp = dip->v4lp; | 938 | vp = dip->v4lp; |
@@ -942,11 +943,13 @@ static int pvr2_v4l2_open(struct inode *inode, struct file *file) | |||
942 | if (!pvr2_hdw_dev_ok(hdw)) { | 943 | if (!pvr2_hdw_dev_ok(hdw)) { |
943 | pvr2_trace(PVR2_TRACE_OPEN_CLOSE, | 944 | pvr2_trace(PVR2_TRACE_OPEN_CLOSE, |
944 | "pvr2_v4l2_open: hardware not ready"); | 945 | "pvr2_v4l2_open: hardware not ready"); |
946 | unlock_kernel(); | ||
945 | return -EIO; | 947 | return -EIO; |
946 | } | 948 | } |
947 | 949 | ||
948 | fhp = kzalloc(sizeof(*fhp),GFP_KERNEL); | 950 | fhp = kzalloc(sizeof(*fhp),GFP_KERNEL); |
949 | if (!fhp) { | 951 | if (!fhp) { |
952 | unlock_kernel(); | ||
950 | return -ENOMEM; | 953 | return -ENOMEM; |
951 | } | 954 | } |
952 | 955 | ||
@@ -976,6 +979,7 @@ static int pvr2_v4l2_open(struct inode *inode, struct file *file) | |||
976 | fhp); | 979 | fhp); |
977 | 980 | ||
978 | kfree(fhp); | 981 | kfree(fhp); |
982 | unlock_kernel(); | ||
979 | return ret; | 983 | return ret; |
980 | } | 984 | } |
981 | 985 | ||
@@ -992,6 +996,7 @@ static int pvr2_v4l2_open(struct inode *inode, struct file *file) | |||
992 | "Destroying pvr_v4l2_fh id=%p (input map failure)", | 996 | "Destroying pvr_v4l2_fh id=%p (input map failure)", |
993 | fhp); | 997 | fhp); |
994 | kfree(fhp); | 998 | kfree(fhp); |
999 | unlock_kernel(); | ||
995 | return -ENOMEM; | 1000 | return -ENOMEM; |
996 | } | 1001 | } |
997 | input_cnt = 0; | 1002 | input_cnt = 0; |
@@ -1015,6 +1020,7 @@ static int pvr2_v4l2_open(struct inode *inode, struct file *file) | |||
1015 | v4l2_prio_open(&vp->prio,&fhp->prio); | 1020 | v4l2_prio_open(&vp->prio,&fhp->prio); |
1016 | 1021 | ||
1017 | fhp->fw_mode_flag = pvr2_hdw_cpufw_get_enabled(hdw); | 1022 | fhp->fw_mode_flag = pvr2_hdw_cpufw_get_enabled(hdw); |
1023 | unlock_kernel(); | ||
1018 | 1024 | ||
1019 | return 0; | 1025 | return 0; |
1020 | } | 1026 | } |
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 92b83feae36..de39cf0890f 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -1457,6 +1457,7 @@ static int s2255_open(struct inode *inode, struct file *file) | |||
1457 | int cur_channel = -1; | 1457 | int cur_channel = -1; |
1458 | dprintk(1, "s2255: open called (minor=%d)\n", minor); | 1458 | dprintk(1, "s2255: open called (minor=%d)\n", minor); |
1459 | 1459 | ||
1460 | lock_kernel(); | ||
1460 | list_for_each(list, &s2255_devlist) { | 1461 | list_for_each(list, &s2255_devlist) { |
1461 | h = list_entry(list, struct s2255_dev, s2255_devlist); | 1462 | h = list_entry(list, struct s2255_dev, s2255_devlist); |
1462 | for (i = 0; i < MAX_CHANNELS; i++) { | 1463 | for (i = 0; i < MAX_CHANNELS; i++) { |
@@ -1469,6 +1470,7 @@ static int s2255_open(struct inode *inode, struct file *file) | |||
1469 | } | 1470 | } |
1470 | 1471 | ||
1471 | if ((NULL == dev) || (cur_channel == -1)) { | 1472 | if ((NULL == dev) || (cur_channel == -1)) { |
1473 | unlock_kernel(); | ||
1472 | dprintk(1, "s2255: openv4l no dev\n"); | 1474 | dprintk(1, "s2255: openv4l no dev\n"); |
1473 | return -ENODEV; | 1475 | return -ENODEV; |
1474 | } | 1476 | } |
@@ -1490,6 +1492,7 @@ static int s2255_open(struct inode *inode, struct file *file) | |||
1490 | printk(KERN_INFO "2255 FW load failed.\n"); | 1492 | printk(KERN_INFO "2255 FW load failed.\n"); |
1491 | dev->users[cur_channel]--; | 1493 | dev->users[cur_channel]--; |
1492 | mutex_unlock(&dev->open_lock); | 1494 | mutex_unlock(&dev->open_lock); |
1495 | unlock_kernel(); | ||
1493 | return -EFAULT; | 1496 | return -EFAULT; |
1494 | } | 1497 | } |
1495 | } else if (atomic_read(&dev->fw_data->fw_state) == S2255_FW_NOTLOADED) { | 1498 | } else if (atomic_read(&dev->fw_data->fw_state) == S2255_FW_NOTLOADED) { |
@@ -1506,6 +1509,7 @@ static int s2255_open(struct inode *inode, struct file *file) | |||
1506 | "try again\n"); | 1509 | "try again\n"); |
1507 | dev->users[cur_channel]--; | 1510 | dev->users[cur_channel]--; |
1508 | mutex_unlock(&dev->open_lock); | 1511 | mutex_unlock(&dev->open_lock); |
1512 | unlock_kernel(); | ||
1509 | return -EBUSY; | 1513 | return -EBUSY; |
1510 | } | 1514 | } |
1511 | } | 1515 | } |
@@ -1515,6 +1519,7 @@ static int s2255_open(struct inode *inode, struct file *file) | |||
1515 | if (NULL == fh) { | 1519 | if (NULL == fh) { |
1516 | dev->users[cur_channel]--; | 1520 | dev->users[cur_channel]--; |
1517 | mutex_unlock(&dev->open_lock); | 1521 | mutex_unlock(&dev->open_lock); |
1522 | unlock_kernel(); | ||
1518 | return -ENOMEM; | 1523 | return -ENOMEM; |
1519 | } | 1524 | } |
1520 | 1525 | ||
@@ -1548,6 +1553,7 @@ static int s2255_open(struct inode *inode, struct file *file) | |||
1548 | 1553 | ||
1549 | kref_get(&dev->kref); | 1554 | kref_get(&dev->kref); |
1550 | mutex_unlock(&dev->open_lock); | 1555 | mutex_unlock(&dev->open_lock); |
1556 | unlock_kernel(); | ||
1551 | return 0; | 1557 | return 0; |
1552 | } | 1558 | } |
1553 | 1559 | ||
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index 6ee63e69b36..e2c538ee88f 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/init.h> | 44 | #include <linux/init.h> |
45 | #include <linux/i2c.h> | 45 | #include <linux/i2c.h> |
46 | #include <linux/videotext.h> | 46 | #include <linux/videotext.h> |
47 | #include <linux/smp_lock.h> | ||
47 | #include <linux/videodev.h> | 48 | #include <linux/videodev.h> |
48 | #include <media/v4l2-common.h> | 49 | #include <media/v4l2-common.h> |
49 | #include <media/v4l2-ioctl.h> | 50 | #include <media/v4l2-ioctl.h> |
@@ -737,9 +738,12 @@ static int saa5246a_open(struct inode *inode, struct file *file) | |||
737 | struct saa5246a_device *t = vd->priv; | 738 | struct saa5246a_device *t = vd->priv; |
738 | int err; | 739 | int err; |
739 | 740 | ||
741 | lock_kernel(); | ||
740 | err = video_exclusive_open(inode,file); | 742 | err = video_exclusive_open(inode,file); |
741 | if (err < 0) | 743 | if (err < 0) { |
744 | unlock_kernel(); | ||
742 | return err; | 745 | return err; |
746 | } | ||
743 | 747 | ||
744 | if (t->client==NULL) { | 748 | if (t->client==NULL) { |
745 | err = -ENODEV; | 749 | err = -ENODEV; |
@@ -776,11 +780,13 @@ static int saa5246a_open(struct inode *inode, struct file *file) | |||
776 | err = -EIO; | 780 | err = -EIO; |
777 | goto fail; | 781 | goto fail; |
778 | } | 782 | } |
783 | unlock_kernel(); | ||
779 | 784 | ||
780 | return 0; | 785 | return 0; |
781 | 786 | ||
782 | fail: | 787 | fail: |
783 | video_exclusive_release(inode,file); | 788 | video_exclusive_release(inode,file); |
789 | unlock_kernel(); | ||
784 | return err; | 790 | return err; |
785 | } | 791 | } |
786 | 792 | ||
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 0d639738d4e..96c0fdf1a05 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/ioport.h> | 52 | #include <linux/ioport.h> |
53 | #include <linux/slab.h> | 53 | #include <linux/slab.h> |
54 | #include <linux/init.h> | 54 | #include <linux/init.h> |
55 | #include <linux/smp_lock.h> | ||
55 | #include <stdarg.h> | 56 | #include <stdarg.h> |
56 | #include <linux/i2c.h> | 57 | #include <linux/i2c.h> |
57 | #include <linux/videotext.h> | 58 | #include <linux/videotext.h> |
@@ -633,9 +634,12 @@ static int saa5249_open(struct inode *inode, struct file *file) | |||
633 | struct saa5249_device *t=vd->priv; | 634 | struct saa5249_device *t=vd->priv; |
634 | int err,pgbuf; | 635 | int err,pgbuf; |
635 | 636 | ||
637 | lock_kernel(); | ||
636 | err = video_exclusive_open(inode,file); | 638 | err = video_exclusive_open(inode,file); |
637 | if (err < 0) | 639 | if (err < 0) { |
640 | unlock_kernel(); | ||
638 | return err; | 641 | return err; |
642 | } | ||
639 | 643 | ||
640 | if (t->client==NULL) { | 644 | if (t->client==NULL) { |
641 | err = -ENODEV; | 645 | err = -ENODEV; |
@@ -664,10 +668,12 @@ static int saa5249_open(struct inode *inode, struct file *file) | |||
664 | t->is_searching[pgbuf] = false; | 668 | t->is_searching[pgbuf] = false; |
665 | } | 669 | } |
666 | t->virtual_mode = false; | 670 | t->virtual_mode = false; |
671 | unlock_kernel(); | ||
667 | return 0; | 672 | return 0; |
668 | 673 | ||
669 | fail: | 674 | fail: |
670 | video_exclusive_release(inode,file); | 675 | video_exclusive_release(inode,file); |
676 | unlock_kernel(); | ||
671 | return err; | 677 | return err; |
672 | } | 678 | } |
673 | 679 | ||
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index c0c5d7509c2..6f423d116fb 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 68c26898186..8fd31138f9a 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 | ||
diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c index acceed5d04a..d16bbf0d278 100644 --- a/drivers/media/video/se401.c +++ b/drivers/media/video/se401.c | |||
@@ -936,14 +936,18 @@ static int se401_open(struct inode *inode, struct file *file) | |||
936 | struct usb_se401 *se401 = (struct usb_se401 *)dev; | 936 | struct usb_se401 *se401 = (struct usb_se401 *)dev; |
937 | int err = 0; | 937 | int err = 0; |
938 | 938 | ||
939 | if (se401->user) | 939 | lock_kernel(); |
940 | if (se401->user) { | ||
941 | unlock_kernel(); | ||
940 | return -EBUSY; | 942 | return -EBUSY; |
943 | } | ||
941 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); | 944 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); |
942 | if (se401->fbuf) | 945 | if (se401->fbuf) |
943 | file->private_data = dev; | 946 | file->private_data = dev; |
944 | else | 947 | else |
945 | err = -ENOMEM; | 948 | err = -ENOMEM; |
946 | se401->user = !err; | 949 | se401->user = !err; |
950 | unlock_kernel(); | ||
947 | 951 | ||
948 | return err; | 952 | return err; |
949 | } | 953 | } |
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index ad36af30e09..6b1ef5dc562 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c | |||
@@ -689,11 +689,15 @@ static int v4l_stk_open(struct inode *inode, struct file *fp) | |||
689 | vdev = video_devdata(fp); | 689 | vdev = video_devdata(fp); |
690 | dev = vdev_to_camera(vdev); | 690 | dev = vdev_to_camera(vdev); |
691 | 691 | ||
692 | if (dev == NULL || !is_present(dev)) | 692 | lock_kernel(); |
693 | if (dev == NULL || !is_present(dev)) { | ||
694 | unlock_kernel(); | ||
693 | return -ENXIO; | 695 | return -ENXIO; |
696 | } | ||
694 | fp->private_data = vdev; | 697 | fp->private_data = vdev; |
695 | kref_get(&dev->kref); | 698 | kref_get(&dev->kref); |
696 | usb_autopm_get_interface(dev->interface); | 699 | usb_autopm_get_interface(dev->interface); |
700 | unlock_kernel(); | ||
697 | 701 | ||
698 | return 0; | 702 | return 0; |
699 | } | 703 | } |
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index 276bded06ab..a3cbe9be3c1 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c | |||
@@ -1882,12 +1882,16 @@ static int saa_open(struct inode *inode, struct file *file) | |||
1882 | struct video_device *vdev = video_devdata(file); | 1882 | struct video_device *vdev = video_devdata(file); |
1883 | struct saa7146 *saa = container_of(vdev, struct saa7146, video_dev); | 1883 | struct saa7146 *saa = container_of(vdev, struct saa7146, video_dev); |
1884 | 1884 | ||
1885 | lock_kernel(); | ||
1885 | file->private_data = saa; | 1886 | file->private_data = saa; |
1886 | 1887 | ||
1887 | saa->user++; | 1888 | saa->user++; |
1888 | if (saa->user > 1) | 1889 | if (saa->user > 1) { |
1890 | unlock_kernel(); | ||
1889 | return 0; /* device open already, don't reset */ | 1891 | return 0; /* device open already, don't reset */ |
1892 | } | ||
1890 | saa->writemode = VID_WRITE_MPEG_VID; /* default to video */ | 1893 | saa->writemode = VID_WRITE_MPEG_VID; /* default to video */ |
1894 | unlock_kernel(); | ||
1891 | return 0; | 1895 | return 0; |
1892 | } | 1896 | } |
1893 | 1897 | ||
diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c index dce94743945..b21a8d6827c 100644 --- a/drivers/media/video/stv680.c +++ b/drivers/media/video/stv680.c | |||
@@ -1086,6 +1086,7 @@ static int stv_open (struct inode *inode, struct file *file) | |||
1086 | int err = 0; | 1086 | int err = 0; |
1087 | 1087 | ||
1088 | /* we are called with the BKL held */ | 1088 | /* we are called with the BKL held */ |
1089 | lock_kernel(); | ||
1089 | stv680->user = 1; | 1090 | stv680->user = 1; |
1090 | err = stv_init (stv680); /* main initialization routine for camera */ | 1091 | err = stv_init (stv680); /* main initialization routine for camera */ |
1091 | 1092 | ||
@@ -1099,6 +1100,7 @@ static int stv_open (struct inode *inode, struct file *file) | |||
1099 | } | 1100 | } |
1100 | if (err) | 1101 | if (err) |
1101 | stv680->user = 0; | 1102 | stv680->user = 0; |
1103 | unlock_kernel(); | ||
1102 | 1104 | ||
1103 | return err; | 1105 | return err; |
1104 | } | 1106 | } |
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index 2eb45829791..efb878a7402 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -488,20 +488,24 @@ vicam_open(struct inode *inode, struct file *file) | |||
488 | * rely on this fact forever. | 488 | * rely on this fact forever. |
489 | */ | 489 | */ |
490 | 490 | ||
491 | lock_kernel(); | ||
491 | if (cam->open_count > 0) { | 492 | if (cam->open_count > 0) { |
492 | printk(KERN_INFO | 493 | printk(KERN_INFO |
493 | "vicam_open called on already opened camera"); | 494 | "vicam_open called on already opened camera"); |
495 | unlock_kernel(); | ||
494 | return -EBUSY; | 496 | return -EBUSY; |
495 | } | 497 | } |
496 | 498 | ||
497 | cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL); | 499 | cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL); |
498 | if (!cam->raw_image) { | 500 | if (!cam->raw_image) { |
501 | unlock_kernel(); | ||
499 | return -ENOMEM; | 502 | return -ENOMEM; |
500 | } | 503 | } |
501 | 504 | ||
502 | cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); | 505 | cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); |
503 | if (!cam->framebuf) { | 506 | if (!cam->framebuf) { |
504 | kfree(cam->raw_image); | 507 | kfree(cam->raw_image); |
508 | unlock_kernel(); | ||
505 | return -ENOMEM; | 509 | return -ENOMEM; |
506 | } | 510 | } |
507 | 511 | ||
@@ -509,6 +513,7 @@ vicam_open(struct inode *inode, struct file *file) | |||
509 | if (!cam->cntrlbuf) { | 513 | if (!cam->cntrlbuf) { |
510 | kfree(cam->raw_image); | 514 | kfree(cam->raw_image); |
511 | rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); | 515 | rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); |
516 | unlock_kernel(); | ||
512 | return -ENOMEM; | 517 | return -ENOMEM; |
513 | } | 518 | } |
514 | 519 | ||
@@ -526,6 +531,7 @@ vicam_open(struct inode *inode, struct file *file) | |||
526 | cam->open_count++; | 531 | cam->open_count++; |
527 | 532 | ||
528 | file->private_data = cam; | 533 | file->private_data = cam; |
534 | unlock_kernel(); | ||
529 | 535 | ||
530 | return 0; | 536 | return 0; |
531 | } | 537 | } |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index b977116a0dd..b76295a5be8 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -367,6 +367,7 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) | |||
367 | 367 | ||
368 | PDEBUG(DBG_IO, "open"); | 368 | PDEBUG(DBG_IO, "open"); |
369 | 369 | ||
370 | lock_kernel(); | ||
370 | usbvision_reset_powerOffTimer(usbvision); | 371 | usbvision_reset_powerOffTimer(usbvision); |
371 | 372 | ||
372 | if (usbvision->user) | 373 | if (usbvision->user) |
@@ -424,6 +425,7 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) | |||
424 | usbvision_empty_framequeues(usbvision); | 425 | usbvision_empty_framequeues(usbvision); |
425 | 426 | ||
426 | PDEBUG(DBG_IO, "success"); | 427 | PDEBUG(DBG_IO, "success"); |
428 | unlock_kernel(); | ||
427 | return errCode; | 429 | return errCode; |
428 | } | 430 | } |
429 | 431 | ||
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 155fdec9ac7..6b9f3cb0de9 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -116,7 +116,6 @@ static int video_open(struct inode *inode, struct file *file) | |||
116 | 116 | ||
117 | if (minor >= VIDEO_NUM_DEVICES) | 117 | if (minor >= VIDEO_NUM_DEVICES) |
118 | return -ENODEV; | 118 | return -ENODEV; |
119 | lock_kernel(); | ||
120 | mutex_lock(&videodev_lock); | 119 | mutex_lock(&videodev_lock); |
121 | vfl = video_device[minor]; | 120 | vfl = video_device[minor]; |
122 | if (vfl == NULL) { | 121 | if (vfl == NULL) { |
@@ -126,7 +125,6 @@ static int video_open(struct inode *inode, struct file *file) | |||
126 | vfl = video_device[minor]; | 125 | vfl = video_device[minor]; |
127 | if (vfl == NULL) { | 126 | if (vfl == NULL) { |
128 | mutex_unlock(&videodev_lock); | 127 | mutex_unlock(&videodev_lock); |
129 | unlock_kernel(); | ||
130 | return -ENODEV; | 128 | return -ENODEV; |
131 | } | 129 | } |
132 | } | 130 | } |
@@ -140,7 +138,6 @@ static int video_open(struct inode *inode, struct file *file) | |||
140 | } | 138 | } |
141 | fops_put(old_fops); | 139 | fops_put(old_fops); |
142 | mutex_unlock(&videodev_lock); | 140 | mutex_unlock(&videodev_lock); |
143 | unlock_kernel(); | ||
144 | return err; | 141 | return err; |
145 | } | 142 | } |
146 | 143 | ||
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 8ba8daafd7e..65c8af18e76 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -898,9 +898,11 @@ static int vivi_open(struct inode *inode, struct file *file) | |||
898 | 898 | ||
899 | printk(KERN_DEBUG "vivi: open called (minor=%d)\n", minor); | 899 | printk(KERN_DEBUG "vivi: open called (minor=%d)\n", minor); |
900 | 900 | ||
901 | lock_kernel(); | ||
901 | list_for_each_entry(dev, &vivi_devlist, vivi_devlist) | 902 | list_for_each_entry(dev, &vivi_devlist, vivi_devlist) |
902 | if (dev->vfd->minor == minor) | 903 | if (dev->vfd->minor == minor) |
903 | goto found; | 904 | goto found; |
905 | unlock_kernel(); | ||
904 | return -ENODEV; | 906 | return -ENODEV; |
905 | 907 | ||
906 | found: | 908 | found: |
@@ -925,8 +927,10 @@ found: | |||
925 | } | 927 | } |
926 | unlock: | 928 | unlock: |
927 | mutex_unlock(&dev->mutex); | 929 | mutex_unlock(&dev->mutex); |
928 | if (retval) | 930 | if (retval) { |
931 | unlock_kernel(); | ||
929 | return retval; | 932 | return retval; |
933 | } | ||
930 | 934 | ||
931 | file->private_data = fh; | 935 | file->private_data = fh; |
932 | fh->dev = dev; | 936 | fh->dev = dev; |
@@ -955,6 +959,7 @@ unlock: | |||
955 | sizeof(struct vivi_buffer), fh); | 959 | sizeof(struct vivi_buffer), fh); |
956 | 960 | ||
957 | vivi_start_thread(fh); | 961 | vivi_start_thread(fh); |
962 | unlock_kernel(); | ||
958 | 963 | ||
959 | return 0; | 964 | return 0; |
960 | } | 965 | } |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 2dab9eea4de..4aa1a765626 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -1211,6 +1211,7 @@ zoran_open (struct inode *inode, | |||
1211 | struct zoran_fh *fh; | 1211 | struct zoran_fh *fh; |
1212 | int i, res, first_open = 0, have_module_locks = 0; | 1212 | int i, res, first_open = 0, have_module_locks = 0; |
1213 | 1213 | ||
1214 | lock_kernel(); | ||
1214 | /* find the device */ | 1215 | /* find the device */ |
1215 | for (i = 0; i < zoran_num; i++) { | 1216 | for (i = 0; i < zoran_num; i++) { |
1216 | if (zoran[i]->video_dev->minor == minor) { | 1217 | if (zoran[i]->video_dev->minor == minor) { |
@@ -1321,6 +1322,7 @@ zoran_open (struct inode *inode, | |||
1321 | file->private_data = fh; | 1322 | file->private_data = fh; |
1322 | fh->zr = zr; | 1323 | fh->zr = zr; |
1323 | zoran_open_init_session(file); | 1324 | zoran_open_init_session(file); |
1325 | unlock_kernel(); | ||
1324 | 1326 | ||
1325 | return 0; | 1327 | return 0; |
1326 | 1328 | ||
@@ -1338,6 +1340,7 @@ open_unlock_and_return: | |||
1338 | if (zr) { | 1340 | if (zr) { |
1339 | /*mutex_unlock(&zr->resource_lock);*/ | 1341 | /*mutex_unlock(&zr->resource_lock);*/ |
1340 | } | 1342 | } |
1343 | unlock_kernel(); | ||
1341 | 1344 | ||
1342 | return res; | 1345 | return res; |
1343 | } | 1346 | } |
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c index 18d1c4ba79f..4e1ef10d22d 100644 --- a/drivers/media/video/zr364xx.c +++ b/drivers/media/video/zr364xx.c | |||
@@ -643,14 +643,18 @@ static int zr364xx_open(struct inode *inode, struct file *file) | |||
643 | 643 | ||
644 | cam->skip = 2; | 644 | cam->skip = 2; |
645 | 645 | ||
646 | lock_kernel(); | ||
646 | err = video_exclusive_open(inode, file); | 647 | err = video_exclusive_open(inode, file); |
647 | if (err < 0) | 648 | if (err < 0) { |
649 | unlock_kernel(); | ||
648 | return err; | 650 | return err; |
651 | } | ||
649 | 652 | ||
650 | if (!cam->framebuf) { | 653 | if (!cam->framebuf) { |
651 | cam->framebuf = vmalloc_32(MAX_FRAME_SIZE * FRAMES); | 654 | cam->framebuf = vmalloc_32(MAX_FRAME_SIZE * FRAMES); |
652 | if (!cam->framebuf) { | 655 | if (!cam->framebuf) { |
653 | info("vmalloc_32 failed!"); | 656 | info("vmalloc_32 failed!"); |
657 | unlock_kernel(); | ||
654 | return -ENOMEM; | 658 | return -ENOMEM; |
655 | } | 659 | } |
656 | } | 660 | } |
@@ -664,6 +668,7 @@ static int zr364xx_open(struct inode *inode, struct file *file) | |||
664 | if (err < 0) { | 668 | if (err < 0) { |
665 | info("error during open sequence: %d", i); | 669 | info("error during open sequence: %d", i); |
666 | mutex_unlock(&cam->lock); | 670 | mutex_unlock(&cam->lock); |
671 | unlock_kernel(); | ||
667 | return err; | 672 | return err; |
668 | } | 673 | } |
669 | } | 674 | } |
@@ -676,6 +681,7 @@ static int zr364xx_open(struct inode *inode, struct file *file) | |||
676 | mdelay(100); | 681 | mdelay(100); |
677 | 682 | ||
678 | mutex_unlock(&cam->lock); | 683 | mutex_unlock(&cam->lock); |
684 | unlock_kernel(); | ||
679 | return 0; | 685 | return 0; |
680 | } | 686 | } |
681 | 687 | ||