mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
dma-buf: cleanup dma_buf_export() to make it easily extensible
At present, dma_buf_export() takes a series of parameters, which makes it difficult to add any new parameters for exporters, if required. Make it simpler by moving all these parameters into a struct, and pass the struct * as parameter to dma_buf_export(). While at it, unite dma_buf_export_named() with dma_buf_export(), and change all callers accordingly. Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
This commit is contained in:
parent
646da63172
commit
d8fbe341be
15 changed files with 152 additions and 63 deletions
|
@ -162,6 +162,33 @@ struct dma_buf_attachment {
|
|||
void *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dma_buf_export_info - holds information needed to export a dma_buf
|
||||
* @exp_name: name of the exporting module - useful for debugging.
|
||||
* @ops: Attach allocator-defined dma buf ops to the new buffer
|
||||
* @size: Size of the buffer
|
||||
* @flags: mode flags for the file
|
||||
* @resv: reservation-object, NULL to allocate default one
|
||||
* @priv: Attach private data of allocator to this buffer
|
||||
*
|
||||
* This structure holds the information required to export the buffer. Used
|
||||
* with dma_buf_export() only.
|
||||
*/
|
||||
struct dma_buf_export_info {
|
||||
const char *exp_name;
|
||||
const struct dma_buf_ops *ops;
|
||||
size_t size;
|
||||
int flags;
|
||||
struct reservation_object *resv;
|
||||
void *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* helper macro for exporters; zeros and fills in most common values
|
||||
*/
|
||||
#define DEFINE_DMA_BUF_EXPORT_INFO(a) \
|
||||
struct dma_buf_export_info a = { .exp_name = KBUILD_MODNAME }
|
||||
|
||||
/**
|
||||
* get_dma_buf - convenience wrapper for get_file.
|
||||
* @dmabuf: [in] pointer to dma_buf
|
||||
|
@ -181,12 +208,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
|
|||
void dma_buf_detach(struct dma_buf *dmabuf,
|
||||
struct dma_buf_attachment *dmabuf_attach);
|
||||
|
||||
struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops,
|
||||
size_t size, int flags, const char *,
|
||||
struct reservation_object *);
|
||||
|
||||
#define dma_buf_export(priv, ops, size, flags, resv) \
|
||||
dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME, resv)
|
||||
struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info);
|
||||
|
||||
int dma_buf_fd(struct dma_buf *dmabuf, int flags);
|
||||
struct dma_buf *dma_buf_get(int fd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue