Skip to content

Commit effed5d

Browse files
billy-tsaialexandrebelloni
authored andcommitted
i3c: mipi-i3c-hci: Use I2C DMA-safe api
Use the i2c_get/put_dma_safe_msg_buf for I2C transfers instead of using the I3C-specific API. Signed-off-by: Billy Tsai <[email protected]> Acked-by: Mukesh Kumar Savaliya <[email protected]> Reviewed-by: Jarkko Nikula <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 6866c91 commit effed5d

File tree

1 file changed

+3
-5
lines changed
  • drivers/i3c/master/mipi-i3c-hci

1 file changed

+3
-5
lines changed

drivers/i3c/master/mipi-i3c-hci/core.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,11 @@ static int i3c_hci_i2c_xfers(struct i2c_dev_desc *dev,
382382
return -ENOMEM;
383383

384384
for (i = 0; i < nxfers; i++) {
385-
xfer[i].data = i2c_xfers[i].buf;
385+
xfer[i].data = i2c_get_dma_safe_msg_buf(&i2c_xfers[i], 1);
386386
xfer[i].data_len = i2c_xfers[i].len;
387387
xfer[i].rnw = i2c_xfers[i].flags & I2C_M_RD;
388388
hci->cmd->prep_i2c_xfer(hci, dev, &xfer[i]);
389389
xfer[i].cmd_desc[0] |= CMD_0_ROC;
390-
ret = i3c_hci_alloc_safe_xfer_buf(hci, &xfer[i]);
391-
if (ret)
392-
goto out;
393390
}
394391
last = i - 1;
395392
xfer[last].cmd_desc[0] |= CMD_0_TOC;
@@ -412,7 +409,8 @@ static int i3c_hci_i2c_xfers(struct i2c_dev_desc *dev,
412409

413410
out:
414411
for (i = 0; i < nxfers; i++)
415-
i3c_hci_free_safe_xfer_buf(hci, &xfer[i]);
412+
i2c_put_dma_safe_msg_buf(xfer[i].data, &i2c_xfers[i],
413+
ret ? false : true);
416414

417415
hci_free_xfer(xfer, nxfers);
418416
return ret;

0 commit comments

Comments
 (0)