mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mark Pearson" <mpearson-lenovo@squebb.ca>
To: "Ian Rogers" <irogers@google.com>,
	"Derek J . Clark" <derekjohn.clark@gmail.com>,
	"Jiri Kosina" <jikos@kernel.org>,
	"Benjamin Tissoires" <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, "Elkin Cruz" <elkin@google.com>
Subject: Re: [PATCH] HID: lenovo-go: Fix reset_tx_dongle sysfs attribute to be write-only
Date: Mon, 23 Nov 2026 11:55:17 -0500	[thread overview]
Message-ID: <3e9ccb31-6c81-47a4-a441-e7cfb786b2c5@app.fastmail.com> (raw)
In-Reply-To: <20261119170418.1511770-1-irogers@google.com>


On Thu, Nov 19, 2026, at 12:04 PM, Ian Rogers wrote:
> reset_tx_dongle is defined with LEGO_DEVICE_ATTR_RO(), whereas all other
> FEATURE_RESET_GAMEPAD attributes in hid-lenovo-go.c (reset_mcu,
> reset_left, and reset_right) use LEGO_DEVICE_ATTR_WO().
>
> Because feature_status_show() has no case for FEATURE_RESET_GAMEPAD
> (which is only handled in feature_status_store()), exposing tx_dongle's
> reset attribute as read-only makes reading it always fail with -EINVAL
> while preventing userspace from writing to it to reset the TX dongle.
>
> Change reset_tx_dongle to LEGO_DEVICE_ATTR_WO().
>
> Found by enabling Clang's -Wswitch-enum on an x86_64 allyesconfig build,
> with AI coding assistant help to audit the warning and prepare the fix.
> Build-tested with Clang; not runtime-tested on Lenovo Legion Go hardware.
>
> Fixes: 82cd9bc866e1 ("HID: hid-lenovo-go: Add Feature Status Attributes")
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  drivers/hid/hid-lenovo-go.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-lenovo-go.c b/drivers/hid/hid-lenovo-go.c
> index 318b1152ff8b..8a2aa2b4825d 100644
> --- a/drivers/hid/hid-lenovo-go.c
> +++ b/drivers/hid/hid-lenovo-go.c
> @@ -1848,7 +1848,7 @@ static struct go_cfg_attr version_gen_tx_dongle = 
> { HARDWARE_GENERATION };
>  LEGO_DEVICE_ATTR_RO(version_gen_tx_dongle, "hardware_generation", 
> TX_DONGLE, version);
> 
>  static struct go_cfg_attr reset_tx_dongle = { FEATURE_RESET_GAMEPAD };
> -LEGO_DEVICE_ATTR_RO(reset_tx_dongle, "reset", TX_DONGLE, feature_status);
> +LEGO_DEVICE_ATTR_WO(reset_tx_dongle, "reset", TX_DONGLE, feature_status);
> 
>  static struct attribute *tx_dongle_attrs[] = {
>  	&dev_attr_reset_tx_dongle.attr,
> -- 
> 2.56.1.708.g77570a6a1d-goog

This looks good to me

Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Mark

      reply	other threads:[~2026-11-23 16:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 17:04 Ian Rogers
2026-11-23 16:55 ` Mark Pearson [this message]

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=3e9ccb31-6c81-47a4-a441-e7cfb786b2c5@app.fastmail.com \
    --to=mpearson-lenovo@squebb.ca \
    --cc=bentiss@kernel.org \
    --cc=derekjohn.clark@gmail.com \
    --cc=elkin@google.com \
    --cc=irogers@google.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@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

all inboxes | Powered by JetHome®