From: Jason Gunthorpe <[email protected]> These importer helper functions should call dma_buf_sgt_dma_device() as they are always working with SGTs.
Signed-off-by: Jason Gunthorpe <[email protected]> --- drivers/iio/industrialio-buffer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 2c9ec93dff47..a00985c92251 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -16,6 +16,7 @@ #include <linux/export.h> #include <linux/device.h> #include <linux/dma-buf.h> +#include <linux/dma-buf-mapping.h> #include <linux/dma-fence.h> #include <linux/dma-resv.h> #include <linux/file.h> @@ -1672,7 +1673,7 @@ iio_buffer_find_attachment(struct iio_dev_buffer_pair *ib, guard(mutex)(&buffer->dmabufs_mutex); list_for_each_entry(priv, &buffer->dmabufs, entry) { - if (priv->attach->dev == dma_dev + if (dma_buf_sgt_dma_device(priv->attach) == dma_dev && priv->attach->dmabuf == dmabuf) { attach = priv->attach; break; @@ -1756,7 +1757,7 @@ static int iio_buffer_attach_dmabuf(struct iio_dev_buffer_pair *ib, * combo. If we do, refuse to attach. */ list_for_each_entry(each, &buffer->dmabufs, entry) { - if (each->attach->dev == dma_dev + if (dma_buf_sgt_dma_device(each->attach) == dma_dev && each->attach->dmabuf == dmabuf) { /* * We unlocked the reservation object, so going through @@ -1810,7 +1811,7 @@ static int iio_buffer_detach_dmabuf(struct iio_dev_buffer_pair *ib, guard(mutex)(&buffer->dmabufs_mutex); list_for_each_entry(priv, &buffer->dmabufs, entry) { - if (priv->attach->dev == dma_dev + if (dma_buf_sgt_dma_device(priv->attach) == dma_dev && priv->attach->dmabuf == dmabuf) { list_del(&priv->entry); -- 2.54.0
