Re: [PATCH v4 1/3] i3c: master: dw: Report actual GET CCC payload length on success
From: Frank Li
Date: Tue Jun 30 2026 - 13:04:09 EST
On Tue, Jun 30, 2026 at 06:20:25AM -0700, tze.yee.ng@xxxxxxxxxx wrote:
> From: Adrian Ng Ho Yin <adrian.ho.yin.ng@xxxxxxxxxx>
>
> On successful GET CCC transfers, set dests[0].payload.actual_len from
> RESPONSE_PORT_DATA_LEN so the I3C core receives the number of bytes
> actually read. Add actual_len to struct i3c_ccc_cmd_payload to keep
> the requested buffer size in len.
>
> Signed-off-by: Adrian Ng Ho Yin <adrian.ho.yin.ng@xxxxxxxxxx>
> Signed-off-by: Tze Yee Ng <tze.yee.ng@xxxxxxxxxx>
> ---
> drivers/i3c/master/dw-i3c-master.c | 5 ++++-
> include/linux/i3c/ccc.h | 4 +++-
Can you split into two patches, first patch just add actual_len in ccc.h
Frank
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 655693a2187e..856961da1827 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -742,7 +742,10 @@ static int dw_i3c_ccc_set(struct dw_i3c_master *master,
> dw_i3c_master_dequeue_xfer(master, xfer);
>
> ret = xfer->ret;
> - if (xfer->cmds[0].error == RESPONSE_ERROR_IBA_NACK)
> + cmd = &xfer->cmds[0];
> + if (!ret)
> + ccc->dests[0].payload.actual_len = cmd->rx_len;
> + if (cmd->error == RESPONSE_ERROR_IBA_NACK)
> ccc->err = I3C_ERROR_M2;
>
> return ret;
> diff --git a/include/linux/i3c/ccc.h b/include/linux/i3c/ccc.h
> index ad59a4ae60d1..d8052949e57e 100644
> --- a/include/linux/i3c/ccc.h
> +++ b/include/linux/i3c/ccc.h
> @@ -343,11 +343,13 @@ struct i3c_ccc_getxtime {
> /**
> * struct i3c_ccc_cmd_payload - CCC payload
> *
> - * @len: payload length
> + * @len: requested payload length
> + * @actual_len: number of bytes received on a GET CCC (filled by the driver)
> * @data: payload data. This buffer must be DMA-able
> */
> struct i3c_ccc_cmd_payload {
> u16 len;
> + u16 actual_len;
> void *data;
> };
>
> --
> 2.43.7
>