Skip to content

Commit 315b40d

Browse files
Akhil RAndi Shyti
authored andcommitted
i2c: tegra: Remove dma_sync_*() calls
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 <[email protected]> Signed-off-by: Akhil R <[email protected]> Reviewed-by: Thierry Reding <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 635bf3c commit 315b40d

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

drivers/i2c/busses/i2c-tegra.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,17 +1301,9 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
13011301

13021302
if (i2c_dev->dma_mode) {
13031303
if (i2c_dev->msg_read) {
1304-
dma_sync_single_for_device(i2c_dev->dma_dev,
1305-
i2c_dev->dma_phys,
1306-
xfer_size, DMA_FROM_DEVICE);
1307-
13081304
err = tegra_i2c_dma_submit(i2c_dev, xfer_size);
13091305
if (err)
13101306
return err;
1311-
} else {
1312-
dma_sync_single_for_cpu(i2c_dev->dma_dev,
1313-
i2c_dev->dma_phys,
1314-
xfer_size, DMA_TO_DEVICE);
13151307
}
13161308
}
13171309

@@ -1321,11 +1313,6 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
13211313
if (i2c_dev->dma_mode) {
13221314
memcpy(i2c_dev->dma_buf + I2C_PACKET_HEADER_SIZE,
13231315
msg->buf, i2c_dev->msg_len);
1324-
1325-
dma_sync_single_for_device(i2c_dev->dma_dev,
1326-
i2c_dev->dma_phys,
1327-
xfer_size, DMA_TO_DEVICE);
1328-
13291316
err = tegra_i2c_dma_submit(i2c_dev, xfer_size);
13301317
if (err)
13311318
return err;
@@ -1366,13 +1353,8 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
13661353
return -ETIMEDOUT;
13671354
}
13681355

1369-
if (i2c_dev->msg_read && i2c_dev->msg_err == I2C_ERR_NONE) {
1370-
dma_sync_single_for_cpu(i2c_dev->dma_dev,
1371-
i2c_dev->dma_phys,
1372-
xfer_size, DMA_FROM_DEVICE);
1373-
1356+
if (i2c_dev->msg_read && i2c_dev->msg_err == I2C_ERR_NONE)
13741357
memcpy(i2c_dev->msg_buf, i2c_dev->dma_buf, i2c_dev->msg_len);
1375-
}
13761358
}
13771359

13781360
time_left = tegra_i2c_wait_completion(i2c_dev, &i2c_dev->msg_complete,

0 commit comments

Comments
 (0)