Commit 948a49aa authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[media] em28xx: use common function for video and vbi buffer completion

Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 24a6d849
...@@ -154,37 +154,15 @@ static struct v4l2_queryctrl ac97_qctrl[] = { ...@@ -154,37 +154,15 @@ static struct v4l2_queryctrl ac97_qctrl[] = {
------------------------------------------------------------------*/ ------------------------------------------------------------------*/
/* /*
* Announces that a buffer were filled and request the next * Finish the current buffer
*/ */
static inline void buffer_filled(struct em28xx *dev, static inline void finish_buffer(struct em28xx *dev,
struct em28xx_dmaqueue *dma_q, struct em28xx_buffer *buf)
struct em28xx_buffer *buf)
{ {
/* Advice that buffer was filled */
em28xx_isocdbg("[%p/%d] wakeup\n", buf, buf->vb.i); em28xx_isocdbg("[%p/%d] wakeup\n", buf, buf->vb.i);
buf->vb.state = VIDEOBUF_DONE; buf->vb.state = VIDEOBUF_DONE;
buf->vb.field_count++; buf->vb.field_count++;
v4l2_get_timestamp(&buf->vb.ts); v4l2_get_timestamp(&buf->vb.ts);
dev->usb_ctl.vid_buf = NULL;
list_del(&buf->vb.queue);
wake_up(&buf->vb.done);
}
static inline void vbi_buffer_filled(struct em28xx *dev,
struct em28xx_dmaqueue *dma_q,
struct em28xx_buffer *buf)
{
/* Advice that buffer was filled */
em28xx_isocdbg("[%p/%d] wakeup\n", buf, buf->vb.i);
buf->vb.state = VIDEOBUF_DONE;
buf->vb.field_count++;
v4l2_get_timestamp(&buf->vb.ts);
dev->usb_ctl.vbi_buf = NULL;
list_del(&buf->vb.queue); list_del(&buf->vb.queue);
wake_up(&buf->vb.done); wake_up(&buf->vb.done);
} }
...@@ -485,9 +463,7 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb) ...@@ -485,9 +463,7 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
if (dev->vbi_read == 0 && dev->top_field) { if (dev->vbi_read == 0 && dev->top_field) {
/* Brand new frame */ /* Brand new frame */
if (vbi_buf != NULL) if (vbi_buf != NULL)
vbi_buffer_filled(dev, finish_buffer(dev, vbi_buf);
vbi_dma_q,
vbi_buf);
vbi_buf = get_next_buf(dev, vbi_dma_q); vbi_buf = get_next_buf(dev, vbi_dma_q);
dev->usb_ctl.vbi_buf = vbi_buf; dev->usb_ctl.vbi_buf = vbi_buf;
if (vbi_buf == NULL) if (vbi_buf == NULL)
...@@ -524,7 +500,7 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb) ...@@ -524,7 +500,7 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
dev->capture_type = 2; dev->capture_type = 2;
if (dev->progressive || dev->top_field) { if (dev->progressive || dev->top_field) {
if (buf != NULL) if (buf != NULL)
buffer_filled(dev, dma_q, buf); finish_buffer(dev, buf);
buf = get_next_buf(dev, dma_q); buf = get_next_buf(dev, dma_q);
dev->usb_ctl.vid_buf = buf; dev->usb_ctl.vid_buf = buf;
if (buf == NULL) if (buf == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment