aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-24 13:05:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-24 13:05:39 -0400
commitb3f4ef0bf21da37e4dfc1cdfa0288ba39186fb56 (patch)
tree7239d8ee8302e3bb7ff74d9bc6195ab6bb52295c /include/linux
parentd6a4c0e5d3d433ef296f8f417e835329a834a256 (diff)
parent72449cb47b0104c32ff8fb9380ade9113375d8d1 (diff)
Merge tag 'dma-buf-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/sumits/dma-buf
Pull dma-buf updates from Sumit Semwal: "Minor cleanup only; this could've gone in for the 4.0 merge window, but for a copy-paste stupidity from me. It has been in the for-next since then, and no issues reported. - cleanup of dma_buf_export() - correction of copy-paste stupidity while doing the cleanup" * tag 'dma-buf-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/sumits/dma-buf: staging: android: ion: fix wrong init of dma_buf_export_info dma-buf: cleanup dma_buf_export() to make it easily extensible
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/dma-buf.h34
1 files changed, 28 insertions, 6 deletions
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 694e1fe1c4b4..2f0b431b73e0 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -163,6 +163,33 @@ struct dma_buf_attachment {
163}; 163};
164 164
165/** 165/**
166 * struct dma_buf_export_info - holds information needed to export a dma_buf
167 * @exp_name: name of the exporting module - useful for debugging.
168 * @ops: Attach allocator-defined dma buf ops to the new buffer
169 * @size: Size of the buffer
170 * @flags: mode flags for the file
171 * @resv: reservation-object, NULL to allocate default one
172 * @priv: Attach private data of allocator to this buffer
173 *
174 * This structure holds the information required to export the buffer. Used
175 * with dma_buf_export() only.
176 */
177struct dma_buf_export_info {
178 const char *exp_name;
179 const struct dma_buf_ops *ops;
180 size_t size;
181 int flags;
182 struct reservation_object *resv;
183 void *priv;
184};
185
186/**
187 * helper macro for exporters; zeros and fills in most common values
188 */
189#define DEFINE_DMA_BUF_EXPORT_INFO(a) \
190 struct dma_buf_export_info a = { .exp_name = KBUILD_MODNAME }
191
192/**
166 * get_dma_buf - convenience wrapper for get_file. 193 * get_dma_buf - convenience wrapper for get_file.
167 * @dmabuf: [in] pointer to dma_buf 194 * @dmabuf: [in] pointer to dma_buf
168 * 195 *
@@ -181,12 +208,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
181void dma_buf_detach(struct dma_buf *dmabuf, 208void dma_buf_detach(struct dma_buf *dmabuf,
182 struct dma_buf_attachment *dmabuf_attach); 209 struct dma_buf_attachment *dmabuf_attach);
183 210
184struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, 211struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info);
185 size_t size, int flags, const char *,
186 struct reservation_object *);
187
188#define dma_buf_export(priv, ops, size, flags, resv) \
189 dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME, resv)
190 212
191int dma_buf_fd(struct dma_buf *dmabuf, int flags); 213int dma_buf_fd(struct dma_buf *dmabuf, int flags);
192struct dma_buf *dma_buf_get(int fd); 214struct dma_buf *dma_buf_get(int fd);