Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: conor+dt@kernel.org, linux-input@vger.kernel.org,
	devicetree@vger.kernel.org, dmitry.torokhov@gmail.com,
	robh@kernel.org
Subject: Re: [PATCH v7 4/7] input: keyboard: Add driver for ASUS Transformer dock multimedia keys
Date: Mon, 18 May 2026 11:46:30 +0000	[thread overview]
Message-ID: <20260518114630.777A8C2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <20260518095907.36158-5-clamor95@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Registering a statically allocated `struct input_handler` in the per-device probe function violates the driver model and causes list corruption.
- [High] The input handler permanently opens all `EV_KEY` input devices in the system without declaring itself as a passive observer, preventing runtime suspend.
--

commit 3ac5537da45198a85ba82452de2c64484baeac36
Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>

input: keyboard: Add driver for ASUS Transformer dock multimedia keys

This adds support for the multimedia top button row of the ASUS Transformer
Mobile Dock keyboard. It defaults to function keys (F1-F12) and uses an input
handler to monitor system-wide key events to switch to multimedia keys when
ScreenLock + AltGr are pressed.

> diff --git a/drivers/input/keyboard/asus-transformer-ec-keys.c b/drivers/input/keyboard/asus-transformer-ec-keys.c
> new file mode 100644
> index 0000000000000..d30d991773744
> --- /dev/null
> +++ b/drivers/input/keyboard/asus-transformer-ec-keys.c
[ ... ]
> +static int asus_ec_input_connect(struct input_handler *handler,
> +				 struct input_dev *dev,
> +				 const struct input_device_id *id)
> +{
> +	struct input_handle *handle;
> +	int error;
[ ... ]
> +	error = input_open_device(handle);
> +	if (error)
> +		goto err_unregister_handle;
> +
> +	return 0;

[ ... ]

> +static struct input_handler asus_ec_input_handler = {
> +	.name =	"asusec-media-handler",
> +	.event = asus_ec_input_event,
> +	.connect = asus_ec_input_connect,
> +	.disconnect = asus_ec_input_disconnect,
> +	.id_table = asus_ec_input_ids,
> +};

Because this handler connects to all EV_KEY devices and calls
input_open_device() without setting .passive_observer = true, will this
increment the dev->users count for every matching input device in the system?

Could this force all EV_KEY input devices to remain open and active
permanently, preventing them from entering runtime suspend?

[ ... ]

> +static int asus_ec_keys_probe(struct platform_device *pdev)
> +{
[ ... ]
> +	asus_ec_input_handler.private = priv;
> +	error = input_register_handler(&asus_ec_input_handler);
> +	if (error)
> +		return error;

Since asus_ec_input_handler is a static global structure, what happens if this
driver is probed multiple times (for instance, via sysfs bind/unbind or
multiple ECs)?

If input_register_handler() is called a second time, it will re-initialize the
list head and add an already linked node. Could this corrupt the
input_handler_list?

Should the input_handler be dynamically allocated per-device or embedded within
struct asus_ec_keys_data?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260518095907.36158-1-clamor95@gmail.com?part=4

  reply	other threads:[~2026-05-18 11:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  9:59 [PATCH v7 0/7] mfd: Add support for Asus Transformer embedded controller Svyatoslav Ryhel
2026-05-18  9:59 ` [PATCH v7 1/7] dt-bindings: embedded-controller: document ASUS Transformer EC Svyatoslav Ryhel
2026-05-18 10:09   ` sashiko-bot
2026-05-18  9:59 ` [PATCH v7 2/7] mfd: Add driver for ASUS Transformer embedded controller Svyatoslav Ryhel
2026-05-18 10:31   ` sashiko-bot
2026-05-18  9:59 ` [PATCH v7 3/7] input: serio: Add driver for ASUS Transformer dock keyboard and touchpad Svyatoslav Ryhel
2026-05-18 11:17   ` sashiko-bot
2026-05-18  9:59 ` [PATCH v7 4/7] input: keyboard: Add driver for ASUS Transformer dock multimedia keys Svyatoslav Ryhel
2026-05-18 11:46   ` sashiko-bot [this message]
2026-05-18  9:59 ` [PATCH v7 5/7] leds: Add driver for ASUS Transformer LEDs Svyatoslav Ryhel
2026-05-18 12:02   ` sashiko-bot
2026-05-18  9:59 ` [PATCH v7 6/7] power: supply: Add driver for ASUS Transformer battery Svyatoslav Ryhel
2026-05-18 12:37   ` sashiko-bot
2026-05-18  9:59 ` [PATCH v7 7/7] power: supply: Add charger driver for Asus Transformers Svyatoslav Ryhel

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=20260518114630.777A8C2BCB7@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=robh@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