]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i2c: tegra: Remove dma_sync_*() calls
authorAkhil R <akhilrajeev@nvidia.com>
Thu, 10 Jul 2025 13:12:06 +0000 (18:42 +0530)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 29 Jul 2025 22:30:54 +0000 (00:30 +0200)
Calling dma_sync_*() on a buffer from dma_alloc_coherent() is pointless.
The driver should not be doing its own bounce-buffering if the buffer is
allocated through dma_alloc_coherent().

Suggested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20250710131206.2316-4-akhilrajeev@nvidia.com
drivers/i2c/busses/i2c-tegra.c

index 6088510b25f6d33ae9e9cdd52ea881c63e5c7d86..4eb31b913c1a7dbd659d36b0dfb7c394512dde9a 100644 (file)
@@ -1301,17 +1301,9 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 
        if (i2c_dev->dma_mode) {
                if (i2c_dev->msg_read) {
-                       dma_sync_single_for_device(i2c_dev->dma_dev,
-                                                  i2c_dev->dma_phys,
-                                                  xfer_size, DMA_FROM_DEVICE);
-
                        err = tegra_i2c_dma_submit(i2c_dev, xfer_size);
                        if (err)
                                return err;
-               } else {
-                       dma_sync_single_for_cpu(i2c_dev->dma_dev,
-                                               i2c_dev->dma_phys,
-                                               xfer_size, DMA_TO_DEVICE);
                }
        }
 
@@ -1321,11 +1313,6 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
                if (i2c_dev->dma_mode) {
                        memcpy(i2c_dev->dma_buf + I2C_PACKET_HEADER_SIZE,
                               msg->buf, i2c_dev->msg_len);
-
-                       dma_sync_single_for_device(i2c_dev->dma_dev,
-                                                  i2c_dev->dma_phys,
-                                                  xfer_size, DMA_TO_DEVICE);
-
                        err = tegra_i2c_dma_submit(i2c_dev, xfer_size);
                        if (err)
                                return err;
@@ -1366,13 +1353,8 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
                        return -ETIMEDOUT;
                }
 
-               if (i2c_dev->msg_read && i2c_dev->msg_err == I2C_ERR_NONE) {
-                       dma_sync_single_for_cpu(i2c_dev->dma_dev,
-                                               i2c_dev->dma_phys,
-                                               xfer_size, DMA_FROM_DEVICE);
-
+               if (i2c_dev->msg_read && i2c_dev->msg_err == I2C_ERR_NONE)
                        memcpy(i2c_dev->msg_buf, i2c_dev->dma_buf, i2c_dev->msg_len);
-               }
        }
 
        time_left = tegra_i2c_wait_completion(i2c_dev, &i2c_dev->msg_complete,