Re: [PATCH v2 1/2] i3c: Remove the const qualifier from i2c_msg pointer in i2c_xfers API

From: Billy Tsai
Date: Tue Feb 04 2025 - 05:09:49 EST


> On 2025-02-04 17:17:01+0800, Billy Tsai wrote:
> > The change is necessary to enable the use of the
> > `i2c_get_dma_safe_msg_buf()` API, which requires a non-const
> > `struct i2c_msg *` to operate. The `i2c_get_dma_safe_msg_buf()` function
> > ensures safe handling of I2C messages when using DMA, making it essential
> > for scenarios where DMA transfers are involved. By removing the `const`
> > qualifier, this patch allows drivers to prepare and manage DMA-safe
> > buffers directly.

> This is missing a changelog to v1 of the series.

> Also I asked before why it is not possible to change the signature of
> i2c_get_dma_safe_msg_buf() to accept 'const struct i2c_msg *' [0].
> That looks like the nicer solution to me.

Hi Thomas,

The i2c_get_dma_safe_msg_buf() function has existed for a long time, but I do not know the original reason why it declares struct i2c_msg * without const. However, I believe this is because the i2c_put_dma_safe_msg_buf() function modifies the buffer data, so for consistency, it is declared without const.

Best regards,
Billy Tsai.