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/usb/gadget/function/f_fs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 43962e05eacf..09680534623e 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -16,6 +16,7 @@ #include <linux/blkdev.h> #include <linux/dma-buf.h> +#include <linux/dma-buf-mapping.h> #include <linux/dma-fence.h> #include <linux/dma-resv.h> #include <linux/pagemap.h> @@ -1514,7 +1515,7 @@ ffs_dmabuf_find_attachment(struct ffs_epfile *epfile, struct dma_buf *dmabuf) mutex_lock(&epfile->dmabufs_mutex); list_for_each_entry(priv, &epfile->dmabufs, entry) { - if (priv->attach->dev == dev + if (dma_buf_sgt_dma_device(priv->attach) == dev && priv->attach->dmabuf == dmabuf) { attach = priv->attach; break; @@ -1616,7 +1617,7 @@ static int ffs_dmabuf_detach(struct file *file, int fd) mutex_lock(&epfile->dmabufs_mutex); list_for_each_entry_safe(priv, tmp, &epfile->dmabufs, entry) { - if (priv->attach->dev == dev + if (dma_buf_sgt_dma_device(priv->attach) == dev && priv->attach->dmabuf == dmabuf) { /* Cancel any pending transfer */ spin_lock_irq(&ffs->eps_lock); -- 2.54.0
