void cx18_dma_free(struct videobuf_queue *q, struct cx18_stream *s, struct cx18_videobuf_buffer *buf) { videobuf_waiton(q, &buf->vb, 0, 0); videobuf_vmalloc_free(&buf->vb); buf->vb.state = VIDEOBUF_NEEDS_INIT; }
static void free_buffer(struct videobuf_queue *vq, struct em28xx_buffer *buf) { struct em28xx_fh *fh = vq->priv_data; struct em28xx *dev = fh->dev; unsigned long flags = 0; if (in_interrupt()) BUG(); spin_lock_irqsave(&dev->slock, flags); if (dev->isoc_ctl.vbi_buf == buf) dev->isoc_ctl.vbi_buf = NULL; spin_unlock_irqrestore(&dev->slock, flags); videobuf_vmalloc_free(&buf->vb); buf->vb.state = VIDEOBUF_NEEDS_INIT; }
/* This is called *without* dev->slock held; please keep it that way */ static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf) { struct cx231xx_fh *fh = vq->priv_data; struct cx231xx *dev = fh->dev; unsigned long flags = 0; BUG_ON(in_interrupt()); /* We used to wait for the buffer to finish here, but this didn't work because, as we were keeping the state as VIDEOBUF_QUEUED, videobuf_queue_cancel marked it as finished for us. (Also, it could wedge forever if the hardware was misconfigured.) This should be safe; by the time we get here, the buffer isn't queued anymore. If we ever start marking the buffers as VIDEOBUF_ACTIVE, it won't be, though. */ spin_lock_irqsave(&dev->vbi_mode.slock, flags); if (dev->vbi_mode.bulk_ctl.buf == buf) dev->vbi_mode.bulk_ctl.buf = NULL; spin_unlock_irqrestore(&dev->vbi_mode.slock, flags); videobuf_vmalloc_free(&buf->vb); buf->vb.state = VIDEOBUF_NEEDS_INIT; }
/*APP不再使用队列的时候调用 *1. */ static void myvivi_buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb) { videobuf_vmalloc_free(vb); vb->state = VIDEOBUF_NEEDS_INIT; }