From: sashiko-bot@kernel.org
To: "Andrei Aldea" <andrei1998@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
linux-leds@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH 10/15] HID: hid-oxp: handle controller reinitialization across suspend
Date: Thu, 10 Sep 2026 03:34:25 +0000 [thread overview]
Message-ID: <20260910033425.97F311F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260910032115.28669-11-andrei1998@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Late monocolor acknowledgments trigger spurious MCU reinitializations.
- [Low] Unnecessary 200ms delay when the transport write fails.
--
commit 0d410b2c1077d136f271fbc3070448d1e53eb0df
Author: Andrei Aldea <andrei1998@gmail.com>
HID: hid-oxp: handle controller reinitialization across suspend
This commit attempts to fix spurious MCU resets caused by confusing a monocolor
acknowledgment with an asynchronous MCU reset notification. It tracks monocolor
writes and consumes the matching acknowledgment. It also drains work queues on
suspend and re-enables them on resume, and queues a fallback reinitialization
after a set interval.
> diff --git a/drivers/hid/hid-oxp.c b/drivers/hid/hid-oxp.c
> index 7b366878fcb3e..e26e6a98294fe 100644
> --- a/drivers/hid/hid-oxp.c
> +++ b/drivers/hid/hid-oxp.c
[ ... ]
> @@ -417,11 +425,26 @@ static int oxp_hid_raw_event_gen_2(struct hid_device *hdev,
> if (data[0] != OXP_FID_GEN2_STATUS_EVENT)
> return 0;
>
> + /* A monocolor acknowledgment is not an MCU reset notification. */
> + if (data[5] == OXP_STATUS_ACK) {
> + scoped_guard(spinlock_irqsave, &cfg->rgb_reply_lock) {
> + if (cfg->rgb_reply_pending &&
> + data[3] == cfg->rgb_reply_command &&
> + data[4] == cfg->rgb_reply_zone) {
> + cfg->rgb_reply_pending = false;
> + solicited = true;
> + }
> + }
> + if (solicited)
> + return 0;
> + }
> +
> /* Sent ~6s after resume event, indicating the MCU has fully reset.
> * Re-apply our settings after this has been received.
> */
> if (data[3] == OXP_EFFECT_MONO_TRUE) {
[Severity: Medium]
Will this logic misidentify a late acknowledgment as a reset notification?
In mcu_property_out(), rgb_reply_pending is unconditionally cleared after
a strict 200ms timeout. If an acknowledgment from the MCU arrives after
that 200ms window, the solicited check above will fail because
cfg->rgb_reply_pending is already false. The late ACK will then fall
through to this check where data[3] == OXP_EFFECT_MONO_TRUE matches,
mistaking the late reply for an MCU reset and scheduling a spurious
controller reinitialization.
[ ... ]
> @@ -509,12 +546,18 @@ static int mcu_property_out(struct oxp_hid_cfg *cfg, u8 *header, size_t header_s
> dev_dbg(&cfg->hdev->dev, "raw data: [%*ph]\n", OXP_PACKET_SIZE, dmabuf);
>
> ret = hid_hw_output_report(cfg->hdev, dmabuf, OXP_PACKET_SIZE);
> - if (ret < 0)
> - return ret;
> -
> /* MCU takes 200ms to be ready for another command. */
> msleep(200);
[Severity: Low]
Does this code unnecessarily delay 200ms on transport errors?
When hid_hw_output_report() returns a negative error code (e.g. if the
device is disconnected), this removed the early return but failed to
bypass the sleep, resulting in an unneeded 200ms delay.
> - return ret == OXP_PACKET_SIZE ? 0 : -EIO;
> + if (ret >= 0)
> + ret = ret == OXP_PACKET_SIZE ? 0 : -EIO;
> +
> + if (rgb_write) {
> + scoped_guard(spinlock_irqsave, &cfg->rgb_reply_lock) {
> + cfg->rgb_reply_pending = false;
> + }
> + }
> +
> + return ret;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910032115.28669-1-andrei1998@gmail.com?part=10
next prev parent reply other threads:[~2026-09-10 3:34 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 3:21 [PATCH 00/15] HID: hid-oxp: fix and extend X2-family controller support Andrei Aldea
2026-09-10 3:21 ` [PATCH 01/15] HID: hid-oxp: fix default M1 and M2 key mappings Andrei Aldea
2026-09-10 3:21 ` [PATCH 02/15] HID: hid-oxp: validate input report lengths before decoding Andrei Aldea
2026-09-10 3:34 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 03/15] HID: hid-oxp: retain fractional brightness when reading RGB status Andrei Aldea
2026-09-10 3:29 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 04/15] HID: hid-oxp: reject invalid Gen2 RGB status values Andrei Aldea
2026-09-10 3:32 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 05/15] HID: hid-oxp: fix multicolor LED intensity scaling Andrei Aldea
2026-09-10 3:33 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 06/15] HID: hid-oxp: serialize complete RGB updates Andrei Aldea
2026-09-10 3:32 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 07/15] HID: hid-oxp: select brightness policy for the new RGB effect Andrei Aldea
2026-09-10 3:33 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 08/15] HID: hid-oxp: stop configuration work during teardown Andrei Aldea
2026-09-10 3:32 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 09/15] HID: hid-oxp: keep configuration state per HID interface Andrei Aldea
2026-09-10 3:35 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 10/15] HID: hid-oxp: handle controller reinitialization across suspend Andrei Aldea
2026-09-10 3:34 ` sashiko-bot [this message]
2026-09-10 3:21 ` [PATCH 11/15] HID: hid-oxp: group declarations and protocol definitions Andrei Aldea
2026-09-10 3:40 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 12/15] HID: hid-oxp: support three-page button maps on X2 controllers Andrei Aldea
2026-09-10 3:40 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 13/15] HID: hid-oxp: represent RGB LEDs with a common array Andrei Aldea
2026-09-10 3:44 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 14/15] HID: hid-oxp: add Gen3 joystick ring RGB support Andrei Aldea
2026-09-10 3:43 ` sashiko-bot
2026-09-10 3:21 ` [PATCH 15/15] HID: hid-oxp: add X2 auxiliary RGB zones Andrei Aldea
2026-09-10 3:44 ` sashiko-bot
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=20260910033425.97F311F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=andrei1998@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-leds@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.