dma-buf: make map_atomic and map function pointers optional
Subsystems (2)
PATCH 1/1 dma-buf: make map_atomic and map function pointers optional
So drivers don't need dummy functions just returning NULL.
Cc Daniel Vetter <[email protected]>
Signed-off-by Gerd Hoffmann <[email protected]>
--- include/linux/dma-buf.h | 4 ++-- drivers/dma-buf/dma-buf.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-)
include/linux/dma-buf.h +2 -2
@@ -39,12 +39,12 @@ struct dma_buf_attachment;/** * struct dma_buf_ops - operations possible on struct dma_buf -* @map_atomic: maps a page from the buffer into kernel address +* @map_atomic: [optional] maps a page from the buffer into kernel address * space, users may not block until the subsequent unmap call. * This callback must not sleep. * @unmap_atomic: [optional] unmaps a atomically mapped page from the buffer. * This Callback must not sleep. -* @map: maps a page from the buffer into kernel address space. +* @map: [optional] maps a page from the buffer into kernel address space. * @unmap: [optional] unmaps a page from the buffer. * @vmap: [optional] creates a virtual mapping for the buffer into kernel * address space. Same restrictions as for vmap and friends apply.
drivers/dma-buf/dma-buf.c +4 -0
@@ -872,6 +872,8 @@ void *dma_buf_kmap_atomic(struct dma_buf *dmabuf, unsigned long page_num) {WARN_ON (!dmabuf); +if (!dmabuf->ops->map_atomic) +return NULL ;return dmabuf->ops->map_atomic (dmabuf, page_num); }EXPORT_SYMBOL_GPL (dma_buf_kmap_atomic);
@@ -907,6 +909,8 @@ void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long page_num) {WARN_ON (!dmabuf); +if (!dmabuf->ops->map) +return NULL ;return dmabuf->ops->map (dmabuf, page_num); }EXPORT_SYMBOL_GPL (dma_buf_kmap);
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Gerd Hoffmann
So drivers don't need dummy functions just returning NULL.
Cc Daniel Vetter <[email protected]>Signed-off-by Gerd Hoffmann <[email protected]>
Reviewed-by Daniel Vetter <[email protected]>
Please push to drm-misc-next (maybe after a few more days of waiting for feedback).
-Daniel
Quoted 49 lines
--- include/linux/dma-buf.h | 4 ++-- drivers/dma-buf/dma-buf.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-)include/linux/dma-buf.h +2
-2@@ -39,12 +39,12 @@ struct dma_buf_attachment;/** * struct dma_buf_ops - operations possible on struct dma_buf -* @map_atomic: maps a page from the buffer into kernel address +* @map_atomic: [optional] maps a page from the buffer into kernel address * space, users may not block until the subsequent unmap call. * This callback must not sleep. * @unmap_atomic: [optional] unmaps a atomically mapped page from the buffer. * This Callback must not sleep. -* @map: maps a page from the buffer into kernel address space. +* @map: [optional] maps a page from the buffer into kernel address space. * @unmap: [optional] unmaps a page from the buffer. * @vmap: [optional] creates a virtual mapping for the buffer into kernel * address space. Same restrictions as for vmap and friends apply. drivers/dma-buf/dma-buf.c +4
-0@@ -872,6 +872,8 @@ void *dma_buf_kmap_atomic(struct dma_buf *dmabuf, unsigned long page_num) {WARN_ON (!dmabuf); +if (!dmabuf->ops->map_atomic) +return NULL ;return dmabuf->ops->map_atomic (dmabuf, page_num); }EXPORT_SYMBOL_GPL (dma_buf_kmap_atomic);@@ -907,6 +909,8 @@ void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long page_num) {WARN_ON (!dmabuf); +if (!dmabuf->ops->map) +return NULL ;return dmabuf->ops->map (dmabuf, page_num); }EXPORT_SYMBOL_GPL (dma_buf_kmap);Signature · 1 line
2.9.3
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Quoted 42 lines · Gerd Hoffmann
So drivers don't need dummy functions just returning NULL.
Cc Daniel Vetter <[email protected]>Signed-off-by Gerd Hoffmann <[email protected]>--- include/linux/dma-buf.h | 4 ++-- drivers/dma-buf/dma-buf.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-)include/linux/dma-buf.h +2
-2@@ -39,12 +39,12 @@ struct dma_buf_attachment;/** * struct dma_buf_ops - operations possible on struct dma_buf -* @map_atomic: maps a page from the buffer into kernel address +* @map_atomic: [optional] maps a page from the buffer into kernel address * space, users may not block until the subsequent unmap call. * This callback must not sleep. * @unmap_atomic: [optional] unmaps a atomically mapped page from the buffer. * This Callback must not sleep. -* @map: maps a page from the buffer into kernel address space. +* @map: [optional] maps a page from the buffer into kernel address space. * @unmap: [optional] unmaps a page from the buffer. * @vmap: [optional] creates a virtual mapping for the buffer into kernel * address space. Same restrictions as for vmap and friends apply. drivers/dma-buf/dma-buf.c +2
-0@@ -872,6 +872,8 @@ void *dma_buf_kmap_atomic(struct dma_buf *dmabuf, unsigned long page_num) {WARN_ON (!dmabuf); +if (!dmabuf->ops->map_atomic) +return NULL ;return dmabuf->ops->map_atomic (dmabuf, page_num); }EXPORT_SYMBOL_GPL (dma_buf_kmap_atomic);
drivers/dma-buf/dma-buf.c void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long page_num) · line 916
Quoted 8 lines
drivers/dma-buf/dma-buf.c +2
-0@@ -907,6 +909,8 @@ void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long page_num) {WARN_ON (!dmabuf); +if (!dmabuf->ops->map) +return NULL ;return dmabuf->ops->map (dmabuf, page_num); }EXPORT_SYMBOL_GPL (dma_buf_kmap);
Reviewed-by Oleksandr Andrushchenko <[email protected]>
Quoted 10 lines · Daniel Vetter
Quoted 4 lines · Gerd Hoffmann
So drivers don't need dummy functions just returning NULL.
Cc Daniel Vetter <[email protected]>Signed-off-by Gerd Hoffmann <[email protected]>Reviewed-by Daniel Vetter <[email protected]>Please push to drm-misc-next (maybe after a few more days of waiting for feedback).
Done.
cheers,
Gerd