From: sashiko-bot@kernel.org
To: "Alexey Charkov" <alchark@flipper.net>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2 2/6] usb: typec: fusb302: Drain the RX FIFO on each PD interrupt
Date: Fri, 27 Nov 2026 10:58:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-237193@kernel.org> (raw)
In-Reply-To: <20261127-fusb302-getsourcecap-v2-2-6770eb1e7945@flipper.net>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] usb: typec: fusb302: rx_rechecks not reset after limit or PD
RX reset
--
commit ab0193ce52aa6488faeed15cd71aecb910a1816e
Author: Alexey Charkov <alchark@flipper.net>
usb: typec: fusb302: Drain the RX FIFO on each PD interrupt
This commit drains the RX FIFO on each PD interrupt while waiting for CC
to go idle before reading each message, scheduling a delayed recheck if
CC stays busy.
> diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
> index d2d0e8ffc3080..d57f9ae6621d6 100644
> --- a/drivers/usb/typec/tcpm/fusb302.c
> +++ b/drivers/usb/typec/tcpm/fusb302.c
[ ... ]
> @@ -1693,6 +1700,141 @@ static int fusb302_pd_read_message(struct fusb302_chip *chip)
[ ... ]
> +/* About 200ms of CC staying busy, longer than any PD traffic but noise */
> +#define FUSB302_CC_BUSY_RECHECKS 50
> +
> +/*
> + * Drain the RX FIFO, and if it may not be empty, look again shortly after: a
> + * packet the chip does not acknowledge raises no interrupt for it to be read
> + * on. Leave CC that stays busy for longer to the next interrupt, rather than
> + * keep the I2C bus and chip->lock busy with it.
> + */
> +static int fusb302_pd_rx_drain(struct fusb302_chip *chip)
> +{
> + int ret;
> +
> + ret = fusb302_pd_read_messages(chip);
> + if (ret <= 0) {
> + chip->rx_rechecks = 0;
> + return ret;
> + }
> + if (chip->rx_rechecks++ < FUSB302_CC_BUSY_RECHECKS)
> + mod_delayed_work(chip->wq, &chip->rx_recheck,
> + usecs_to_jiffies(FUSB302_CC_BUSY_MAX_US));
> + else
> + fusb302_log(chip, "CC stays busy, RX FIFO left for the next interrupt");
> +
> + return 0;
> +}
[Severity: Medium]
Does chip->rx_rechecks remain past FUSB302_CC_BUSY_RECHECKS once the
recheck limit is hit?
chip->rx_rechecks is only reset to 0 when fusb302_pd_read_messages()
returns <= 0, and is not reset in the else branch, on a new interrupt, or
in fusb302_pd_rx_reset(). Once 50 rechecks expire, a later PD interrupt
(even after a Hard Reset or FIFO flush) that reads a message and then sees
CC busy with a follow-up packet returns 1 from fusb302_pd_read_messages(),
sees chip->rx_rechecks >= 51, and gives up immediately without scheduling
chip->rx_recheck, leaving unacknowledged messages stuck in the RX FIFO.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-fusb302-getsourcecap-v2-0-6770eb1e7945@flipper.net?part=2
next prev parent reply other threads:[~2026-11-27 10:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 10:40 [PATCH v2 0/6] usb: typec: fusb302: Make full PD 3.0 work on the 2.0-only FUSB302 Alexey Charkov
2026-11-27 10:40 ` [PATCH v2 1/6] usb: typec: fusb302: Find the next message when the RX FIFO is out of step Alexey Charkov
2026-11-27 10:40 ` [PATCH v2 2/6] usb: typec: fusb302: Drain the RX FIFO on each PD interrupt Alexey Charkov
2026-11-27 10:58 ` sashiko-bot [this message]
2026-11-27 10:40 ` [PATCH v2 3/6] usb: typec: fusb302: Read out the RX FIFO rather than flush it as PD RX goes on Alexey Charkov
2026-11-27 11:00 ` sashiko-bot
2026-11-27 10:40 ` [PATCH v2 4/6] usb: typec: fusb302: Handle interrupts in the IRQ thread Alexey Charkov
2026-11-27 10:40 ` [PATCH v2 5/6] usb: typec: fusb302: Acknowledge Get_Source_Cap_Extended from the driver Alexey Charkov
2026-11-27 11:01 ` sashiko-bot
2026-11-27 10:40 ` [PATCH v2 6/6] usb: typec: fusb302: Acknowledge Get_Source_Cap_Extended in time Alexey Charkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-237193@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alchark@flipper.net \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox