diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-24 13:05:39 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-24 13:05:39 -0400 |
| commit | b3f4ef0bf21da37e4dfc1cdfa0288ba39186fb56 (patch) | |
| tree | 7239d8ee8302e3bb7ff74d9bc6195ab6bb52295c /include/linux | |
| parent | d6a4c0e5d3d433ef296f8f417e835329a834a256 (diff) | |
| parent | 72449cb47b0104c32ff8fb9380ade9113375d8d1 (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.h | 34 |
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 | */ | ||
| 177 | struct 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, | |||
| 181 | void dma_buf_detach(struct dma_buf *dmabuf, | 208 | void dma_buf_detach(struct dma_buf *dmabuf, |
| 182 | struct dma_buf_attachment *dmabuf_attach); | 209 | struct dma_buf_attachment *dmabuf_attach); |
| 183 | 210 | ||
| 184 | struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, | 211 | struct 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 | ||
| 191 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); | 213 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); |
| 192 | struct dma_buf *dma_buf_get(int fd); | 214 | struct dma_buf *dma_buf_get(int fd); |
