Loading drivers/dma-buf/dma-buf.c +14 −0 Original line number Diff line number Diff line Loading @@ -1053,6 +1053,20 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr) } EXPORT_SYMBOL_GPL(dma_buf_vunmap); int dma_buf_get_flags(struct dma_buf *dmabuf, unsigned long *flags) { int ret = 0; if (WARN_ON(!dmabuf)) return -EINVAL; if (dmabuf->ops->get_flags) ret = dmabuf->ops->get_flags(dmabuf, flags); return ret; } EXPORT_SYMBOL(dma_buf_get_flags); #ifdef CONFIG_DEBUG_FS static int dma_buf_debug_show(struct seq_file *s, void *unused) { Loading drivers/staging/android/ion/ion.c +10 −0 Original line number Diff line number Diff line Loading @@ -426,6 +426,15 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf, return 0; } static int ion_dma_buf_get_flags(struct dma_buf *dmabuf, unsigned long *flags) { struct ion_buffer *buffer = dmabuf->priv; *flags = buffer->flags; return 0; } static const struct dma_buf_ops dma_buf_ops = { .map_dma_buf = ion_map_dma_buf, .unmap_dma_buf = ion_unmap_dma_buf, Loading @@ -439,6 +448,7 @@ static const struct dma_buf_ops dma_buf_ops = { .unmap_atomic = ion_dma_buf_kunmap, .map = ion_dma_buf_kmap, .unmap = ion_dma_buf_kunmap, .get_flags = ion_dma_buf_get_flags, }; struct dma_buf *ion_alloc_dmabuf(size_t len, unsigned int heap_id_mask, Loading include/linux/dma-buf.h +15 −0 Original line number Diff line number Diff line Loading @@ -250,6 +250,20 @@ struct dma_buf_ops { void *(*vmap)(struct dma_buf *); void (*vunmap)(struct dma_buf *, void *vaddr); /** * @get_flags: * * This is called by dma_buf_get_flags and is used to get the buffer's * flags. * This callback is optional. * * Returns: * * 0 on success or a negative error code on failure. On success flags * will be populated with the buffer's flags. */ int (*get_flags)(struct dma_buf *, unsigned long *flags); }; /** Loading Loading @@ -405,4 +419,5 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, unsigned long); void *dma_buf_vmap(struct dma_buf *); void dma_buf_vunmap(struct dma_buf *, void *vaddr); int dma_buf_get_flags(struct dma_buf *dma_buf, unsigned long *flags); #endif /* __DMA_BUF_H__ */ Loading
drivers/dma-buf/dma-buf.c +14 −0 Original line number Diff line number Diff line Loading @@ -1053,6 +1053,20 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr) } EXPORT_SYMBOL_GPL(dma_buf_vunmap); int dma_buf_get_flags(struct dma_buf *dmabuf, unsigned long *flags) { int ret = 0; if (WARN_ON(!dmabuf)) return -EINVAL; if (dmabuf->ops->get_flags) ret = dmabuf->ops->get_flags(dmabuf, flags); return ret; } EXPORT_SYMBOL(dma_buf_get_flags); #ifdef CONFIG_DEBUG_FS static int dma_buf_debug_show(struct seq_file *s, void *unused) { Loading
drivers/staging/android/ion/ion.c +10 −0 Original line number Diff line number Diff line Loading @@ -426,6 +426,15 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf, return 0; } static int ion_dma_buf_get_flags(struct dma_buf *dmabuf, unsigned long *flags) { struct ion_buffer *buffer = dmabuf->priv; *flags = buffer->flags; return 0; } static const struct dma_buf_ops dma_buf_ops = { .map_dma_buf = ion_map_dma_buf, .unmap_dma_buf = ion_unmap_dma_buf, Loading @@ -439,6 +448,7 @@ static const struct dma_buf_ops dma_buf_ops = { .unmap_atomic = ion_dma_buf_kunmap, .map = ion_dma_buf_kmap, .unmap = ion_dma_buf_kunmap, .get_flags = ion_dma_buf_get_flags, }; struct dma_buf *ion_alloc_dmabuf(size_t len, unsigned int heap_id_mask, Loading
include/linux/dma-buf.h +15 −0 Original line number Diff line number Diff line Loading @@ -250,6 +250,20 @@ struct dma_buf_ops { void *(*vmap)(struct dma_buf *); void (*vunmap)(struct dma_buf *, void *vaddr); /** * @get_flags: * * This is called by dma_buf_get_flags and is used to get the buffer's * flags. * This callback is optional. * * Returns: * * 0 on success or a negative error code on failure. On success flags * will be populated with the buffer's flags. */ int (*get_flags)(struct dma_buf *, unsigned long *flags); }; /** Loading Loading @@ -405,4 +419,5 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, unsigned long); void *dma_buf_vmap(struct dma_buf *); void dma_buf_vunmap(struct dma_buf *, void *vaddr); int dma_buf_get_flags(struct dma_buf *dma_buf, unsigned long *flags); #endif /* __DMA_BUF_H__ */