aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/media/common/videobuf2/videobuf2-dma-contig.c
diff options
context:
space:
mode:
authorDmitry Osipenko <dmitry.osipenko@collabora.com>2022-10-17 20:22:28 +0300
committerDmitry Osipenko <dmitry.osipenko@collabora.com>2022-10-18 01:21:53 +0300
commit23543b3c4f7fe4ee03d624d0584ec8429d4e7a15 (patch)
treed09623f189f176b15443a9d0990a947a9dac4f15 /drivers/media/common/videobuf2/videobuf2-dma-contig.c
parentdma-buf: Document dynamic locking convention (diff)
downloadwireguard-linux-23543b3c4f7fe4ee03d624d0584ec8429d4e7a15.tar.xz
wireguard-linux-23543b3c4f7fe4ee03d624d0584ec8429d4e7a15.zip
media: videobuf2: Stop using internal dma-buf lock
All drivers that use dma-bufs have been moved to the updated locking specification and now dma-buf reservation is guaranteed to be locked by importers during the mapping operations. There is no need to take the internal dma-buf lock anymore. Remove locking from the videobuf2 memory allocators. Acked-by: Tomasz Figa <tfiga@chromium.org> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221017172229.42269-21-dmitry.osipenko@collabora.com
Diffstat (limited to 'drivers/media/common/videobuf2/videobuf2-dma-contig.c')
-rw-r--r--drivers/media/common/videobuf2/videobuf2-dma-contig.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
index 79f4d8301fbb..555bd40fa472 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
@@ -382,18 +382,12 @@ static struct sg_table *vb2_dc_dmabuf_ops_map(
struct dma_buf_attachment *db_attach, enum dma_data_direction dma_dir)
{
struct vb2_dc_attachment *attach = db_attach->priv;
- /* stealing dmabuf mutex to serialize map/unmap operations */
- struct mutex *lock = &db_attach->dmabuf->lock;
struct sg_table *sgt;
- mutex_lock(lock);
-
sgt = &attach->sgt;
/* return previously mapped sg table */
- if (attach->dma_dir == dma_dir) {
- mutex_unlock(lock);
+ if (attach->dma_dir == dma_dir)
return sgt;
- }
/* release any previous cache */
if (attach->dma_dir != DMA_NONE) {
@@ -409,14 +403,11 @@ static struct sg_table *vb2_dc_dmabuf_ops_map(
if (dma_map_sgtable(db_attach->dev, sgt, dma_dir,
DMA_ATTR_SKIP_CPU_SYNC)) {
pr_err("failed to map scatterlist\n");
- mutex_unlock(lock);
return ERR_PTR(-EIO);
}
attach->dma_dir = dma_dir;
- mutex_unlock(lock);
-
return sgt;
}