]> www.infradead.org Git - users/hch/misc.git/commitdiff
i3c: mipi-i3c-hci: Use I2C DMA-safe api
authorBilly Tsai <billy_tsai@aspeedtech.com>
Tue, 4 Feb 2025 09:17:02 +0000 (17:17 +0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 20 Feb 2025 21:54:28 +0000 (22:54 +0100)
Use the i2c_get/put_dma_safe_msg_buf for I2C transfers instead of using
the I3C-specific API.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Acked-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/20250204091702.4014466-2-billy_tsai@aspeedtech.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master/mipi-i3c-hci/core.c

index a34eec850bcc5f8e941714860f1e77f4fb7e2b9b..a71226d7ca59328f626ddcf6f590c4232025dc17 100644 (file)
@@ -382,14 +382,11 @@ static int i3c_hci_i2c_xfers(struct i2c_dev_desc *dev,
                return -ENOMEM;
 
        for (i = 0; i < nxfers; i++) {
-               xfer[i].data = i2c_xfers[i].buf;
+               xfer[i].data = i2c_get_dma_safe_msg_buf(&i2c_xfers[i], 1);
                xfer[i].data_len = i2c_xfers[i].len;
                xfer[i].rnw = i2c_xfers[i].flags & I2C_M_RD;
                hci->cmd->prep_i2c_xfer(hci, dev, &xfer[i]);
                xfer[i].cmd_desc[0] |= CMD_0_ROC;
-               ret = i3c_hci_alloc_safe_xfer_buf(hci, &xfer[i]);
-               if (ret)
-                       goto out;
        }
        last = i - 1;
        xfer[last].cmd_desc[0] |= CMD_0_TOC;
@@ -412,7 +409,8 @@ static int i3c_hci_i2c_xfers(struct i2c_dev_desc *dev,
 
 out:
        for (i = 0; i < nxfers; i++)
-               i3c_hci_free_safe_xfer_buf(hci, &xfer[i]);
+               i2c_put_dma_safe_msg_buf(xfer[i].data, &i2c_xfers[i],
+                                        ret ? false : true);
 
        hci_free_xfer(xfer, nxfers);
        return ret;