[PATCH] tcpm: fix pd_transmit poll condition
Sebastian Reichel
sebastian.reichel at collabora.com
Fri Jun 27 03:33:08 CEST 2025
Hi,
On Mon, May 26, 2025 at 09:42:53AM +0200, Neil Armstrong wrote:
> The read_poll_timeout() exit "cond" parameter wait for a complete
> transmit state.
>
> The "!tx_complete" cond means that on the first tcpm_transmit_helper()
> call, if the tx_complete returns to false, the poll loop would exit.
> But since at probe the tx_status is left at 0, the tx is considered
> as successful. And then later the proper status is returned and
> ignored.
>
> But if on the first tcpm_transmit_helper() call the TX status is
> returned the read_poll_timeout() would return in timeout and the
> negociation would fail.
>
> Fixes: 1db4c0ac77e ("usb: tcpm: add core framework")
> Signed-off-by: Neil Armstrong <neil.armstrong at linaro.org>
> ---
Good catch!
Reviewed-by: Sebastian Reichel <sebastian.reichel at collabora.com>
Greetings,
-- Sebastian
> drivers/usb/tcpm/tcpm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/tcpm/tcpm.c b/drivers/usb/tcpm/tcpm.c
> index 0aee57cb2f4a44af7b483e0e609e39ba584a06c0..c8679615cd7701982b64b1905c5822ac98ed6f79 100644
> --- a/drivers/usb/tcpm/tcpm.c
> +++ b/drivers/usb/tcpm/tcpm.c
> @@ -209,7 +209,7 @@ static int tcpm_pd_transmit(struct udevice *dev,
> */
> timeout_us *= 5;
> ret = read_poll_timeout(tcpm_transmit_helper, tx_complete,
> - !tx_complete, false, timeout_us, dev);
> + tx_complete, false, timeout_us, dev);
> if (ret < 0) {
> dev_err(dev, "TCPM: PD transmit data failed: %d\n", ret);
> return ret;
>
> ---
> base-commit: bab54f5942c428be698216224fd10b91d974d4da
> change-id: 20250526-topic-tcpm-tx-poll-cond-8dd3ebbbeddc
>
> Best regards,
> --
> Neil Armstrong <neil.armstrong at linaro.org>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250627/dcf67615/attachment.sig>
More information about the U-Boot
mailing list