Skip to content
Snippets Groups Projects
Commit 94322d27 authored by Dmitry Osipenko's avatar Dmitry Osipenko
Browse files

dma-buf: Remove internal lock


The internal dma-buf lock isn't needed anymore because the updated
locking specification claims that dma-buf reservation must be locked
by importers, and thus, the internal data is already protected by the
reservation lock. Remove the obsoleted internal lock.

Acked-by: default avatarTomasz Figa <tfiga@chromium.org>
Signed-off-by: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
parent e8915bbc
No related branches found
No related tags found
No related merge requests found
...@@ -656,7 +656,6 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) ...@@ -656,7 +656,6 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
dmabuf->file = file; dmabuf->file = file;
mutex_init(&dmabuf->lock);
INIT_LIST_HEAD(&dmabuf->attachments); INIT_LIST_HEAD(&dmabuf->attachments);
mutex_lock(&db_list.lock); mutex_lock(&db_list.lock);
...@@ -1508,7 +1507,6 @@ int dma_buf_vmap_unlocked(struct dma_buf *dmabuf, struct iosys_map *map) ...@@ -1508,7 +1507,6 @@ int dma_buf_vmap_unlocked(struct dma_buf *dmabuf, struct iosys_map *map)
return -EINVAL; return -EINVAL;
dma_resv_lock(dmabuf->resv, NULL); dma_resv_lock(dmabuf->resv, NULL);
mutex_lock(&dmabuf->lock);
if (dmabuf->vmapping_counter) { if (dmabuf->vmapping_counter) {
dmabuf->vmapping_counter++; dmabuf->vmapping_counter++;
BUG_ON(iosys_map_is_null(&dmabuf->vmap_ptr)); BUG_ON(iosys_map_is_null(&dmabuf->vmap_ptr));
...@@ -1528,7 +1526,6 @@ int dma_buf_vmap_unlocked(struct dma_buf *dmabuf, struct iosys_map *map) ...@@ -1528,7 +1526,6 @@ int dma_buf_vmap_unlocked(struct dma_buf *dmabuf, struct iosys_map *map)
*map = dmabuf->vmap_ptr; *map = dmabuf->vmap_ptr;
out_unlock: out_unlock:
mutex_unlock(&dmabuf->lock);
dma_resv_unlock(dmabuf->resv); dma_resv_unlock(dmabuf->resv);
return ret; return ret;
} }
...@@ -1549,13 +1546,11 @@ void dma_buf_vunmap_unlocked(struct dma_buf *dmabuf, struct iosys_map *map) ...@@ -1549,13 +1546,11 @@ void dma_buf_vunmap_unlocked(struct dma_buf *dmabuf, struct iosys_map *map)
BUG_ON(!iosys_map_is_equal(&dmabuf->vmap_ptr, map)); BUG_ON(!iosys_map_is_equal(&dmabuf->vmap_ptr, map));
dma_resv_lock(dmabuf->resv, NULL); dma_resv_lock(dmabuf->resv, NULL);
mutex_lock(&dmabuf->lock);
if (--dmabuf->vmapping_counter == 0) { if (--dmabuf->vmapping_counter == 0) {
if (dmabuf->ops->vunmap) if (dmabuf->ops->vunmap)
dmabuf->ops->vunmap(dmabuf, map); dmabuf->ops->vunmap(dmabuf, map);
iosys_map_clear(&dmabuf->vmap_ptr); iosys_map_clear(&dmabuf->vmap_ptr);
} }
mutex_unlock(&dmabuf->lock);
dma_resv_unlock(dmabuf->resv); dma_resv_unlock(dmabuf->resv);
} }
EXPORT_SYMBOL_NS_GPL(dma_buf_vunmap_unlocked, DMA_BUF); EXPORT_SYMBOL_NS_GPL(dma_buf_vunmap_unlocked, DMA_BUF);
......
...@@ -326,15 +326,6 @@ struct dma_buf { ...@@ -326,15 +326,6 @@ struct dma_buf {
/** @ops: dma_buf_ops associated with this buffer object. */ /** @ops: dma_buf_ops associated with this buffer object. */
const struct dma_buf_ops *ops; const struct dma_buf_ops *ops;
/**
* @lock:
*
* Used internally to serialize list manipulation, attach/detach and
* vmap/unmap. Note that in many cases this is superseeded by
* dma_resv_lock() on @resv.
*/
struct mutex lock;
/** /**
* @vmapping_counter: * @vmapping_counter:
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment