diff options
Diffstat (limited to 'drivers/media/video/zoran/zoran_driver.c')
-rw-r--r-- | drivers/media/video/zoran/zoran_driver.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 401082b853f0..67a52e844ae6 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/module.h> | 49 | #include <linux/module.h> |
50 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
52 | #include <linux/smp_lock.h> | ||
53 | #include <linux/pci.h> | 52 | #include <linux/pci.h> |
54 | #include <linux/vmalloc.h> | 53 | #include <linux/vmalloc.h> |
55 | #include <linux/wait.h> | 54 | #include <linux/wait.h> |
@@ -913,7 +912,7 @@ static int zoran_open(struct file *file) | |||
913 | dprintk(2, KERN_INFO "%s: %s(%s, pid=[%d]), users(-)=%d\n", | 912 | dprintk(2, KERN_INFO "%s: %s(%s, pid=[%d]), users(-)=%d\n", |
914 | ZR_DEVNAME(zr), __func__, current->comm, task_pid_nr(current), zr->user + 1); | 913 | ZR_DEVNAME(zr), __func__, current->comm, task_pid_nr(current), zr->user + 1); |
915 | 914 | ||
916 | lock_kernel(); | 915 | mutex_lock(&zr->other_lock); |
917 | 916 | ||
918 | if (zr->user >= 2048) { | 917 | if (zr->user >= 2048) { |
919 | dprintk(1, KERN_ERR "%s: too many users (%d) on device\n", | 918 | dprintk(1, KERN_ERR "%s: too many users (%d) on device\n", |
@@ -963,14 +962,14 @@ static int zoran_open(struct file *file) | |||
963 | file->private_data = fh; | 962 | file->private_data = fh; |
964 | fh->zr = zr; | 963 | fh->zr = zr; |
965 | zoran_open_init_session(fh); | 964 | zoran_open_init_session(fh); |
966 | unlock_kernel(); | 965 | mutex_unlock(&zr->other_lock); |
967 | 966 | ||
968 | return 0; | 967 | return 0; |
969 | 968 | ||
970 | fail_fh: | 969 | fail_fh: |
971 | kfree(fh); | 970 | kfree(fh); |
972 | fail_unlock: | 971 | fail_unlock: |
973 | unlock_kernel(); | 972 | mutex_unlock(&zr->other_lock); |
974 | 973 | ||
975 | dprintk(2, KERN_INFO "%s: open failed (%d), users(-)=%d\n", | 974 | dprintk(2, KERN_INFO "%s: open failed (%d), users(-)=%d\n", |
976 | ZR_DEVNAME(zr), res, zr->user); | 975 | ZR_DEVNAME(zr), res, zr->user); |
@@ -989,7 +988,7 @@ zoran_close(struct file *file) | |||
989 | 988 | ||
990 | /* kernel locks (fs/device.c), so don't do that ourselves | 989 | /* kernel locks (fs/device.c), so don't do that ourselves |
991 | * (prevents deadlocks) */ | 990 | * (prevents deadlocks) */ |
992 | /*mutex_lock(&zr->resource_lock);*/ | 991 | mutex_lock(&zr->other_lock); |
993 | 992 | ||
994 | zoran_close_end_session(fh); | 993 | zoran_close_end_session(fh); |
995 | 994 | ||
@@ -1023,6 +1022,7 @@ zoran_close(struct file *file) | |||
1023 | encoder_call(zr, video, s_routing, 2, 0, 0); | 1022 | encoder_call(zr, video, s_routing, 2, 0, 0); |
1024 | } | 1023 | } |
1025 | } | 1024 | } |
1025 | mutex_unlock(&zr->other_lock); | ||
1026 | 1026 | ||
1027 | file->private_data = NULL; | 1027 | file->private_data = NULL; |
1028 | kfree(fh->overlay_mask); | 1028 | kfree(fh->overlay_mask); |
@@ -3370,11 +3370,26 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { | |||
3370 | #endif | 3370 | #endif |
3371 | }; | 3371 | }; |
3372 | 3372 | ||
3373 | /* please use zr->resource_lock consistently and kill this wrapper */ | ||
3374 | static long zoran_ioctl(struct file *file, unsigned int cmd, | ||
3375 | unsigned long arg) | ||
3376 | { | ||
3377 | struct zoran_fh *fh = file->private_data; | ||
3378 | struct zoran *zr = fh->zr; | ||
3379 | int ret; | ||
3380 | |||
3381 | mutex_lock(&zr->other_lock); | ||
3382 | ret = video_ioctl2(file, cmd, arg); | ||
3383 | mutex_unlock(&zr->other_lock); | ||
3384 | |||
3385 | return ret; | ||
3386 | } | ||
3387 | |||
3373 | static const struct v4l2_file_operations zoran_fops = { | 3388 | static const struct v4l2_file_operations zoran_fops = { |
3374 | .owner = THIS_MODULE, | 3389 | .owner = THIS_MODULE, |
3375 | .open = zoran_open, | 3390 | .open = zoran_open, |
3376 | .release = zoran_close, | 3391 | .release = zoran_close, |
3377 | .ioctl = video_ioctl2, | 3392 | .unlocked_ioctl = zoran_ioctl, |
3378 | .read = zoran_read, | 3393 | .read = zoran_read, |
3379 | .write = zoran_write, | 3394 | .write = zoran_write, |
3380 | .mmap = zoran_mmap, | 3395 | .mmap = zoran_mmap, |