From: sashiko-bot@kernel.org
To: "Derek J. Clark" <derekjohn.clark@gmail.com>
Cc: linux-input@vger.kernel.org, linux-usb@vger.kernel.org,
dmitry.torokhov@gmail.com
Subject: Re: [PATCH 2/8] HID: hid-msi: Move the ROM commit to an explicit apply attribute
Date: Fri, 04 Dec 2026 00:35:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-248834@kernel.org> (raw)
In-Reply-To: <20261204001846.3801336-3-derekjohn.clark@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] HID: hid-msi: apply_store() commits partial RGB state to ROM
on write error
- [Low] HID: hid-msi: misleading apply sysfs attribute name and missing
ABI doc
--
commit 0c08f61745723f69403b20ee03ff62127d32c4f4
Author: Derek J. Clark <derekjohn.clark@gmail.com>
HID: hid-msi: Move the ROM commit to an explicit apply attribute
This commit removes CLAW_COMMAND_TYPE_SYNC_TO_ROM from the M-key, rumble, and
RGB write paths and exposes it through a new write-only apply sysfs attribute
to reduce internal flash wear.
> diff --git a/drivers/hid/hid-msi.c b/drivers/hid/hid-msi.c
> index d4128955e4637..0e1e5e6f664da 100644
> --- a/drivers/hid/hid-msi.c
> +++ b/drivers/hid/hid-msi.c
[ ... ]
> @@ -852,6 +852,39 @@ static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
> }
> static DEVICE_ATTR_WO(reset);
>
> +static ssize_t apply_store(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct hid_device *hdev = to_hid_device(dev);
> + struct claw_drvdata *drvdata = hid_get_drvdata(hdev);
> + bool val;
> + int ret;
> +
> + scoped_guard(spinlock_irqsave, &drvdata->registration_lock) {
> + /* Pairs with smp_store_release from cfg_setup_fn in system_percpu_wq context */
> + if (!smp_load_acquire(&drvdata->gp_registered))
> + return -ENODEV;
> + }
> +
> + ret = kstrtobool(buf, &val);
> + if (ret)
> + return ret;
> +
> + if (!val)
> + return -EINVAL;
> +
> + flush_delayed_work(&drvdata->rgb_queue);
> +
> + guard(mutex)(&drvdata->rom_mutex);
> +
> + ret = claw_hw_output_report(hdev, CLAW_COMMAND_TYPE_SYNC_TO_ROM, NULL, 0, 0);
> + if (ret)
> + return ret;
> +
> + return count;
> +}
[Severity: Medium]
Can apply_store() commit a partial RGB frame table to flash if the
flushed RGB write fails?
claw_rgb_queue_fn() runs claw_apply_rgb_state() -> claw_write_rgb_state(),
which writes frames in a loop and returns early on a transfer error or ACK
timeout. claw_rgb_queue_fn() logs and discards that error, so
apply_store() still sends CLAW_COMMAND_TYPE_SYNC_TO_ROM and returns count.
Before this patch, an early return in claw_write_rgb_state() skipped the
ROM commit. Recording the RGB write status in drvdata and checking it
under rom_mutex in apply_store() would prevent persisting a partially
updated table and propagate the error to userspace.
> +static DEVICE_ATTR_WO(apply);
[Severity: Low]
Is "apply" a misleading name for a flash commit attribute? The M-key,
rumble, and RGB write paths already apply changes immediately to the active
MCU state, whereas this attribute commits that state to internal flash.
Naming it apply suggests changes are staged until written, which could lead
userspace tools to invoke flash writes after every change and undo the wear
reduction; a name like commit or save_settings would be clearer.
The new sysfs attribute also lacks documentation under
Documentation/ABI/testing/ explaining its behavior and flash-wear impact.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204001846.3801336-1-derekjohn.clark@gmail.com?part=2
next prev parent reply other threads:[~2026-12-04 0:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 0:18 [PATCH 0/8] MSI Claw suspend, resume and ROM commit fixes Derek J. Clark
2026-12-04 0:18 ` [PATCH 1/8] HID: hid-msi: Queue the RGB work item on system_dfl_wq Derek J. Clark
2026-12-04 0:18 ` [PATCH 2/8] HID: hid-msi: Move the ROM commit to an explicit apply attribute Derek J. Clark
2026-12-04 0:35 ` sashiko-bot [this message]
2026-12-04 0:18 ` [PATCH 3/8] HID: hid-msi: Protect the RGB state with frame_lock Derek J. Clark
2026-12-04 0:18 ` [PATCH 4/8] HID: hid-msi: Re-init on reset during resume Derek J. Clark
2026-12-04 0:37 ` sashiko-bot
2026-12-04 0:18 ` [PATCH 5/8] HID: hid-msi: Drain in-flight MCU traffic before suspend Derek J. Clark
2026-12-04 0:38 ` sashiko-bot
2026-12-04 0:18 ` [PATCH 6/8] HID: hid-msi: Defer RGB updates while the MCU is suspended Derek J. Clark
2026-12-04 0:32 ` sashiko-bot
2026-12-04 0:18 ` [PATCH 7/8] HID: hid-msi: Switch the RGB LED to brightness_set_blocking Derek J. Clark
2026-12-04 0:39 ` sashiko-bot
2026-12-04 0:18 ` [PATCH 8/8] USB: core: quirks: Add RESET_RESUME quirk for MSI Claw Derek J. Clark
2026-12-04 0:39 ` [PATCH 0/8] MSI Claw suspend, resume and ROM commit fixes 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=sashiko-outbox-248834@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=derekjohn.clark@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--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