#include <linux/module.h>
#include <linux/mm.h>
#include <linux/refcount.h>
#include <linux/scatterlist.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-memops.h>
#include <media/videobuf2-dma-sg.h>
static int debug;
module_param(debug, int, 0644);
#define dprintk(level, fmt, arg...) …
struct vb2_dma_sg_buf { … };
static void vb2_dma_sg_put(void *buf_priv);
static int vb2_dma_sg_alloc_compacted(struct vb2_dma_sg_buf *buf,
gfp_t gfp_flags)
{ … }
static void *vb2_dma_sg_alloc(struct vb2_buffer *vb, struct device *dev,
unsigned long size)
{ … }
static void vb2_dma_sg_put(void *buf_priv)
{ … }
static void vb2_dma_sg_prepare(void *buf_priv)
{ … }
static void vb2_dma_sg_finish(void *buf_priv)
{ … }
static void *vb2_dma_sg_get_userptr(struct vb2_buffer *vb, struct device *dev,
unsigned long vaddr, unsigned long size)
{ … }
static void vb2_dma_sg_put_userptr(void *buf_priv)
{ … }
static void *vb2_dma_sg_vaddr(struct vb2_buffer *vb, void *buf_priv)
{ … }
static unsigned int vb2_dma_sg_num_users(void *buf_priv)
{ … }
static int vb2_dma_sg_mmap(void *buf_priv, struct vm_area_struct *vma)
{ … }
struct vb2_dma_sg_attachment { … };
static int vb2_dma_sg_dmabuf_ops_attach(struct dma_buf *dbuf,
struct dma_buf_attachment *dbuf_attach)
{ … }
static void vb2_dma_sg_dmabuf_ops_detach(struct dma_buf *dbuf,
struct dma_buf_attachment *db_attach)
{ … }
static struct sg_table *vb2_dma_sg_dmabuf_ops_map(
struct dma_buf_attachment *db_attach, enum dma_data_direction dma_dir)
{ … }
static void vb2_dma_sg_dmabuf_ops_unmap(struct dma_buf_attachment *db_attach,
struct sg_table *sgt, enum dma_data_direction dma_dir)
{ … }
static void vb2_dma_sg_dmabuf_ops_release(struct dma_buf *dbuf)
{ … }
static int
vb2_dma_sg_dmabuf_ops_begin_cpu_access(struct dma_buf *dbuf,
enum dma_data_direction direction)
{ … }
static int
vb2_dma_sg_dmabuf_ops_end_cpu_access(struct dma_buf *dbuf,
enum dma_data_direction direction)
{ … }
static int vb2_dma_sg_dmabuf_ops_vmap(struct dma_buf *dbuf,
struct iosys_map *map)
{ … }
static int vb2_dma_sg_dmabuf_ops_mmap(struct dma_buf *dbuf,
struct vm_area_struct *vma)
{ … }
static const struct dma_buf_ops vb2_dma_sg_dmabuf_ops = …;
static struct dma_buf *vb2_dma_sg_get_dmabuf(struct vb2_buffer *vb,
void *buf_priv,
unsigned long flags)
{ … }
static int vb2_dma_sg_map_dmabuf(void *mem_priv)
{ … }
static void vb2_dma_sg_unmap_dmabuf(void *mem_priv)
{ … }
static void vb2_dma_sg_detach_dmabuf(void *mem_priv)
{ … }
static void *vb2_dma_sg_attach_dmabuf(struct vb2_buffer *vb, struct device *dev,
struct dma_buf *dbuf, unsigned long size)
{ … }
static void *vb2_dma_sg_cookie(struct vb2_buffer *vb, void *buf_priv)
{ … }
const struct vb2_mem_ops vb2_dma_sg_memops = …;
EXPORT_SYMBOL_GPL(…);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);