Re: [PATCH V3 07/16] i3c: mipi-i3c-hci: Complete transfer lists immediately on error

Frank Li <[email protected]>
Newsgroups org.infradead.lists.linux-i3c,org.kernel.vger.linux-kernel
Message-ID <agNZfL92Fo5qM0Iq@lizhi-Precision-Tower-5810>
On Mon, May 04, 2026 at 02:33:43PM +0300, Adrian Hunter wrote:
> In DMA mode, transfer lists are currently completed only when the final
> transfer in the list completes. If an earlier transfer fails, the list is
> left incomplete and callers wait until timeout.
>
> There is no need to wait for a timeout, as the completion path in
> i3c_hci_process_xfer() already checks for error status. Complete the
> transfer list as soon as any transfer in the list reports an error.
>
> This avoids unnecessary delays and spurious timeouts on error.
>
> Complete a transfer list completion immediately there is an error.
>
> Signed-off-by: Adrian Hunter <[email protected]>
> ---

Reviewed-by: Frank Li <[email protected]>

>
>
> Changes in V3:
>
> 	None
>
> Changes in V2:
>
> 	Renamed completing_xfer to final_xfer
>
>
>  drivers/i3c/master/mipi-i3c-hci/dma.c | 6 ++++--
>  drivers/i3c/master/mipi-i3c-hci/hci.h | 1 +
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c
> index 28e4d38f55d3..899fdf6555a8 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/dma.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c
> @@ -502,6 +502,8 @@ static int hci_dma_queue_xfer(struct i3c_hci *hci,
>  		struct hci_xfer *xfer = xfer_list + i;
>  		u32 *ring_data = rh->xfer + rh->xfer_struct_sz * enqueue_ptr;
>
> +		xfer->final_xfer = xfer_list + n - 1;
> +
>  		/* store cmd descriptor */
>  		*ring_data++ = xfer->cmd_desc[0];
>  		*ring_data++ = xfer->cmd_desc[1];
> @@ -576,8 +578,8 @@ static void hci_dma_xfer_done(struct i3c_hci *hci, struct hci_rh_data *rh)
>  					tid, xfer->cmd_tid);
>  				/* TODO: do something about it? */
>  			}
> -			if (xfer->completion)
> -				complete(xfer->completion);
> +			if (xfer == xfer->final_xfer || RESP_STATUS(resp))
> +				complete(xfer->final_xfer->completion);
>  			if (RESP_STATUS(resp))
>  				hci->enqueue_blocked = true;
>  		}
> diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h
> index d630400ec945..f07fc627d4d2 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/hci.h
> +++ b/drivers/i3c/master/mipi-i3c-hci/hci.h
> @@ -104,6 +104,7 @@ struct hci_xfer {
>  		struct {
>  			/* DMA specific */
>  			struct i3c_dma *dma;
> +			struct hci_xfer *final_xfer;
>  			int ring_number;
>  			int ring_entry;
>  		};
> --
> 2.51.0
>

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