Commit 6aae87f
i2c: stm32f7: unmap DMA mapped buffer
Before each I2C transfer using DMA, the I2C buffer is DMA'pped to make
sure the memory buffer is DMA'able. This is handle in the function
`stm32_i2c_prep_dma_xfer()`.
If the transfer fails for any reason the I2C buffer must be unmap.
Use the dma_callback to factorize the code and fix this issue.
Note that the `stm32f7_i2c_dma_callback()` is now called in case of DMA
transfer success and error and that the `complete()` on the dma_complete
completion structure is done inconditionnally in case of transfer
success or error as well as the `dmaengine_terminate_async()`.
This is allowed as a `complete()` in case transfer error has no effect
as well as a `dmaengine_terminate_async()` on a transfer success.
Also fix the unneeded cast and remove not more needed variables.
Fixes: 7ecc8cf ("i2c: i2c-stm32f7: Add DMA support")
Signed-off-by: Clément Le Goffic <[email protected]>
Cc: <[email protected]> # v4.18+
Acked-by: Alain Volmat <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Link: https://lore.kernel.org/r/[email protected]1 parent c870cbb commit 6aae87f
1 file changed
+7
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
739 | 739 | | |
740 | 740 | | |
741 | 741 | | |
742 | | - | |
| 742 | + | |
743 | 743 | | |
744 | 744 | | |
745 | 745 | | |
| 746 | + | |
746 | 747 | | |
747 | 748 | | |
748 | 749 | | |
| |||
1510 | 1511 | | |
1511 | 1512 | | |
1512 | 1513 | | |
1513 | | - | |
1514 | 1514 | | |
1515 | 1515 | | |
1516 | 1516 | | |
| |||
1551 | 1551 | | |
1552 | 1552 | | |
1553 | 1553 | | |
1554 | | - | |
1555 | | - | |
1556 | | - | |
1557 | | - | |
| 1554 | + | |
| 1555 | + | |
1558 | 1556 | | |
1559 | 1557 | | |
1560 | 1558 | | |
| |||
1600 | 1598 | | |
1601 | 1599 | | |
1602 | 1600 | | |
1603 | | - | |
1604 | 1601 | | |
1605 | 1602 | | |
1606 | 1603 | | |
| |||
1619 | 1616 | | |
1620 | 1617 | | |
1621 | 1618 | | |
1622 | | - | |
1623 | | - | |
1624 | | - | |
1625 | | - | |
| 1619 | + | |
| 1620 | + | |
1626 | 1621 | | |
1627 | 1622 | | |
1628 | 1623 | | |
| |||
1640 | 1635 | | |
1641 | 1636 | | |
1642 | 1637 | | |
1643 | | - | |
1644 | | - | |
| 1638 | + | |
1645 | 1639 | | |
1646 | 1640 | | |
1647 | 1641 | | |
| |||
0 commit comments