The selftest's dma-buf exporter has stub map and unmap callbacks returning -EOPNOTSUPP so only the prototypes change.
Also drop the attach and detach callbacks which are optional and don't do anything. Co-developed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Alistair Popple <[email protected]> --- Changes for v3: - Split out of the single exporter conversion patch. --- drivers/iommu/iommufd/selftest.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c index 25387969ab75..b3fac041eb7e 100644 --- a/drivers/iommu/iommufd/selftest.c +++ b/drivers/iommu/iommufd/selftest.c @@ -6,6 +6,7 @@ #include <linux/anon_inodes.h> #include <linux/debugfs.h> #include <linux/dma-buf.h> +#include <linux/dma-buf-mapping.h> #include <linux/dma-resv.h> #include <linux/fault-inject.h> #include <linux/file.h> @@ -1959,18 +1960,7 @@ struct iommufd_test_dma_buf { bool revoked; }; -static int iommufd_test_dma_buf_attach(struct dma_buf *dmabuf, - struct dma_buf_attachment *attachment) -{ - return 0; -} - -static void iommufd_test_dma_buf_detach(struct dma_buf *dmabuf, - struct dma_buf_attachment *attachment) -{ -} - -static struct sg_table * +static struct dma_buf_sgt_mapping * iommufd_test_dma_buf_map(struct dma_buf_attachment *attachment, enum dma_data_direction dir) { @@ -1978,7 +1968,7 @@ iommufd_test_dma_buf_map(struct dma_buf_attachment *attachment, } static void iommufd_test_dma_buf_unmap(struct dma_buf_attachment *attachment, - struct sg_table *sgt, + struct dma_buf_sgt_mapping *mapping, enum dma_data_direction dir) { } @@ -1992,11 +1982,9 @@ static void iommufd_test_dma_buf_release(struct dma_buf *dmabuf) } static const struct dma_buf_ops iommufd_test_dmabuf_ops = { - .attach = iommufd_test_dma_buf_attach, - .detach = iommufd_test_dma_buf_detach, - .map_dma_buf = iommufd_test_dma_buf_map, .release = iommufd_test_dma_buf_release, - .unmap_dma_buf = iommufd_test_dma_buf_unmap, + DMA_BUF_SIMPLE_SGT_EXP_MATCH(iommufd_test_dma_buf_map, + iommufd_test_dma_buf_unmap), }; int iommufd_test_dma_buf_iommufd_map(struct dma_buf_attachment *attachment, -- 2.54.0
