diff options
Diffstat (limited to 'drivers/media/v4l2-core/videobuf-vmalloc.c')
-rw-r--r-- | drivers/media/v4l2-core/videobuf-vmalloc.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/media/v4l2-core/videobuf-vmalloc.c b/drivers/media/v4l2-core/videobuf-vmalloc.c index 1365c651c177..2ff7fcc77b11 100644 --- a/drivers/media/v4l2-core/videobuf-vmalloc.c +++ b/drivers/media/v4l2-core/videobuf-vmalloc.c | |||
@@ -54,14 +54,11 @@ MODULE_LICENSE("GPL"); | |||
54 | static void videobuf_vm_open(struct vm_area_struct *vma) | 54 | static void videobuf_vm_open(struct vm_area_struct *vma) |
55 | { | 55 | { |
56 | struct videobuf_mapping *map = vma->vm_private_data; | 56 | struct videobuf_mapping *map = vma->vm_private_data; |
57 | struct videobuf_queue *q = map->q; | ||
58 | 57 | ||
59 | dprintk(2, "vm_open %p [count=%u,vma=%08lx-%08lx]\n", map, | 58 | dprintk(2, "vm_open %p [count=%u,vma=%08lx-%08lx]\n", map, |
60 | map->count, vma->vm_start, vma->vm_end); | 59 | map->count, vma->vm_start, vma->vm_end); |
61 | 60 | ||
62 | videobuf_queue_lock(q); | ||
63 | map->count++; | 61 | map->count++; |
64 | videobuf_queue_unlock(q); | ||
65 | } | 62 | } |
66 | 63 | ||
67 | static void videobuf_vm_close(struct vm_area_struct *vma) | 64 | static void videobuf_vm_close(struct vm_area_struct *vma) |
@@ -73,11 +70,12 @@ static void videobuf_vm_close(struct vm_area_struct *vma) | |||
73 | dprintk(2, "vm_close %p [count=%u,vma=%08lx-%08lx]\n", map, | 70 | dprintk(2, "vm_close %p [count=%u,vma=%08lx-%08lx]\n", map, |
74 | map->count, vma->vm_start, vma->vm_end); | 71 | map->count, vma->vm_start, vma->vm_end); |
75 | 72 | ||
76 | videobuf_queue_lock(q); | 73 | map->count--; |
77 | if (!--map->count) { | 74 | if (0 == map->count) { |
78 | struct videobuf_vmalloc_memory *mem; | 75 | struct videobuf_vmalloc_memory *mem; |
79 | 76 | ||
80 | dprintk(1, "munmap %p q=%p\n", map, q); | 77 | dprintk(1, "munmap %p q=%p\n", map, q); |
78 | videobuf_queue_lock(q); | ||
81 | 79 | ||
82 | /* We need first to cancel streams, before unmapping */ | 80 | /* We need first to cancel streams, before unmapping */ |
83 | if (q->streaming) | 81 | if (q->streaming) |
@@ -116,8 +114,8 @@ static void videobuf_vm_close(struct vm_area_struct *vma) | |||
116 | 114 | ||
117 | kfree(map); | 115 | kfree(map); |
118 | 116 | ||
117 | videobuf_queue_unlock(q); | ||
119 | } | 118 | } |
120 | videobuf_queue_unlock(q); | ||
121 | 119 | ||
122 | return; | 120 | return; |
123 | } | 121 | } |