Merge tag 'drm-misc-next-2020-10-27' of git://anongit.freedesktop.org/drm/drm-misc...
[sfrench/cifs-2.6.git] / drivers / dma-buf / heaps / heap-helpers.c
index e9fb2818f2d4d7bbc457b8fac9f46a4ada16998a..fcf4ce3e2cbb5eba326b9ce669b697e03b8ae004 100644 (file)
@@ -140,13 +140,12 @@ struct sg_table *dma_heap_map_dma_buf(struct dma_buf_attachment *attachment,
                                      enum dma_data_direction direction)
 {
        struct dma_heaps_attachment *a = attachment->priv;
-       struct sg_table *table;
-
-       table = &a->table;
+       struct sg_table *table = &a->table;
+       int ret;
 
-       if (!dma_map_sg(attachment->dev, table->sgl, table->nents,
-                       direction))
-               table = ERR_PTR(-ENOMEM);
+       ret = dma_map_sgtable(attachment->dev, table, direction, 0);
+       if (ret)
+               table = ERR_PTR(ret);
        return table;
 }
 
@@ -154,7 +153,7 @@ static void dma_heap_unmap_dma_buf(struct dma_buf_attachment *attachment,
                                   struct sg_table *table,
                                   enum dma_data_direction direction)
 {
-       dma_unmap_sg(attachment->dev, table->sgl, table->nents, direction);
+       dma_unmap_sgtable(attachment->dev, table, direction, 0);
 }
 
 static vm_fault_t dma_heap_vm_fault(struct vm_fault *vmf)