diff options
Diffstat (limited to 'drivers/media/usb/hackrf/hackrf.c')
-rw-r--r-- | drivers/media/usb/hackrf/hackrf.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index fd1fa412e094..e1d4d16ade05 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <media/v4l2-ioctl.h> | 21 | #include <media/v4l2-ioctl.h> |
22 | #include <media/v4l2-ctrls.h> | 22 | #include <media/v4l2-ctrls.h> |
23 | #include <media/v4l2-event.h> | 23 | #include <media/v4l2-event.h> |
24 | #include <media/videobuf2-v4l2.h> | ||
24 | #include <media/videobuf2-vmalloc.h> | 25 | #include <media/videobuf2-vmalloc.h> |
25 | 26 | ||
26 | /* HackRF USB API commands (from HackRF Library) */ | 27 | /* HackRF USB API commands (from HackRF Library) */ |
@@ -85,7 +86,8 @@ static const unsigned int NUM_FORMATS = ARRAY_SIZE(formats); | |||
85 | 86 | ||
86 | /* intermediate buffers with raw data from the USB device */ | 87 | /* intermediate buffers with raw data from the USB device */ |
87 | struct hackrf_frame_buf { | 88 | struct hackrf_frame_buf { |
88 | struct vb2_buffer vb; /* common v4l buffer stuff -- must be first */ | 89 | /* common v4l buffer stuff -- must be first */ |
90 | struct vb2_v4l2_buffer vb; | ||
89 | struct list_head list; | 91 | struct list_head list; |
90 | }; | 92 | }; |
91 | 93 | ||
@@ -287,13 +289,13 @@ static void hackrf_urb_complete(struct urb *urb) | |||
287 | } | 289 | } |
288 | 290 | ||
289 | /* fill framebuffer */ | 291 | /* fill framebuffer */ |
290 | ptr = vb2_plane_vaddr(&fbuf->vb, 0); | 292 | ptr = vb2_plane_vaddr(&fbuf->vb.vb2_buf, 0); |
291 | len = hackrf_convert_stream(dev, ptr, urb->transfer_buffer, | 293 | len = hackrf_convert_stream(dev, ptr, urb->transfer_buffer, |
292 | urb->actual_length); | 294 | urb->actual_length); |
293 | vb2_set_plane_payload(&fbuf->vb, 0, len); | 295 | vb2_set_plane_payload(&fbuf->vb.vb2_buf, 0, len); |
294 | v4l2_get_timestamp(&fbuf->vb.v4l2_buf.timestamp); | 296 | v4l2_get_timestamp(&fbuf->vb.timestamp); |
295 | fbuf->vb.v4l2_buf.sequence = dev->sequence++; | 297 | fbuf->vb.sequence = dev->sequence++; |
296 | vb2_buffer_done(&fbuf->vb, VB2_BUF_STATE_DONE); | 298 | vb2_buffer_done(&fbuf->vb.vb2_buf, VB2_BUF_STATE_DONE); |
297 | } | 299 | } |
298 | skip: | 300 | skip: |
299 | usb_submit_urb(urb, GFP_ATOMIC); | 301 | usb_submit_urb(urb, GFP_ATOMIC); |
@@ -437,7 +439,7 @@ static void hackrf_cleanup_queued_bufs(struct hackrf_dev *dev) | |||
437 | buf = list_entry(dev->queued_bufs.next, | 439 | buf = list_entry(dev->queued_bufs.next, |
438 | struct hackrf_frame_buf, list); | 440 | struct hackrf_frame_buf, list); |
439 | list_del(&buf->list); | 441 | list_del(&buf->list); |
440 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); | 442 | vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); |
441 | } | 443 | } |
442 | spin_unlock_irqrestore(&dev->queued_bufs_lock, flags); | 444 | spin_unlock_irqrestore(&dev->queued_bufs_lock, flags); |
443 | } | 445 | } |
@@ -483,9 +485,10 @@ static int hackrf_queue_setup(struct vb2_queue *vq, | |||
483 | 485 | ||
484 | static void hackrf_buf_queue(struct vb2_buffer *vb) | 486 | static void hackrf_buf_queue(struct vb2_buffer *vb) |
485 | { | 487 | { |
488 | struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); | ||
486 | struct hackrf_dev *dev = vb2_get_drv_priv(vb->vb2_queue); | 489 | struct hackrf_dev *dev = vb2_get_drv_priv(vb->vb2_queue); |
487 | struct hackrf_frame_buf *buf = | 490 | struct hackrf_frame_buf *buf = |
488 | container_of(vb, struct hackrf_frame_buf, vb); | 491 | container_of(vbuf, struct hackrf_frame_buf, vb); |
489 | unsigned long flags; | 492 | unsigned long flags; |
490 | 493 | ||
491 | spin_lock_irqsave(&dev->queued_bufs_lock, flags); | 494 | spin_lock_irqsave(&dev->queued_bufs_lock, flags); |
@@ -539,7 +542,8 @@ err: | |||
539 | 542 | ||
540 | list_for_each_entry_safe(buf, tmp, &dev->queued_bufs, list) { | 543 | list_for_each_entry_safe(buf, tmp, &dev->queued_bufs, list) { |
541 | list_del(&buf->list); | 544 | list_del(&buf->list); |
542 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED); | 545 | vb2_buffer_done(&buf->vb.vb2_buf, |
546 | VB2_BUF_STATE_QUEUED); | ||
543 | } | 547 | } |
544 | } | 548 | } |
545 | 549 | ||