Skip to content

Commit 28743e2

Browse files
committed
dma-buf: Remove obsoleted 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: Sumit Semwal <[email protected]> Acked-by: Christian König <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 23543b3 commit 28743e2

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

drivers/dma-buf/dma-buf.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
657657

658658
dmabuf->file = file;
659659

660-
mutex_init(&dmabuf->lock);
661660
INIT_LIST_HEAD(&dmabuf->attachments);
662661

663662
mutex_lock(&db_list.lock);
@@ -1503,7 +1502,7 @@ EXPORT_SYMBOL_NS_GPL(dma_buf_mmap, DMA_BUF);
15031502
int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *map)
15041503
{
15051504
struct iosys_map ptr;
1506-
int ret = 0;
1505+
int ret;
15071506

15081507
iosys_map_clear(map);
15091508

@@ -1515,28 +1514,25 @@ int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *map)
15151514
if (!dmabuf->ops->vmap)
15161515
return -EINVAL;
15171516

1518-
mutex_lock(&dmabuf->lock);
15191517
if (dmabuf->vmapping_counter) {
15201518
dmabuf->vmapping_counter++;
15211519
BUG_ON(iosys_map_is_null(&dmabuf->vmap_ptr));
15221520
*map = dmabuf->vmap_ptr;
1523-
goto out_unlock;
1521+
return 0;
15241522
}
15251523

15261524
BUG_ON(iosys_map_is_set(&dmabuf->vmap_ptr));
15271525

15281526
ret = dmabuf->ops->vmap(dmabuf, &ptr);
15291527
if (WARN_ON_ONCE(ret))
1530-
goto out_unlock;
1528+
return ret;
15311529

15321530
dmabuf->vmap_ptr = ptr;
15331531
dmabuf->vmapping_counter = 1;
15341532

15351533
*map = dmabuf->vmap_ptr;
15361534

1537-
out_unlock:
1538-
mutex_unlock(&dmabuf->lock);
1539-
return ret;
1535+
return 0;
15401536
}
15411537
EXPORT_SYMBOL_NS_GPL(dma_buf_vmap, DMA_BUF);
15421538

@@ -1583,13 +1579,11 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, struct iosys_map *map)
15831579
BUG_ON(dmabuf->vmapping_counter == 0);
15841580
BUG_ON(!iosys_map_is_equal(&dmabuf->vmap_ptr, map));
15851581

1586-
mutex_lock(&dmabuf->lock);
15871582
if (--dmabuf->vmapping_counter == 0) {
15881583
if (dmabuf->ops->vunmap)
15891584
dmabuf->ops->vunmap(dmabuf, map);
15901585
iosys_map_clear(&dmabuf->vmap_ptr);
15911586
}
1592-
mutex_unlock(&dmabuf->lock);
15931587
}
15941588
EXPORT_SYMBOL_NS_GPL(dma_buf_vunmap, DMA_BUF);
15951589

include/linux/dma-buf.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,6 @@ struct dma_buf {
326326
/** @ops: dma_buf_ops associated with this buffer object. */
327327
const struct dma_buf_ops *ops;
328328

329-
/**
330-
* @lock:
331-
*
332-
* Used internally to serialize list manipulation, attach/detach and
333-
* vmap/unmap. Note that in many cases this is superseeded by
334-
* dma_resv_lock() on @resv.
335-
*/
336-
struct mutex lock;
337-
338329
/**
339330
* @vmapping_counter:
340331
*

0 commit comments

Comments
 (0)