From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796344523; b=IigXspyKQdJA+EmFummc82NT1F9PdEJJtY8eb0/deYj7dya3Foz1lMJSrw6aoXcFKQ0v 81NrofOZxsLhxqcVyg1k/dY7Dc5l/9eGkpFHEOzkNkgzq4gZI2lhLI8aFUmXW3ampCanS YXnPzBY/iZA3VaH2TDAQC0bbXjgFXoG2dcEGs+U5+Y883HrD3Y8BwWyeIuVR7sdGVQ77K X1erW8Xyhjqmhfm18+xHjIDjIAP0WOT0W/2o0/cFZkrhImgNDXlkci81vhH12BGwAOuZA A4yEP7LHdiRqx6NuF+Hfz3vkYXDYLBhJ4IXhdfSmxclVSkuOreplx7y8n+i2SRKKQjQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796344523; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=IchtJKTrBmxl9/xMu15Qlq8MQIuqbYRFcOlgCZLL7m0=; b=2IuRcHaU3KPKl2hReGxRcoQv2BMnNL+TG7RbFa/kzkTTXlE/CfracYSfTYOQAeH0U96b Dtt+HoXOGcJQ9/M4bBi8xoeB0b6kHXL1RMZii1Edd8FDXMGxyQgZg+KoNjgURwoLBTClD wGJD+gh1T3gwz9+u/Qu7eQ78lOYKoHItESshOEEDTm2JEYJPy7rLDt2u86eahiGaZotPi tn6D1JecZXOVA9VCoBFhN+E5f3DF+dPVk39xRUPeOL96r0hZL2BmHLQXlkYj8GVM3m8br YkGgN4lrEquJN3qX61n81uR0v2R58eyf5gpOyZC1iza6PdMFRJa6Vo2fncUqy8E78sg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OvpTB8HD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18540606A32C; Fri, 4 Dec 2026 00:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OvpTB8HD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F9EF1F000C2; Fri, 4 Dec 2026 00:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796344522; bh=IchtJKTrBmxl9/xMu15Qlq8MQIuqbYRFcOlgCZLL7m0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=OvpTB8HDgnhp6OdDPSY/LCYlzesgL50RtzcHvSP1/KPNXi7MQq31YJE6JatLE5W2E X7fYCpSPXzI1ELD2EB+aZ/tDYcEnN4Irci23NQ+TA6YBKXRljz35ITEvz3BrT8lVvJ tiDpUut/K+zNNFLv+2gbByQBKk3QgOsO0hyMyLESOTaNM55FMgBdSFNbDwep1+TVmb +CqIwTCJ11eneJIdvwdVftgOm4q5+ykKdHO8CcpgmI0VuzkXOT7CN54ntnqlkzy+bV eblS6eXFXnid0kTgGObNtP+N5isqq4BSe8a6kVjWOZHlrQ84tENv5KXDdeQAVxRrI1 xcobYW/703deg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/8] HID: hid-msi: Move the ROM commit to an explicit apply attribute Reply-To: sashiko-reviews@lists.linux.dev To: "Derek J. Clark" Cc: linux-input@vger.kernel.org, linux-usb@vger.kernel.org, dmitry.torokhov@gmail.com In-Reply-To: <20261204001846.3801336-3-derekjohn.clark@gmail.com> References: <20261204001846.3801336-1-derekjohn.clark@gmail.com> <20261204001846.3801336-3-derekjohn.clark@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 00:35:22 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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, a= nd RGB write paths and exposes it through a new write-only apply sysfs attribu= te 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, struc= t device_attribute *attr, > } > static DEVICE_ATTR_WO(reset); > =20 > +static ssize_t apply_store(struct device *dev, struct device_attribute *= attr, > + const char *buf, size_t count) > +{ > + struct hid_device *hdev =3D to_hid_device(dev); > + struct claw_drvdata *drvdata =3D 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 =3D kstrtobool(buf, &val); > + if (ret) > + return ret; > + > + if (!val) > + return -EINVAL; > + > + flush_delayed_work(&drvdata->rgb_queue); > + > + guard(mutex)(&drvdata->rom_mutex); > + > + ret =3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204001846.3801= 336-1-derekjohn.clark@gmail.com?part=3D2