Skip to content

Commit 37e0070

Browse files
mszyprowXu Yilun
authored andcommitted
zynq_fpga: use sgtable-based scatterlist wrappers
Use common wrappers operating directly on the struct sg_table objects to fix incorrect use of statterlists related calls. dma_unmap_sg() function has to be called with the number of elements originally passed to the dma_map_sg() function, not the one returned in sgtable's nents. CC: [email protected] Fixes: 425902f ("fpga zynq: Use the scatterlist interface") Signed-off-by: Marek Szyprowski <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Xu Yilun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Xu Yilun <[email protected]>
1 parent 19272b3 commit 37e0070

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/fpga/zynq-fpga.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt)
406406
}
407407

408408
priv->dma_nelms =
409-
dma_map_sg(mgr->dev.parent, sgt->sgl, sgt->nents, DMA_TO_DEVICE);
409+
dma_map_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE, 0);
410410
if (priv->dma_nelms == 0) {
411411
dev_err(&mgr->dev, "Unable to DMA map (TO_DEVICE)\n");
412412
return -ENOMEM;
@@ -478,7 +478,7 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt)
478478
clk_disable(priv->clk);
479479

480480
out_free:
481-
dma_unmap_sg(mgr->dev.parent, sgt->sgl, sgt->nents, DMA_TO_DEVICE);
481+
dma_unmap_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE, 0);
482482
return err;
483483
}
484484

0 commit comments

Comments
 (0)