Re: [PATCH v4 1/3] i3c: master: dw: Report actual GET CCC payload length on success

"NG, TZE YEE" <[email protected]>
Newsgroups org.infradead.lists.linux-i3c,dev.linux.lists.imx,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 1/7/2026 1:03 am, Frank Li wrote:
> On Tue, Jun 30, 2026 at 06:20:25AM -0700, [email protected] wrote:
>> From: Adrian Ng Ho Yin <[email protected]>
>>
>> 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 <[email protected]>
>> Signed-off-by: Tze Yee Ng <[email protected]>
>> ---
>>   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
> 

Sure, I will fix it in v5.

Thanks,
Tze Yee

>>   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
>>

-- 
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.