Skip to content

Commit 47e982d

Browse files
committed
dma-buf: Move dma_buf_map_attachment() to dynamic locking specification
Move dma-buf attachment mapping functions to the dynamic locking specification by asserting that the reservation lock is held. Acked-by: Sumit Semwal <[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 809d9c7 commit 47e982d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/dma-buf/dma-buf.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
10381038
if (WARN_ON(!attach || !attach->dmabuf))
10391039
return ERR_PTR(-EINVAL);
10401040

1041-
if (dma_buf_attachment_is_dynamic(attach))
1042-
dma_resv_assert_held(attach->dmabuf->resv);
1041+
dma_resv_assert_held(attach->dmabuf->resv);
10431042

10441043
if (attach->sgt) {
10451044
/*
@@ -1054,7 +1053,6 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
10541053
}
10551054

10561055
if (dma_buf_is_dynamic(attach->dmabuf)) {
1057-
dma_resv_assert_held(attach->dmabuf->resv);
10581056
if (!IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY)) {
10591057
r = attach->dmabuf->ops->pin(attach);
10601058
if (r)
@@ -1143,15 +1141,11 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
11431141
if (WARN_ON(!attach || !attach->dmabuf || !sg_table))
11441142
return;
11451143

1146-
if (dma_buf_attachment_is_dynamic(attach))
1147-
dma_resv_assert_held(attach->dmabuf->resv);
1144+
dma_resv_assert_held(attach->dmabuf->resv);
11481145

11491146
if (attach->sgt == sg_table)
11501147
return;
11511148

1152-
if (dma_buf_is_dynamic(attach->dmabuf))
1153-
dma_resv_assert_held(attach->dmabuf->resv);
1154-
11551149
__unmap_dma_buf(attach, sg_table, direction);
11561150

11571151
if (dma_buf_is_dynamic(attach->dmabuf) &&

0 commit comments

Comments
 (0)