diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-03 11:31:36 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-04-06 20:44:02 -0400 |
commit | cde4362f0244a70bab73e37e24f167186bb9a8be (patch) | |
tree | 17a52f26a6d14c9742c698b2b7e109fad6ac8695 /drivers/media/video/cx231xx/cx231xx-vbi.c | |
parent | 84b5dbf39ed2f51224841bbbf08439158d69d427 (diff) |
V4L/DVB (10956): cx231xx: First series of manual CodingStyle fixes
This patch cleans up CodingStyle on the following source files:
There are still much more to be fixed on later patches
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx231xx/cx231xx-vbi.c')
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-vbi.c | 86 |
1 files changed, 39 insertions, 47 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-vbi.c b/drivers/media/video/cx231xx/cx231xx-vbi.c index 87a77d53faa6..03059043744c 100644 --- a/drivers/media/video/cx231xx/cx231xx-vbi.c +++ b/drivers/media/video/cx231xx/cx231xx-vbi.c | |||
@@ -109,27 +109,29 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb) | |||
109 | buffer_size = urb->actual_length; | 109 | buffer_size = urb->actual_length; |
110 | 110 | ||
111 | if (buffer_size > 0) { | 111 | if (buffer_size > 0) { |
112 | |||
113 | bytes_parsed = 0; | 112 | bytes_parsed = 0; |
114 | 113 | ||
115 | if (dma_q->is_partial_line) { | 114 | if (dma_q->is_partial_line) { |
116 | /* Handle the case where we were working on a partial line */ | 115 | /* Handle the case where we were working on a partial |
116 | line */ | ||
117 | sav_eav = dma_q->last_sav; | 117 | sav_eav = dma_q->last_sav; |
118 | } else { | 118 | } else { |
119 | /* Check for a SAV/EAV overlapping the buffer boundary */ | 119 | /* Check for a SAV/EAV overlapping the |
120 | sav_eav = | 120 | buffer boundary */ |
121 | cx231xx_find_boundary_SAV_EAV(p_buffer, | 121 | |
122 | sav_eav = cx231xx_find_boundary_SAV_EAV(p_buffer, | ||
122 | dma_q->partial_buf, | 123 | dma_q->partial_buf, |
123 | &bytes_parsed); | 124 | &bytes_parsed); |
124 | } | 125 | } |
125 | 126 | ||
126 | sav_eav &= 0xF0; | 127 | sav_eav &= 0xF0; |
127 | /* Get the first line if we have some portion of an SAV/EAV from the last buffer | 128 | /* Get the first line if we have some portion of an SAV/EAV from |
128 | or a partial line */ | 129 | the last buffer or a partial line */ |
129 | if (sav_eav) { | 130 | if (sav_eav) { |
130 | bytes_parsed += cx231xx_get_vbi_line(dev, dma_q, sav_eav, /* SAV/EAV */ | 131 | bytes_parsed += cx231xx_get_vbi_line(dev, dma_q, |
131 | p_buffer + bytes_parsed, /* p_buffer */ | 132 | sav_eav, /* SAV/EAV */ |
132 | buffer_size - bytes_parsed); /* buffer size */ | 133 | p_buffer + bytes_parsed, /* p_buffer */ |
134 | buffer_size - bytes_parsed); /* buffer size */ | ||
133 | } | 135 | } |
134 | 136 | ||
135 | /* Now parse data that is completely in this buffer */ | 137 | /* Now parse data that is completely in this buffer */ |
@@ -139,16 +141,17 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb) | |||
139 | u32 bytes_used = 0; | 141 | u32 bytes_used = 0; |
140 | 142 | ||
141 | sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ | 143 | sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ |
142 | buffer_size - bytes_parsed, /* buffer size */ | 144 | buffer_size - bytes_parsed, /* buffer size */ |
143 | &bytes_used); /* Receives bytes used to get SAV/EAV */ | 145 | &bytes_used); /* Receives bytes used to get SAV/EAV */ |
144 | 146 | ||
145 | bytes_parsed += bytes_used; | 147 | bytes_parsed += bytes_used; |
146 | 148 | ||
147 | sav_eav &= 0xF0; | 149 | sav_eav &= 0xF0; |
148 | if (sav_eav && (bytes_parsed < buffer_size)) { | 150 | if (sav_eav && (bytes_parsed < buffer_size)) { |
149 | bytes_parsed += cx231xx_get_vbi_line(dev, dma_q, sav_eav, /* SAV/EAV */ | 151 | bytes_parsed += cx231xx_get_vbi_line(dev, |
150 | p_buffer + bytes_parsed, /* p_buffer */ | 152 | dma_q, sav_eav, /* SAV/EAV */ |
151 | buffer_size - bytes_parsed); /* buffer size */ | 153 | p_buffer + bytes_parsed, /* p_buffer */ |
154 | buffer_size - bytes_parsed); /* buffer size */ | ||
152 | } | 155 | } |
153 | } | 156 | } |
154 | 157 | ||
@@ -261,7 +264,7 @@ vbi_buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
261 | buf->vb.state = VIDEOBUF_PREPARED; | 264 | buf->vb.state = VIDEOBUF_PREPARED; |
262 | return 0; | 265 | return 0; |
263 | 266 | ||
264 | fail: | 267 | fail: |
265 | free_buffer(vq, buf); | 268 | free_buffer(vq, buf); |
266 | return rc; | 269 | return rc; |
267 | } | 270 | } |
@@ -285,20 +288,15 @@ static void vbi_buffer_release(struct videobuf_queue *vq, | |||
285 | { | 288 | { |
286 | struct cx231xx_buffer *buf = | 289 | struct cx231xx_buffer *buf = |
287 | container_of(vb, struct cx231xx_buffer, vb); | 290 | container_of(vb, struct cx231xx_buffer, vb); |
288 | /* | ||
289 | struct cx231xx_fh *fh = vq->priv_data; | ||
290 | struct cx231xx *dev = (struct cx231xx *)fh->dev; | ||
291 | 291 | ||
292 | cx231xx_info(DRIVER_NAME "cx231xx: called vbi_buffer_release\n"); | ||
293 | */ | ||
294 | 292 | ||
295 | free_buffer(vq, buf); | 293 | free_buffer(vq, buf); |
296 | } | 294 | } |
297 | 295 | ||
298 | struct videobuf_queue_ops cx231xx_vbi_qops = { | 296 | struct videobuf_queue_ops cx231xx_vbi_qops = { |
299 | .buf_setup = vbi_buffer_setup, | 297 | .buf_setup = vbi_buffer_setup, |
300 | .buf_prepare = vbi_buffer_prepare, | 298 | .buf_prepare = vbi_buffer_prepare, |
301 | .buf_queue = vbi_buffer_queue, | 299 | .buf_queue = vbi_buffer_queue, |
302 | .buf_release = vbi_buffer_release, | 300 | .buf_release = vbi_buffer_release, |
303 | }; | 301 | }; |
304 | 302 | ||
@@ -387,7 +385,6 @@ void cx231xx_uninit_vbi_isoc(struct cx231xx *dev) | |||
387 | 385 | ||
388 | cx231xx_capture_start(dev, 0, Vbi); | 386 | cx231xx_capture_start(dev, 0, Vbi); |
389 | } | 387 | } |
390 | |||
391 | EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc); | 388 | EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc); |
392 | 389 | ||
393 | /* | 390 | /* |
@@ -395,8 +392,8 @@ EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc); | |||
395 | */ | 392 | */ |
396 | int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | 393 | int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, |
397 | int num_bufs, int max_pkt_size, | 394 | int num_bufs, int max_pkt_size, |
398 | int (*isoc_copy) (struct cx231xx * dev, | 395 | int (*isoc_copy) (struct cx231xx *dev, |
399 | struct urb * urb)) | 396 | struct urb *urb)) |
400 | { | 397 | { |
401 | struct cx231xx_dmaqueue *dma_q = &dev->vbi_mode.vidq; | 398 | struct cx231xx_dmaqueue *dma_q = &dev->vbi_mode.vidq; |
402 | int i; | 399 | int i; |
@@ -427,8 +424,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | |||
427 | for (i = 0; i < 8; i++) | 424 | for (i = 0; i < 8; i++) |
428 | dma_q->partial_buf[i] = 0; | 425 | dma_q->partial_buf[i] = 0; |
429 | 426 | ||
430 | dev->vbi_mode.isoc_ctl.urb = | 427 | dev->vbi_mode.isoc_ctl.urb = kzalloc(sizeof(void *) * num_bufs, |
431 | kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); | 428 | GFP_KERNEL); |
432 | if (!dev->vbi_mode.isoc_ctl.urb) { | 429 | if (!dev->vbi_mode.isoc_ctl.urb) { |
433 | cx231xx_errdev("cannot alloc memory for usb buffers\n"); | 430 | cx231xx_errdev("cannot alloc memory for usb buffers\n"); |
434 | return -ENOMEM; | 431 | return -ENOMEM; |
@@ -466,7 +463,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | |||
466 | cx231xx_err(DRIVER_NAME | 463 | cx231xx_err(DRIVER_NAME |
467 | ": unable to allocate %i bytes for transfer" | 464 | ": unable to allocate %i bytes for transfer" |
468 | " buffer %i%s\n", sb_size, i, | 465 | " buffer %i%s\n", sb_size, i, |
469 | in_interrupt()? " while in int" : ""); | 466 | in_interrupt() ? " while in int" : ""); |
470 | cx231xx_uninit_vbi_isoc(dev); | 467 | cx231xx_uninit_vbi_isoc(dev); |
471 | return -ENOMEM; | 468 | return -ENOMEM; |
472 | } | 469 | } |
@@ -495,11 +492,10 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | |||
495 | 492 | ||
496 | return 0; | 493 | return 0; |
497 | } | 494 | } |
498 | |||
499 | EXPORT_SYMBOL_GPL(cx231xx_init_vbi_isoc); | 495 | EXPORT_SYMBOL_GPL(cx231xx_init_vbi_isoc); |
500 | 496 | ||
501 | u32 cx231xx_get_vbi_line(struct cx231xx * dev, struct cx231xx_dmaqueue * dma_q, | 497 | u32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
502 | u8 sav_eav, u8 * p_buffer, u32 buffer_size) | 498 | u8 sav_eav, u8 *p_buffer, u32 buffer_size) |
503 | { | 499 | { |
504 | u32 bytes_copied = 0; | 500 | u32 bytes_copied = 0; |
505 | int current_field = -1; | 501 | int current_field = -1; |
@@ -550,15 +546,14 @@ static inline void vbi_buffer_filled(struct cx231xx *dev, | |||
550 | } | 546 | } |
551 | 547 | ||
552 | u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 548 | u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
553 | u8 * p_line, u32 length, int field_number) | 549 | u8 *p_line, u32 length, int field_number) |
554 | { | 550 | { |
555 | u32 bytes_to_copy; | 551 | u32 bytes_to_copy; |
556 | struct cx231xx_buffer *buf; | 552 | struct cx231xx_buffer *buf; |
557 | u32 _line_size = dev->width * 2; | 553 | u32 _line_size = dev->width * 2; |
558 | 554 | ||
559 | if (dma_q->current_field != field_number) { | 555 | if (dma_q->current_field != field_number) |
560 | cx231xx_reset_vbi_buffer(dev, dma_q); | 556 | cx231xx_reset_vbi_buffer(dev, dma_q); |
561 | } | ||
562 | 557 | ||
563 | /* get the buffer pointer */ | 558 | /* get the buffer pointer */ |
564 | buf = dev->vbi_mode.isoc_ctl.buf; | 559 | buf = dev->vbi_mode.isoc_ctl.buf; |
@@ -651,7 +646,6 @@ void cx231xx_reset_vbi_buffer(struct cx231xx *dev, | |||
651 | buf = dev->vbi_mode.isoc_ctl.buf; | 646 | buf = dev->vbi_mode.isoc_ctl.buf; |
652 | 647 | ||
653 | if (buf == NULL) { | 648 | if (buf == NULL) { |
654 | |||
655 | /* first try to get the buffer */ | 649 | /* first try to get the buffer */ |
656 | get_next_vbi_buf(dma_q, &buf); | 650 | get_next_vbi_buf(dma_q, &buf); |
657 | 651 | ||
@@ -664,7 +658,7 @@ void cx231xx_reset_vbi_buffer(struct cx231xx *dev, | |||
664 | } | 658 | } |
665 | 659 | ||
666 | int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 660 | int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
667 | u8 * p_buffer, u32 bytes_to_copy) | 661 | u8 *p_buffer, u32 bytes_to_copy) |
668 | { | 662 | { |
669 | u8 *p_out_buffer = NULL; | 663 | u8 *p_out_buffer = NULL; |
670 | u32 current_line_bytes_copied = 0; | 664 | u32 current_line_bytes_copied = 0; |
@@ -675,9 +669,8 @@ int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | |||
675 | 669 | ||
676 | buf = dev->vbi_mode.isoc_ctl.buf; | 670 | buf = dev->vbi_mode.isoc_ctl.buf; |
677 | 671 | ||
678 | if (buf == NULL) { | 672 | if (buf == NULL) |
679 | return -1; | 673 | return -EINVAL; |
680 | } | ||
681 | 674 | ||
682 | p_out_buffer = videobuf_to_vmalloc(&buf->vb); | 675 | p_out_buffer = videobuf_to_vmalloc(&buf->vb); |
683 | 676 | ||
@@ -686,23 +679,22 @@ int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | |||
686 | _line_size - dma_q->bytes_left_in_line; | 679 | _line_size - dma_q->bytes_left_in_line; |
687 | } | 680 | } |
688 | 681 | ||
689 | offset = | 682 | offset = (dma_q->lines_completed * _line_size) + |
690 | (dma_q->lines_completed * _line_size) + current_line_bytes_copied; | 683 | current_line_bytes_copied; |
691 | 684 | ||
692 | /* prepare destination address */ | 685 | /* prepare destination address */ |
693 | startwrite = p_out_buffer + offset; | 686 | startwrite = p_out_buffer + offset; |
694 | 687 | ||
695 | lencopy = | 688 | lencopy = dma_q->bytes_left_in_line > bytes_to_copy ? |
696 | dma_q->bytes_left_in_line > | 689 | bytes_to_copy : dma_q->bytes_left_in_line; |
697 | bytes_to_copy ? bytes_to_copy : dma_q->bytes_left_in_line; | ||
698 | 690 | ||
699 | memcpy(startwrite, p_buffer, lencopy); | 691 | memcpy(startwrite, p_buffer, lencopy); |
700 | 692 | ||
701 | return 0; | 693 | return 0; |
702 | } | 694 | } |
703 | 695 | ||
704 | u8 cx231xx_is_vbi_buffer_done(struct cx231xx * dev, | 696 | u8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev, |
705 | struct cx231xx_dmaqueue * dma_q) | 697 | struct cx231xx_dmaqueue *dma_q) |
706 | { | 698 | { |
707 | u32 height = 0; | 699 | u32 height = 0; |
708 | 700 | ||