diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-12-10 08:53:20 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:03:22 -0500 |
commit | e2c77314c9444c994087c96eb370b333d57657a7 (patch) | |
tree | 498e943a85490257f19b263fe979f001a2cd93a2 | |
parent | 543323bcf49422c76cf13755ec4a90564065bb60 (diff) |
V4L/DVB (6759): CodingStyle fixes
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/videobuf-core.c | 292 |
1 files changed, 146 insertions, 146 deletions
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 26d1a5001738..9662d1e40a0c 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c | |||
@@ -22,29 +22,32 @@ | |||
22 | #include <media/videobuf-core.h> | 22 | #include <media/videobuf-core.h> |
23 | 23 | ||
24 | #define MAGIC_BUFFER 0x20070728 | 24 | #define MAGIC_BUFFER 0x20070728 |
25 | #define MAGIC_CHECK(is,should) if (unlikely((is) != (should))) \ | 25 | #define MAGIC_CHECK(is, should) do { \ |
26 | { printk(KERN_ERR "magic mismatch: %x (expected %x)\n",is,should); BUG(); } | 26 | if (unlikely((is) != (should))) { \ |
27 | printk(KERN_ERR "magic mismatch: %x (expected %x)\n", is, should); \ | ||
28 | BUG(); } } while (0) | ||
27 | 29 | ||
28 | static int debug = 0; | 30 | static int debug; |
29 | module_param(debug, int, 0644); | 31 | module_param(debug, int, 0644); |
30 | 32 | ||
31 | MODULE_DESCRIPTION("helper module to manage video4linux buffers"); | 33 | MODULE_DESCRIPTION("helper module to manage video4linux buffers"); |
32 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); | 34 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); |
33 | MODULE_LICENSE("GPL"); | 35 | MODULE_LICENSE("GPL"); |
34 | 36 | ||
35 | #define dprintk(level, fmt, arg...) if (debug >= level) \ | 37 | #define dprintk(level, fmt, arg...) do { \ |
36 | printk(KERN_DEBUG "vbuf: " fmt , ## arg) | 38 | if (debug >= level) \ |
39 | printk(KERN_DEBUG "vbuf: " fmt , ## arg); } while (0) | ||
37 | 40 | ||
38 | /* --------------------------------------------------------------------- */ | 41 | /* --------------------------------------------------------------------- */ |
39 | 42 | ||
40 | #define CALL(q, f, arg...) \ | 43 | #define CALL(q, f, arg...) \ |
41 | ( (q->int_ops->f)? q->int_ops->f(arg) : 0) | 44 | ((q->int_ops->f) ? q->int_ops->f(arg) : 0) |
42 | 45 | ||
43 | void* videobuf_alloc(struct videobuf_queue* q) | 46 | void *videobuf_alloc(struct videobuf_queue *q) |
44 | { | 47 | { |
45 | struct videobuf_buffer *vb; | 48 | struct videobuf_buffer *vb; |
46 | 49 | ||
47 | BUG_ON (q->msize<sizeof(*vb)); | 50 | BUG_ON(q->msize < sizeof(*vb)); |
48 | 51 | ||
49 | if (!q->int_ops || !q->int_ops->alloc) { | 52 | if (!q->int_ops || !q->int_ops->alloc) { |
50 | printk(KERN_ERR "No specific ops defined!\n"); | 53 | printk(KERN_ERR "No specific ops defined!\n"); |
@@ -66,7 +69,7 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr) | |||
66 | int retval = 0; | 69 | int retval = 0; |
67 | DECLARE_WAITQUEUE(wait, current); | 70 | DECLARE_WAITQUEUE(wait, current); |
68 | 71 | ||
69 | MAGIC_CHECK(vb->magic,MAGIC_BUFFER); | 72 | MAGIC_CHECK(vb->magic, MAGIC_BUFFER); |
70 | add_wait_queue(&vb->done, &wait); | 73 | add_wait_queue(&vb->done, &wait); |
71 | while (vb->state == VIDEOBUF_ACTIVE || vb->state == VIDEOBUF_QUEUED) { | 74 | while (vb->state == VIDEOBUF_ACTIVE || vb->state == VIDEOBUF_QUEUED) { |
72 | if (non_blocking) { | 75 | if (non_blocking) { |
@@ -75,11 +78,12 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr) | |||
75 | } | 78 | } |
76 | set_current_state(intr ? TASK_INTERRUPTIBLE | 79 | set_current_state(intr ? TASK_INTERRUPTIBLE |
77 | : TASK_UNINTERRUPTIBLE); | 80 | : TASK_UNINTERRUPTIBLE); |
78 | if (vb->state == VIDEOBUF_ACTIVE || vb->state == VIDEOBUF_QUEUED) | 81 | if (vb->state == VIDEOBUF_ACTIVE || |
82 | vb->state == VIDEOBUF_QUEUED) | ||
79 | schedule(); | 83 | schedule(); |
80 | set_current_state(TASK_RUNNING); | 84 | set_current_state(TASK_RUNNING); |
81 | if (intr && signal_pending(current)) { | 85 | if (intr && signal_pending(current)) { |
82 | dprintk(1,"buffer waiton: -EINTR\n"); | 86 | dprintk(1, "buffer waiton: -EINTR\n"); |
83 | retval = -EINTR; | 87 | retval = -EINTR; |
84 | break; | 88 | break; |
85 | } | 89 | } |
@@ -88,27 +92,27 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr) | |||
88 | return retval; | 92 | return retval; |
89 | } | 93 | } |
90 | 94 | ||
91 | int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, | 95 | int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, |
92 | struct v4l2_framebuffer *fbuf) | 96 | struct v4l2_framebuffer *fbuf) |
93 | { | 97 | { |
94 | MAGIC_CHECK(vb->magic,MAGIC_BUFFER); | 98 | MAGIC_CHECK(vb->magic, MAGIC_BUFFER); |
95 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 99 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
96 | 100 | ||
97 | /* FIXME: This is required to avoid OOPS on some cases, since mmap_mapper() | 101 | /* FIXME: This is required to avoid OOPS on some cases, |
98 | method should be called before _iolock. | 102 | since mmap_mapper() method should be called before _iolock. |
99 | On some cases, the mmap_mapper() is called only after scheduling. | 103 | On some cases, the mmap_mapper() is called only after scheduling. |
100 | 104 | ||
101 | However, this way is just too dirty! Better to wait for some event. | 105 | However, this way is just too dirty! Better to wait for some event. |
102 | */ | 106 | */ |
103 | schedule_timeout(HZ); | 107 | schedule_timeout(HZ); |
104 | 108 | ||
105 | return CALL(q,iolock,q,vb,fbuf); | 109 | return CALL(q, iolock, q, vb, fbuf); |
106 | } | 110 | } |
107 | 111 | ||
108 | /* --------------------------------------------------------------------- */ | 112 | /* --------------------------------------------------------------------- */ |
109 | 113 | ||
110 | 114 | ||
111 | void videobuf_queue_core_init(struct videobuf_queue* q, | 115 | void videobuf_queue_core_init(struct videobuf_queue *q, |
112 | struct videobuf_queue_ops *ops, | 116 | struct videobuf_queue_ops *ops, |
113 | void *dev, | 117 | void *dev, |
114 | spinlock_t *irqlock, | 118 | spinlock_t *irqlock, |
@@ -118,7 +122,7 @@ void videobuf_queue_core_init(struct videobuf_queue* q, | |||
118 | void *priv, | 122 | void *priv, |
119 | struct videobuf_qtype_ops *int_ops) | 123 | struct videobuf_qtype_ops *int_ops) |
120 | { | 124 | { |
121 | memset(q,0,sizeof(*q)); | 125 | memset(q, 0, sizeof(*q)); |
122 | q->irqlock = irqlock; | 126 | q->irqlock = irqlock; |
123 | q->dev = dev; | 127 | q->dev = dev; |
124 | q->type = type; | 128 | q->type = type; |
@@ -129,13 +133,13 @@ void videobuf_queue_core_init(struct videobuf_queue* q, | |||
129 | q->int_ops = int_ops; | 133 | q->int_ops = int_ops; |
130 | 134 | ||
131 | /* All buffer operations are mandatory */ | 135 | /* All buffer operations are mandatory */ |
132 | BUG_ON (!q->ops->buf_setup); | 136 | BUG_ON(!q->ops->buf_setup); |
133 | BUG_ON (!q->ops->buf_prepare); | 137 | BUG_ON(!q->ops->buf_prepare); |
134 | BUG_ON (!q->ops->buf_queue); | 138 | BUG_ON(!q->ops->buf_queue); |
135 | BUG_ON (!q->ops->buf_release); | 139 | BUG_ON(!q->ops->buf_release); |
136 | 140 | ||
137 | /* Having implementations for abstract methods are mandatory */ | 141 | /* Having implementations for abstract methods are mandatory */ |
138 | BUG_ON (!q->int_ops); | 142 | BUG_ON(!q->int_ops); |
139 | 143 | ||
140 | mutex_init(&q->lock); | 144 | mutex_init(&q->lock); |
141 | INIT_LIST_HEAD(&q->stream); | 145 | INIT_LIST_HEAD(&q->stream); |
@@ -146,33 +150,33 @@ int videobuf_queue_is_busy(struct videobuf_queue *q) | |||
146 | { | 150 | { |
147 | int i; | 151 | int i; |
148 | 152 | ||
149 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 153 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
150 | 154 | ||
151 | if (q->streaming) { | 155 | if (q->streaming) { |
152 | dprintk(1,"busy: streaming active\n"); | 156 | dprintk(1, "busy: streaming active\n"); |
153 | return 1; | 157 | return 1; |
154 | } | 158 | } |
155 | if (q->reading) { | 159 | if (q->reading) { |
156 | dprintk(1,"busy: pending read #1\n"); | 160 | dprintk(1, "busy: pending read #1\n"); |
157 | return 1; | 161 | return 1; |
158 | } | 162 | } |
159 | if (q->read_buf) { | 163 | if (q->read_buf) { |
160 | dprintk(1,"busy: pending read #2\n"); | 164 | dprintk(1, "busy: pending read #2\n"); |
161 | return 1; | 165 | return 1; |
162 | } | 166 | } |
163 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 167 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
164 | if (NULL == q->bufs[i]) | 168 | if (NULL == q->bufs[i]) |
165 | continue; | 169 | continue; |
166 | if (q->bufs[i]->map) { | 170 | if (q->bufs[i]->map) { |
167 | dprintk(1,"busy: buffer #%d mapped\n",i); | 171 | dprintk(1, "busy: buffer #%d mapped\n", i); |
168 | return 1; | 172 | return 1; |
169 | } | 173 | } |
170 | if (q->bufs[i]->state == VIDEOBUF_QUEUED) { | 174 | if (q->bufs[i]->state == VIDEOBUF_QUEUED) { |
171 | dprintk(1,"busy: buffer #%d queued\n",i); | 175 | dprintk(1, "busy: buffer #%d queued\n", i); |
172 | return 1; | 176 | return 1; |
173 | } | 177 | } |
174 | if (q->bufs[i]->state == VIDEOBUF_ACTIVE) { | 178 | if (q->bufs[i]->state == VIDEOBUF_ACTIVE) { |
175 | dprintk(1,"busy: buffer #%d avtive\n",i); | 179 | dprintk(1, "busy: buffer #%d avtive\n", i); |
176 | return 1; | 180 | return 1; |
177 | } | 181 | } |
178 | } | 182 | } |
@@ -182,12 +186,12 @@ int videobuf_queue_is_busy(struct videobuf_queue *q) | |||
182 | /* Locking: Caller holds q->lock */ | 186 | /* Locking: Caller holds q->lock */ |
183 | void videobuf_queue_cancel(struct videobuf_queue *q) | 187 | void videobuf_queue_cancel(struct videobuf_queue *q) |
184 | { | 188 | { |
185 | unsigned long flags=0; | 189 | unsigned long flags = 0; |
186 | int i; | 190 | int i; |
187 | 191 | ||
188 | /* remove queued buffers from list */ | 192 | /* remove queued buffers from list */ |
189 | if (q->irqlock) | 193 | if (q->irqlock) |
190 | spin_lock_irqsave(q->irqlock,flags); | 194 | spin_lock_irqsave(q->irqlock, flags); |
191 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 195 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
192 | if (NULL == q->bufs[i]) | 196 | if (NULL == q->bufs[i]) |
193 | continue; | 197 | continue; |
@@ -197,13 +201,13 @@ void videobuf_queue_cancel(struct videobuf_queue *q) | |||
197 | } | 201 | } |
198 | } | 202 | } |
199 | if (q->irqlock) | 203 | if (q->irqlock) |
200 | spin_unlock_irqrestore(q->irqlock,flags); | 204 | spin_unlock_irqrestore(q->irqlock, flags); |
201 | 205 | ||
202 | /* free all buffers + clear queue */ | 206 | /* free all buffers + clear queue */ |
203 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 207 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
204 | if (NULL == q->bufs[i]) | 208 | if (NULL == q->bufs[i]) |
205 | continue; | 209 | continue; |
206 | q->ops->buf_release(q,q->bufs[i]); | 210 | q->ops->buf_release(q, q->bufs[i]); |
207 | } | 211 | } |
208 | INIT_LIST_HEAD(&q->stream); | 212 | INIT_LIST_HEAD(&q->stream); |
209 | } | 213 | } |
@@ -233,8 +237,8 @@ enum v4l2_field videobuf_next_field(struct videobuf_queue *q) | |||
233 | static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, | 237 | static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, |
234 | struct videobuf_buffer *vb, enum v4l2_buf_type type) | 238 | struct videobuf_buffer *vb, enum v4l2_buf_type type) |
235 | { | 239 | { |
236 | MAGIC_CHECK(vb->magic,MAGIC_BUFFER); | 240 | MAGIC_CHECK(vb->magic, MAGIC_BUFFER); |
237 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 241 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
238 | 242 | ||
239 | b->index = vb->i; | 243 | b->index = vb->i; |
240 | b->type = type; | 244 | b->type = type; |
@@ -294,16 +298,16 @@ static int __videobuf_mmap_free(struct videobuf_queue *q) | |||
294 | if (!q) | 298 | if (!q) |
295 | return 0; | 299 | return 0; |
296 | 300 | ||
297 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 301 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
298 | 302 | ||
299 | rc = CALL(q,mmap_free,q); | 303 | rc = CALL(q, mmap_free, q); |
300 | if (rc<0) | 304 | if (rc < 0) |
301 | return rc; | 305 | return rc; |
302 | 306 | ||
303 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 307 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
304 | if (NULL == q->bufs[i]) | 308 | if (NULL == q->bufs[i]) |
305 | continue; | 309 | continue; |
306 | q->ops->buf_release(q,q->bufs[i]); | 310 | q->ops->buf_release(q, q->bufs[i]); |
307 | kfree(q->bufs[i]); | 311 | kfree(q->bufs[i]); |
308 | q->bufs[i] = NULL; | 312 | q->bufs[i] = NULL; |
309 | } | 313 | } |
@@ -328,7 +332,7 @@ static int __videobuf_mmap_setup(struct videobuf_queue *q, | |||
328 | unsigned int i; | 332 | unsigned int i; |
329 | int err; | 333 | int err; |
330 | 334 | ||
331 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 335 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
332 | 336 | ||
333 | err = __videobuf_mmap_free(q); | 337 | err = __videobuf_mmap_free(q); |
334 | if (0 != err) | 338 | if (0 != err) |
@@ -359,7 +363,7 @@ static int __videobuf_mmap_setup(struct videobuf_queue *q, | |||
359 | if (!i) | 363 | if (!i) |
360 | return -ENOMEM; | 364 | return -ENOMEM; |
361 | 365 | ||
362 | dprintk(1,"mmap setup: %d buffers, %d bytes each\n", | 366 | dprintk(1, "mmap setup: %d buffers, %d bytes each\n", |
363 | i, bsize); | 367 | i, bsize); |
364 | 368 | ||
365 | return i; | 369 | return i; |
@@ -379,35 +383,35 @@ int videobuf_mmap_setup(struct videobuf_queue *q, | |||
379 | int videobuf_reqbufs(struct videobuf_queue *q, | 383 | int videobuf_reqbufs(struct videobuf_queue *q, |
380 | struct v4l2_requestbuffers *req) | 384 | struct v4l2_requestbuffers *req) |
381 | { | 385 | { |
382 | unsigned int size,count; | 386 | unsigned int size, count; |
383 | int retval; | 387 | int retval; |
384 | 388 | ||
385 | if (req->count < 1) { | 389 | if (req->count < 1) { |
386 | dprintk(1,"reqbufs: count invalid (%d)\n",req->count); | 390 | dprintk(1, "reqbufs: count invalid (%d)\n", req->count); |
387 | return -EINVAL; | 391 | return -EINVAL; |
388 | } | 392 | } |
389 | 393 | ||
390 | if (req->memory != V4L2_MEMORY_MMAP && | 394 | if (req->memory != V4L2_MEMORY_MMAP && |
391 | req->memory != V4L2_MEMORY_USERPTR && | 395 | req->memory != V4L2_MEMORY_USERPTR && |
392 | req->memory != V4L2_MEMORY_OVERLAY) { | 396 | req->memory != V4L2_MEMORY_OVERLAY) { |
393 | dprintk(1,"reqbufs: memory type invalid\n"); | 397 | dprintk(1, "reqbufs: memory type invalid\n"); |
394 | return -EINVAL; | 398 | return -EINVAL; |
395 | } | 399 | } |
396 | 400 | ||
397 | mutex_lock(&q->lock); | 401 | mutex_lock(&q->lock); |
398 | if (req->type != q->type) { | 402 | if (req->type != q->type) { |
399 | dprintk(1,"reqbufs: queue type invalid\n"); | 403 | dprintk(1, "reqbufs: queue type invalid\n"); |
400 | retval = -EINVAL; | 404 | retval = -EINVAL; |
401 | goto done; | 405 | goto done; |
402 | } | 406 | } |
403 | 407 | ||
404 | if (q->streaming) { | 408 | if (q->streaming) { |
405 | dprintk(1,"reqbufs: streaming already exists\n"); | 409 | dprintk(1, "reqbufs: streaming already exists\n"); |
406 | retval = -EBUSY; | 410 | retval = -EBUSY; |
407 | goto done; | 411 | goto done; |
408 | } | 412 | } |
409 | if (!list_empty(&q->stream)) { | 413 | if (!list_empty(&q->stream)) { |
410 | dprintk(1,"reqbufs: stream running\n"); | 414 | dprintk(1, "reqbufs: stream running\n"); |
411 | retval = -EBUSY; | 415 | retval = -EBUSY; |
412 | goto done; | 416 | goto done; |
413 | } | 417 | } |
@@ -416,14 +420,14 @@ int videobuf_reqbufs(struct videobuf_queue *q, | |||
416 | if (count > VIDEO_MAX_FRAME) | 420 | if (count > VIDEO_MAX_FRAME) |
417 | count = VIDEO_MAX_FRAME; | 421 | count = VIDEO_MAX_FRAME; |
418 | size = 0; | 422 | size = 0; |
419 | q->ops->buf_setup(q,&count,&size); | 423 | q->ops->buf_setup(q, &count, &size); |
420 | size = PAGE_ALIGN(size); | 424 | size = PAGE_ALIGN(size); |
421 | dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n", | 425 | dprintk(1, "reqbufs: bufs=%d, size=0x%x [%d pages total]\n", |
422 | count, size, (count*size)>>PAGE_SHIFT); | 426 | count, size, (count*size)>>PAGE_SHIFT); |
423 | 427 | ||
424 | retval = __videobuf_mmap_setup(q,count,size,req->memory); | 428 | retval = __videobuf_mmap_setup(q, count, size, req->memory); |
425 | if (retval < 0) { | 429 | if (retval < 0) { |
426 | dprintk(1,"reqbufs: mmap setup returned %d\n",retval); | 430 | dprintk(1, "reqbufs: mmap setup returned %d\n", retval); |
427 | goto done; | 431 | goto done; |
428 | } | 432 | } |
429 | 433 | ||
@@ -440,19 +444,19 @@ int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) | |||
440 | 444 | ||
441 | mutex_lock(&q->lock); | 445 | mutex_lock(&q->lock); |
442 | if (unlikely(b->type != q->type)) { | 446 | if (unlikely(b->type != q->type)) { |
443 | dprintk(1,"querybuf: Wrong type.\n"); | 447 | dprintk(1, "querybuf: Wrong type.\n"); |
444 | goto done; | 448 | goto done; |
445 | } | 449 | } |
446 | if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) { | 450 | if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) { |
447 | dprintk(1,"querybuf: index out of range.\n"); | 451 | dprintk(1, "querybuf: index out of range.\n"); |
448 | goto done; | 452 | goto done; |
449 | } | 453 | } |
450 | if (unlikely(NULL == q->bufs[b->index])) { | 454 | if (unlikely(NULL == q->bufs[b->index])) { |
451 | dprintk(1,"querybuf: buffer is null.\n"); | 455 | dprintk(1, "querybuf: buffer is null.\n"); |
452 | goto done; | 456 | goto done; |
453 | } | 457 | } |
454 | 458 | ||
455 | videobuf_status(q,b,q->bufs[b->index],q->type); | 459 | videobuf_status(q, b, q->bufs[b->index], q->type); |
456 | 460 | ||
457 | ret = 0; | 461 | ret = 0; |
458 | done: | 462 | done: |
@@ -465,10 +469,10 @@ int videobuf_qbuf(struct videobuf_queue *q, | |||
465 | { | 469 | { |
466 | struct videobuf_buffer *buf; | 470 | struct videobuf_buffer *buf; |
467 | enum v4l2_field field; | 471 | enum v4l2_field field; |
468 | unsigned long flags=0; | 472 | unsigned long flags = 0; |
469 | int retval; | 473 | int retval; |
470 | 474 | ||
471 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 475 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
472 | 476 | ||
473 | if (b->memory == V4L2_MEMORY_MMAP) | 477 | if (b->memory == V4L2_MEMORY_MMAP) |
474 | down_read(¤t->mm->mmap_sem); | 478 | down_read(¤t->mm->mmap_sem); |
@@ -476,36 +480,36 @@ int videobuf_qbuf(struct videobuf_queue *q, | |||
476 | mutex_lock(&q->lock); | 480 | mutex_lock(&q->lock); |
477 | retval = -EBUSY; | 481 | retval = -EBUSY; |
478 | if (q->reading) { | 482 | if (q->reading) { |
479 | dprintk(1,"qbuf: Reading running...\n"); | 483 | dprintk(1, "qbuf: Reading running...\n"); |
480 | goto done; | 484 | goto done; |
481 | } | 485 | } |
482 | retval = -EINVAL; | 486 | retval = -EINVAL; |
483 | if (b->type != q->type) { | 487 | if (b->type != q->type) { |
484 | dprintk(1,"qbuf: Wrong type.\n"); | 488 | dprintk(1, "qbuf: Wrong type.\n"); |
485 | goto done; | 489 | goto done; |
486 | } | 490 | } |
487 | if (b->index < 0 || b->index >= VIDEO_MAX_FRAME) { | 491 | if (b->index < 0 || b->index >= VIDEO_MAX_FRAME) { |
488 | dprintk(1,"qbuf: index out of range.\n"); | 492 | dprintk(1, "qbuf: index out of range.\n"); |
489 | goto done; | 493 | goto done; |
490 | } | 494 | } |
491 | buf = q->bufs[b->index]; | 495 | buf = q->bufs[b->index]; |
492 | if (NULL == buf) { | 496 | if (NULL == buf) { |
493 | dprintk(1,"qbuf: buffer is null.\n"); | 497 | dprintk(1, "qbuf: buffer is null.\n"); |
494 | goto done; | 498 | goto done; |
495 | } | 499 | } |
496 | MAGIC_CHECK(buf->magic,MAGIC_BUFFER); | 500 | MAGIC_CHECK(buf->magic, MAGIC_BUFFER); |
497 | if (buf->memory != b->memory) { | 501 | if (buf->memory != b->memory) { |
498 | dprintk(1,"qbuf: memory type is wrong.\n"); | 502 | dprintk(1, "qbuf: memory type is wrong.\n"); |
499 | goto done; | 503 | goto done; |
500 | } | 504 | } |
501 | if (buf->state != VIDEOBUF_NEEDS_INIT && buf->state != VIDEOBUF_IDLE) { | 505 | if (buf->state != VIDEOBUF_NEEDS_INIT && buf->state != VIDEOBUF_IDLE) { |
502 | dprintk(1,"qbuf: buffer is already queued or active.\n"); | 506 | dprintk(1, "qbuf: buffer is already queued or active.\n"); |
503 | goto done; | 507 | goto done; |
504 | } | 508 | } |
505 | 509 | ||
506 | if (b->flags & V4L2_BUF_FLAG_INPUT) { | 510 | if (b->flags & V4L2_BUF_FLAG_INPUT) { |
507 | if (b->input >= q->inputs) { | 511 | if (b->input >= q->inputs) { |
508 | dprintk(1,"qbuf: wrong input.\n"); | 512 | dprintk(1, "qbuf: wrong input.\n"); |
509 | goto done; | 513 | goto done; |
510 | } | 514 | } |
511 | buf->input = b->input; | 515 | buf->input = b->input; |
@@ -516,44 +520,46 @@ int videobuf_qbuf(struct videobuf_queue *q, | |||
516 | switch (b->memory) { | 520 | switch (b->memory) { |
517 | case V4L2_MEMORY_MMAP: | 521 | case V4L2_MEMORY_MMAP: |
518 | if (0 == buf->baddr) { | 522 | if (0 == buf->baddr) { |
519 | dprintk(1,"qbuf: mmap requested but buffer addr is zero!\n"); | 523 | dprintk(1, "qbuf: mmap requested " |
524 | "but buffer addr is zero!\n"); | ||
520 | goto done; | 525 | goto done; |
521 | } | 526 | } |
522 | break; | 527 | break; |
523 | case V4L2_MEMORY_USERPTR: | 528 | case V4L2_MEMORY_USERPTR: |
524 | if (b->length < buf->bsize) { | 529 | if (b->length < buf->bsize) { |
525 | dprintk(1,"qbuf: buffer length is not enough\n"); | 530 | dprintk(1, "qbuf: buffer length is not enough\n"); |
526 | goto done; | 531 | goto done; |
527 | } | 532 | } |
528 | if (VIDEOBUF_NEEDS_INIT != buf->state && buf->baddr != b->m.userptr) | 533 | if (VIDEOBUF_NEEDS_INIT != buf->state && |
529 | q->ops->buf_release(q,buf); | 534 | buf->baddr != b->m.userptr) |
535 | q->ops->buf_release(q, buf); | ||
530 | buf->baddr = b->m.userptr; | 536 | buf->baddr = b->m.userptr; |
531 | break; | 537 | break; |
532 | case V4L2_MEMORY_OVERLAY: | 538 | case V4L2_MEMORY_OVERLAY: |
533 | buf->boff = b->m.offset; | 539 | buf->boff = b->m.offset; |
534 | break; | 540 | break; |
535 | default: | 541 | default: |
536 | dprintk(1,"qbuf: wrong memory type\n"); | 542 | dprintk(1, "qbuf: wrong memory type\n"); |
537 | goto done; | 543 | goto done; |
538 | } | 544 | } |
539 | 545 | ||
540 | dprintk(1,"qbuf: requesting next field\n"); | 546 | dprintk(1, "qbuf: requesting next field\n"); |
541 | field = videobuf_next_field(q); | 547 | field = videobuf_next_field(q); |
542 | retval = q->ops->buf_prepare(q,buf,field); | 548 | retval = q->ops->buf_prepare(q, buf, field); |
543 | if (0 != retval) { | 549 | if (0 != retval) { |
544 | dprintk(1,"qbuf: buffer_prepare returned %d\n",retval); | 550 | dprintk(1, "qbuf: buffer_prepare returned %d\n", retval); |
545 | goto done; | 551 | goto done; |
546 | } | 552 | } |
547 | 553 | ||
548 | list_add_tail(&buf->stream,&q->stream); | 554 | list_add_tail(&buf->stream, &q->stream); |
549 | if (q->streaming) { | 555 | if (q->streaming) { |
550 | if (q->irqlock) | 556 | if (q->irqlock) |
551 | spin_lock_irqsave(q->irqlock,flags); | 557 | spin_lock_irqsave(q->irqlock, flags); |
552 | q->ops->buf_queue(q,buf); | 558 | q->ops->buf_queue(q, buf); |
553 | if (q->irqlock) | 559 | if (q->irqlock) |
554 | spin_unlock_irqrestore(q->irqlock,flags); | 560 | spin_unlock_irqrestore(q->irqlock, flags); |
555 | } | 561 | } |
556 | dprintk(1,"qbuf: succeded\n"); | 562 | dprintk(1, "qbuf: succeded\n"); |
557 | retval = 0; | 563 | retval = 0; |
558 | 564 | ||
559 | done: | 565 | done: |
@@ -571,49 +577,49 @@ int videobuf_dqbuf(struct videobuf_queue *q, | |||
571 | struct videobuf_buffer *buf; | 577 | struct videobuf_buffer *buf; |
572 | int retval; | 578 | int retval; |
573 | 579 | ||
574 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 580 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
575 | 581 | ||
576 | mutex_lock(&q->lock); | 582 | mutex_lock(&q->lock); |
577 | retval = -EBUSY; | 583 | retval = -EBUSY; |
578 | if (q->reading) { | 584 | if (q->reading) { |
579 | dprintk(1,"dqbuf: Reading running...\n"); | 585 | dprintk(1, "dqbuf: Reading running...\n"); |
580 | goto done; | 586 | goto done; |
581 | } | 587 | } |
582 | retval = -EINVAL; | 588 | retval = -EINVAL; |
583 | if (b->type != q->type) { | 589 | if (b->type != q->type) { |
584 | dprintk(1,"dqbuf: Wrong type.\n"); | 590 | dprintk(1, "dqbuf: Wrong type.\n"); |
585 | goto done; | 591 | goto done; |
586 | } | 592 | } |
587 | if (list_empty(&q->stream)) { | 593 | if (list_empty(&q->stream)) { |
588 | dprintk(1,"dqbuf: stream running\n"); | 594 | dprintk(1, "dqbuf: stream running\n"); |
589 | goto done; | 595 | goto done; |
590 | } | 596 | } |
591 | buf = list_entry(q->stream.next, struct videobuf_buffer, stream); | 597 | buf = list_entry(q->stream.next, struct videobuf_buffer, stream); |
592 | retval = videobuf_waiton(buf, nonblocking, 1); | 598 | retval = videobuf_waiton(buf, nonblocking, 1); |
593 | if (retval < 0) { | 599 | if (retval < 0) { |
594 | dprintk(1,"dqbuf: waiton returned %d\n",retval); | 600 | dprintk(1, "dqbuf: waiton returned %d\n", retval); |
595 | goto done; | 601 | goto done; |
596 | } | 602 | } |
597 | switch (buf->state) { | 603 | switch (buf->state) { |
598 | case VIDEOBUF_ERROR: | 604 | case VIDEOBUF_ERROR: |
599 | dprintk(1,"dqbuf: state is error\n"); | 605 | dprintk(1, "dqbuf: state is error\n"); |
600 | retval = -EIO; | 606 | retval = -EIO; |
601 | CALL(q,sync,q, buf); | 607 | CALL(q, sync, q, buf); |
602 | buf->state = VIDEOBUF_IDLE; | 608 | buf->state = VIDEOBUF_IDLE; |
603 | break; | 609 | break; |
604 | case VIDEOBUF_DONE: | 610 | case VIDEOBUF_DONE: |
605 | dprintk(1,"dqbuf: state is done\n"); | 611 | dprintk(1, "dqbuf: state is done\n"); |
606 | CALL(q,sync,q, buf); | 612 | CALL(q, sync, q, buf); |
607 | buf->state = VIDEOBUF_IDLE; | 613 | buf->state = VIDEOBUF_IDLE; |
608 | break; | 614 | break; |
609 | default: | 615 | default: |
610 | dprintk(1,"dqbuf: state invalid\n"); | 616 | dprintk(1, "dqbuf: state invalid\n"); |
611 | retval = -EINVAL; | 617 | retval = -EINVAL; |
612 | goto done; | 618 | goto done; |
613 | } | 619 | } |
614 | list_del(&buf->stream); | 620 | list_del(&buf->stream); |
615 | memset(b,0,sizeof(*b)); | 621 | memset(b, 0, sizeof(*b)); |
616 | videobuf_status(q,b,buf,q->type); | 622 | videobuf_status(q, b, buf, q->type); |
617 | 623 | ||
618 | done: | 624 | done: |
619 | mutex_unlock(&q->lock); | 625 | mutex_unlock(&q->lock); |
@@ -623,7 +629,7 @@ int videobuf_dqbuf(struct videobuf_queue *q, | |||
623 | int videobuf_streamon(struct videobuf_queue *q) | 629 | int videobuf_streamon(struct videobuf_queue *q) |
624 | { | 630 | { |
625 | struct videobuf_buffer *buf; | 631 | struct videobuf_buffer *buf; |
626 | unsigned long flags=0; | 632 | unsigned long flags = 0; |
627 | int retval; | 633 | int retval; |
628 | 634 | ||
629 | mutex_lock(&q->lock); | 635 | mutex_lock(&q->lock); |
@@ -635,12 +641,12 @@ int videobuf_streamon(struct videobuf_queue *q) | |||
635 | goto done; | 641 | goto done; |
636 | q->streaming = 1; | 642 | q->streaming = 1; |
637 | if (q->irqlock) | 643 | if (q->irqlock) |
638 | spin_lock_irqsave(q->irqlock,flags); | 644 | spin_lock_irqsave(q->irqlock, flags); |
639 | list_for_each_entry(buf, &q->stream, stream) | 645 | list_for_each_entry(buf, &q->stream, stream) |
640 | if (buf->state == VIDEOBUF_PREPARED) | 646 | if (buf->state == VIDEOBUF_PREPARED) |
641 | q->ops->buf_queue(q,buf); | 647 | q->ops->buf_queue(q, buf); |
642 | if (q->irqlock) | 648 | if (q->irqlock) |
643 | spin_unlock_irqrestore(q->irqlock,flags); | 649 | spin_unlock_irqrestore(q->irqlock, flags); |
644 | 650 | ||
645 | done: | 651 | done: |
646 | mutex_unlock(&q->lock); | 652 | mutex_unlock(&q->lock); |
@@ -676,10 +682,10 @@ static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, | |||
676 | size_t count, loff_t *ppos) | 682 | size_t count, loff_t *ppos) |
677 | { | 683 | { |
678 | enum v4l2_field field; | 684 | enum v4l2_field field; |
679 | unsigned long flags=0; | 685 | unsigned long flags = 0; |
680 | int retval; | 686 | int retval; |
681 | 687 | ||
682 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 688 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
683 | 689 | ||
684 | /* setup stuff */ | 690 | /* setup stuff */ |
685 | q->read_buf = videobuf_alloc(q); | 691 | q->read_buf = videobuf_alloc(q); |
@@ -691,19 +697,19 @@ static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, | |||
691 | q->read_buf->bsize = count; | 697 | q->read_buf->bsize = count; |
692 | 698 | ||
693 | field = videobuf_next_field(q); | 699 | field = videobuf_next_field(q); |
694 | retval = q->ops->buf_prepare(q,q->read_buf,field); | 700 | retval = q->ops->buf_prepare(q, q->read_buf, field); |
695 | if (0 != retval) | 701 | if (0 != retval) |
696 | goto done; | 702 | goto done; |
697 | 703 | ||
698 | /* start capture & wait */ | 704 | /* start capture & wait */ |
699 | if (q->irqlock) | 705 | if (q->irqlock) |
700 | spin_lock_irqsave(q->irqlock,flags); | 706 | spin_lock_irqsave(q->irqlock, flags); |
701 | q->ops->buf_queue(q,q->read_buf); | 707 | q->ops->buf_queue(q, q->read_buf); |
702 | if (q->irqlock) | 708 | if (q->irqlock) |
703 | spin_unlock_irqrestore(q->irqlock,flags); | 709 | spin_unlock_irqrestore(q->irqlock, flags); |
704 | retval = videobuf_waiton(q->read_buf,0,0); | 710 | retval = videobuf_waiton(q->read_buf, 0, 0); |
705 | if (0 == retval) { | 711 | if (0 == retval) { |
706 | CALL(q,sync,q,q->read_buf); | 712 | CALL(q, sync, q, q->read_buf); |
707 | if (VIDEOBUF_ERROR == q->read_buf->state) | 713 | if (VIDEOBUF_ERROR == q->read_buf->state) |
708 | retval = -EIO; | 714 | retval = -EIO; |
709 | else | 715 | else |
@@ -712,7 +718,7 @@ static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, | |||
712 | 718 | ||
713 | done: | 719 | done: |
714 | /* cleanup */ | 720 | /* cleanup */ |
715 | q->ops->buf_release(q,q->read_buf); | 721 | q->ops->buf_release(q, q->read_buf); |
716 | kfree(q->read_buf); | 722 | kfree(q->read_buf); |
717 | q->read_buf = NULL; | 723 | q->read_buf = NULL; |
718 | return retval; | 724 | return retval; |
@@ -723,21 +729,21 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
723 | int nonblocking) | 729 | int nonblocking) |
724 | { | 730 | { |
725 | enum v4l2_field field; | 731 | enum v4l2_field field; |
726 | unsigned long flags=0; | 732 | unsigned long flags = 0; |
727 | unsigned size, nbufs; | 733 | unsigned size, nbufs; |
728 | int retval; | 734 | int retval; |
729 | 735 | ||
730 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 736 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
731 | 737 | ||
732 | mutex_lock(&q->lock); | 738 | mutex_lock(&q->lock); |
733 | 739 | ||
734 | nbufs = 1; size = 0; | 740 | nbufs = 1; size = 0; |
735 | q->ops->buf_setup(q,&nbufs,&size); | 741 | q->ops->buf_setup(q, &nbufs, &size); |
736 | 742 | ||
737 | if (NULL == q->read_buf && | 743 | if (NULL == q->read_buf && |
738 | count >= size && | 744 | count >= size && |
739 | !nonblocking) { | 745 | !nonblocking) { |
740 | retval = videobuf_read_zerocopy(q,data,count,ppos); | 746 | retval = videobuf_read_zerocopy(q, data, count, ppos); |
741 | if (retval >= 0 || retval == -EIO) | 747 | if (retval >= 0 || retval == -EIO) |
742 | /* ok, all done */ | 748 | /* ok, all done */ |
743 | goto done; | 749 | goto done; |
@@ -749,25 +755,25 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
749 | retval = -ENOMEM; | 755 | retval = -ENOMEM; |
750 | q->read_buf = videobuf_alloc(q); | 756 | q->read_buf = videobuf_alloc(q); |
751 | 757 | ||
752 | dprintk(1,"video alloc=0x%p\n", q->read_buf); | 758 | dprintk(1, "video alloc=0x%p\n", q->read_buf); |
753 | if (NULL == q->read_buf) | 759 | if (NULL == q->read_buf) |
754 | goto done; | 760 | goto done; |
755 | q->read_buf->memory = V4L2_MEMORY_USERPTR; | 761 | q->read_buf->memory = V4L2_MEMORY_USERPTR; |
756 | q->read_buf->bsize = count; /* preferred size */ | 762 | q->read_buf->bsize = count; /* preferred size */ |
757 | field = videobuf_next_field(q); | 763 | field = videobuf_next_field(q); |
758 | retval = q->ops->buf_prepare(q,q->read_buf,field); | 764 | retval = q->ops->buf_prepare(q, q->read_buf, field); |
759 | 765 | ||
760 | if (0 != retval) { | 766 | if (0 != retval) { |
761 | kfree (q->read_buf); | 767 | kfree(q->read_buf); |
762 | q->read_buf = NULL; | 768 | q->read_buf = NULL; |
763 | goto done; | 769 | goto done; |
764 | } | 770 | } |
765 | if (q->irqlock) | 771 | if (q->irqlock) |
766 | spin_lock_irqsave(q->irqlock,flags); | 772 | spin_lock_irqsave(q->irqlock, flags); |
767 | 773 | ||
768 | q->ops->buf_queue(q,q->read_buf); | 774 | q->ops->buf_queue(q, q->read_buf); |
769 | if (q->irqlock) | 775 | if (q->irqlock) |
770 | spin_unlock_irqrestore(q->irqlock,flags); | 776 | spin_unlock_irqrestore(q->irqlock, flags); |
771 | q->read_off = 0; | 777 | q->read_off = 0; |
772 | } | 778 | } |
773 | 779 | ||
@@ -776,11 +782,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
776 | if (0 != retval) | 782 | if (0 != retval) |
777 | goto done; | 783 | goto done; |
778 | 784 | ||
779 | CALL(q,sync,q,q->read_buf); | 785 | CALL(q, sync, q, q->read_buf); |
780 | 786 | ||
781 | if (VIDEOBUF_ERROR == q->read_buf->state) { | 787 | if (VIDEOBUF_ERROR == q->read_buf->state) { |
782 | /* catch I/O errors */ | 788 | /* catch I/O errors */ |
783 | q->ops->buf_release(q,q->read_buf); | 789 | q->ops->buf_release(q, q->read_buf); |
784 | kfree(q->read_buf); | 790 | kfree(q->read_buf); |
785 | q->read_buf = NULL; | 791 | q->read_buf = NULL; |
786 | retval = -EIO; | 792 | retval = -EIO; |
@@ -788,14 +794,14 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
788 | } | 794 | } |
789 | 795 | ||
790 | /* Copy to userspace */ | 796 | /* Copy to userspace */ |
791 | retval=CALL(q,video_copy_to_user,q,data,count,nonblocking); | 797 | retval = CALL(q, video_copy_to_user, q, data, count, nonblocking); |
792 | if (retval<0) | 798 | if (retval < 0) |
793 | goto done; | 799 | goto done; |
794 | 800 | ||
795 | q->read_off += retval; | 801 | q->read_off += retval; |
796 | if (q->read_off == q->read_buf->size) { | 802 | if (q->read_off == q->read_buf->size) { |
797 | /* all data copied, cleanup */ | 803 | /* all data copied, cleanup */ |
798 | q->ops->buf_release(q,q->read_buf); | 804 | q->ops->buf_release(q, q->read_buf); |
799 | kfree(q->read_buf); | 805 | kfree(q->read_buf); |
800 | q->read_buf = NULL; | 806 | q->read_buf = NULL; |
801 | } | 807 | } |
@@ -809,11 +815,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
809 | int __videobuf_read_start(struct videobuf_queue *q) | 815 | int __videobuf_read_start(struct videobuf_queue *q) |
810 | { | 816 | { |
811 | enum v4l2_field field; | 817 | enum v4l2_field field; |
812 | unsigned long flags=0; | 818 | unsigned long flags = 0; |
813 | unsigned int count = 0, size = 0; | 819 | unsigned int count = 0, size = 0; |
814 | int err, i; | 820 | int err, i; |
815 | 821 | ||
816 | q->ops->buf_setup(q,&count,&size); | 822 | q->ops->buf_setup(q, &count, &size); |
817 | if (count < 2) | 823 | if (count < 2) |
818 | count = 2; | 824 | count = 2; |
819 | if (count > VIDEO_MAX_FRAME) | 825 | if (count > VIDEO_MAX_FRAME) |
@@ -828,17 +834,17 @@ int __videobuf_read_start(struct videobuf_queue *q) | |||
828 | 834 | ||
829 | for (i = 0; i < count; i++) { | 835 | for (i = 0; i < count; i++) { |
830 | field = videobuf_next_field(q); | 836 | field = videobuf_next_field(q); |
831 | err = q->ops->buf_prepare(q,q->bufs[i],field); | 837 | err = q->ops->buf_prepare(q, q->bufs[i], field); |
832 | if (err) | 838 | if (err) |
833 | return err; | 839 | return err; |
834 | list_add_tail(&q->bufs[i]->stream, &q->stream); | 840 | list_add_tail(&q->bufs[i]->stream, &q->stream); |
835 | } | 841 | } |
836 | if (q->irqlock) | 842 | if (q->irqlock) |
837 | spin_lock_irqsave(q->irqlock,flags); | 843 | spin_lock_irqsave(q->irqlock, flags); |
838 | for (i = 0; i < count; i++) | 844 | for (i = 0; i < count; i++) |
839 | q->ops->buf_queue(q,q->bufs[i]); | 845 | q->ops->buf_queue(q, q->bufs[i]); |
840 | if (q->irqlock) | 846 | if (q->irqlock) |
841 | spin_unlock_irqrestore(q->irqlock,flags); | 847 | spin_unlock_irqrestore(q->irqlock, flags); |
842 | q->reading = 1; | 848 | q->reading = 1; |
843 | return 0; | 849 | return 0; |
844 | } | 850 | } |
@@ -859,7 +865,7 @@ static void __videobuf_read_stop(struct videobuf_queue *q) | |||
859 | } | 865 | } |
860 | q->read_buf = NULL; | 866 | q->read_buf = NULL; |
861 | q->reading = 0; | 867 | q->reading = 0; |
862 | 868 | ||
863 | } | 869 | } |
864 | 870 | ||
865 | int videobuf_read_start(struct videobuf_queue *q) | 871 | int videobuf_read_start(struct videobuf_queue *q) |
@@ -899,11 +905,11 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, | |||
899 | int vbihack, int nonblocking) | 905 | int vbihack, int nonblocking) |
900 | { | 906 | { |
901 | int rc, retval; | 907 | int rc, retval; |
902 | unsigned long flags=0; | 908 | unsigned long flags = 0; |
903 | 909 | ||
904 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 910 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
905 | 911 | ||
906 | dprintk(2,"%s\n",__FUNCTION__); | 912 | dprintk(2, "%s\n", __FUNCTION__); |
907 | mutex_lock(&q->lock); | 913 | mutex_lock(&q->lock); |
908 | retval = -EBUSY; | 914 | retval = -EBUSY; |
909 | if (q->streaming) | 915 | if (q->streaming) |
@@ -932,7 +938,7 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, | |||
932 | } | 938 | } |
933 | 939 | ||
934 | if (q->read_buf->state == VIDEOBUF_DONE) { | 940 | if (q->read_buf->state == VIDEOBUF_DONE) { |
935 | rc = CALL (q,copy_stream, q, data + retval, count, | 941 | rc = CALL(q, copy_stream, q, data + retval, count, |
936 | retval, vbihack, nonblocking); | 942 | retval, vbihack, nonblocking); |
937 | if (rc < 0) { | 943 | if (rc < 0) { |
938 | retval = rc; | 944 | retval = rc; |
@@ -953,10 +959,10 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, | |||
953 | list_add_tail(&q->read_buf->stream, | 959 | list_add_tail(&q->read_buf->stream, |
954 | &q->stream); | 960 | &q->stream); |
955 | if (q->irqlock) | 961 | if (q->irqlock) |
956 | spin_lock_irqsave(q->irqlock,flags); | 962 | spin_lock_irqsave(q->irqlock, flags); |
957 | q->ops->buf_queue(q,q->read_buf); | 963 | q->ops->buf_queue(q, q->read_buf); |
958 | if (q->irqlock) | 964 | if (q->irqlock) |
959 | spin_unlock_irqrestore(q->irqlock,flags); | 965 | spin_unlock_irqrestore(q->irqlock, flags); |
960 | q->read_buf = NULL; | 966 | q->read_buf = NULL; |
961 | } | 967 | } |
962 | if (retval < 0) | 968 | if (retval < 0) |
@@ -1012,10 +1018,10 @@ int videobuf_mmap_mapper(struct videobuf_queue *q, | |||
1012 | { | 1018 | { |
1013 | int retval; | 1019 | int retval; |
1014 | 1020 | ||
1015 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 1021 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
1016 | 1022 | ||
1017 | mutex_lock(&q->lock); | 1023 | mutex_lock(&q->lock); |
1018 | retval=CALL(q,mmap_mapper,q,vma); | 1024 | retval = CALL(q, mmap_mapper, q, vma); |
1019 | mutex_unlock(&q->lock); | 1025 | mutex_unlock(&q->lock); |
1020 | 1026 | ||
1021 | return retval; | 1027 | return retval; |
@@ -1026,15 +1032,15 @@ int videobuf_cgmbuf(struct videobuf_queue *q, | |||
1026 | struct video_mbuf *mbuf, int count) | 1032 | struct video_mbuf *mbuf, int count) |
1027 | { | 1033 | { |
1028 | struct v4l2_requestbuffers req; | 1034 | struct v4l2_requestbuffers req; |
1029 | int rc,i; | 1035 | int rc, i; |
1030 | 1036 | ||
1031 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | 1037 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
1032 | 1038 | ||
1033 | memset(&req,0,sizeof(req)); | 1039 | memset(&req, 0, sizeof(req)); |
1034 | req.type = q->type; | 1040 | req.type = q->type; |
1035 | req.count = count; | 1041 | req.count = count; |
1036 | req.memory = V4L2_MEMORY_MMAP; | 1042 | req.memory = V4L2_MEMORY_MMAP; |
1037 | rc = videobuf_reqbufs(q,&req); | 1043 | rc = videobuf_reqbufs(q, &req); |
1038 | if (rc < 0) | 1044 | if (rc < 0) |
1039 | return rc; | 1045 | return rc; |
1040 | 1046 | ||
@@ -1079,9 +1085,3 @@ EXPORT_SYMBOL_GPL(videobuf_poll_stream); | |||
1079 | EXPORT_SYMBOL_GPL(videobuf_mmap_setup); | 1085 | EXPORT_SYMBOL_GPL(videobuf_mmap_setup); |
1080 | EXPORT_SYMBOL_GPL(videobuf_mmap_free); | 1086 | EXPORT_SYMBOL_GPL(videobuf_mmap_free); |
1081 | EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); | 1087 | EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); |
1082 | |||
1083 | /* | ||
1084 | * Local variables: | ||
1085 | * c-basic-offset: 8 | ||
1086 | * End: | ||
1087 | */ | ||