From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org,
mfd@lists.linux.dev, linux-leds@vger.kernel.org, robh@kernel.org,
conor+dt@kernel.org, dmitry.torokhov@gmail.com, lee@kernel.org
Subject: Re: [PATCH v12 3/7] input: serio: Add driver for ASUS Transformer dock keyboard and touchpad
Date: Mon, 19 Oct 2026 10:22:03 +0000 [thread overview]
Message-ID: <sashiko-outbox-176977@kernel.org> (raw)
In-Reply-To: <20261019100406.103687-4-clamor95@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] input: serio: serio ports registered before notifier in asus_ec_kbc_probe()
--
commit 03f99aa77c8833478d88304ecd5af6dc8d7131c2
Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
input: serio: Add driver for ASUS Transformer dock keyboard and touchpad
This commit adds a serio driver for the ASUS Transformer dock keyboard and
touchpad controller, forwarding EC notifications to serio ports and
remapping several non-standard keycodes.
> diff --git a/drivers/input/serio/asus-transformer-ec-kbc.c b/drivers/input/serio/asus-transformer-ec-kbc.c
> new file mode 100644
> index 0000000000000..fa7f7c3f037db
> --- /dev/null
> +++ b/drivers/input/serio/asus-transformer-ec-kbc.c
> @@ -0,0 +1,264 @@
[ ... ]
> +static int asus_ec_register_serio(struct platform_device *pdev, int idx,
> + const char *name, int cmd)
> +{
> + struct asus_ec_kbc_data *priv = platform_get_drvdata(pdev);
> + struct i2c_client *parent = priv->parent;
> + struct serio *port = kzalloc_obj(*port);
> +
> + if (!port)
> + return -ENOMEM;
> +
> + priv->sdev[idx] = port;
> + port->dev.parent = &pdev->dev;
> + port->id.type = SERIO_8042;
> + port->id.extra = cmd & 0xFF;
> + port->write = asus_ec_serio_write;
> + port->port_data = (void *)priv;
> + snprintf(port->name, sizeof(port->name), "%s %s",
> + priv->ec->model, name);
> + snprintf(port->phys, sizeof(port->phys), "i2c-%u-%04x/serio%d",
> + i2c_adapter_id(parent->adapter), parent->addr, idx);
> +
> + serio_register_port(port);
> +
> + return devm_add_action_or_reset(&pdev->dev, asus_ec_serio_remove, port);
> +}
> +
> +static void asus_ec_notifier_chain_unregister(void *data)
> +{
> + struct asus_ec_kbc_data *priv = data;
> + struct asusec_core *ec = priv->ec;
> +
> + blocking_notifier_chain_unregister(&ec->notify_list, &priv->nb);
> +}
> +
> +static int asus_ec_kbc_probe(struct platform_device *pdev)
> +{
> + struct asusec_core *ec = dev_get_drvdata(pdev->dev.parent);
> + struct asus_ec_kbc_data *priv;
> + int error;
> +
> + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, priv);
> +
> + priv->ec = ec;
> + priv->parent = to_i2c_client(pdev->dev.parent);
> +
> + error = asus_ec_register_serio(pdev, 0, "Keyboard", 0);
> + if (error)
> + return error;
> +
> + error = asus_ec_register_serio(pdev, 1, "Touchpad", I8042_CMD_AUX_SEND);
> + if (error)
> + return error;
> +
> + priv->nb.notifier_call = asus_ec_kbc_notify;
> +
> + error = blocking_notifier_chain_register(&ec->notify_list, &priv->nb);
> + if (error)
> + return dev_err_probe(&pdev->dev, error,
> + "failed to register blocking notifier chain");
> +
> + error = devm_add_action_or_reset(&pdev->dev,
> + asus_ec_notifier_chain_unregister,
> + priv);
[Severity: Medium]
Can registering the serio ports before registering the notifier in
asus_ec_kbc_probe() cause a race with serio driver probing?
Inside asus_ec_register_serio(), serio_register_port() immediately queues
SERIO_REGISTER_PORT onto system_long_wq (serio_event_work). If
serio_event_work runs on another CPU before
blocking_notifier_chain_register() completes, serio_add_port() will bind
atkbd or psmouse, which immediately send PS/2 reset and identification
commands via asus_ec_serio_write() and wait for responses via
serio_interrupt().
Since the parent MFD driver has already enabled its IRQ handler
asus_ec_interrupt(), the EC response will be read from ASUSEC_READ_BUF and
passed to blocking_notifier_call_chain(&ddata->ec.notify_list, ...) before
priv->nb is on the list, dropping the response bytes and causing
ps2_command() timeouts.
Similarly, on driver unbind, devm will run
asus_ec_notifier_chain_unregister() before asus_ec_serio_remove() calls
serio_unregister_port(), disconnecting the receive path while the serio
ports and their drivers are still active.
Should the notifier be registered (or gated via serio open/close or
start/stop callbacks with priv->sdev[] initialized beforehand) so that the
receive path is active whenever the serio ports are registered?
> + if (error)
> + return error;
> +
> + return 0;
> +}
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019100406.103687-1-clamor95@gmail.com?part=3
next prev parent reply other threads:[~2026-10-19 10:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 10:03 [PATCH v12 0/7] mfd: Add support for Asus Transformer embedded controller Svyatoslav Ryhel
2026-10-19 10:04 ` [PATCH v12 1/7] dt-bindings: embedded-controller: document ASUS Transformer EC Svyatoslav Ryhel
2026-10-19 10:07 ` sashiko-bot
2026-10-19 10:04 ` [PATCH v12 2/7] mfd: Add driver for ASUS Transformer embedded controller Svyatoslav Ryhel
2026-10-19 10:17 ` sashiko-bot
2026-10-19 10:04 ` [PATCH v12 3/7] input: serio: Add driver for ASUS Transformer dock keyboard and touchpad Svyatoslav Ryhel
2026-10-19 10:22 ` sashiko-bot [this message]
2026-10-20 12:37 ` Svyatoslav Ryhel
2026-10-20 19:04 ` Dmitry Torokhov
2026-10-19 10:04 ` [PATCH v12 4/7] input: keyboard: Add driver for ASUS Transformer dock multimedia keys Svyatoslav Ryhel
2026-10-19 10:10 ` sashiko-bot
2026-10-20 18:54 ` Dmitry Torokhov
2026-10-19 10:04 ` [PATCH v12 5/7] leds: Add driver for ASUS Transformer LEDs Svyatoslav Ryhel
2026-10-19 10:07 ` sashiko-bot
2026-10-19 10:04 ` [PATCH v12 6/7] power: supply: Add driver for ASUS Transformer battery Svyatoslav Ryhel
2026-10-19 10:10 ` sashiko-bot
2026-10-20 13:55 ` Markus Elfring
2026-10-19 10:04 ` [PATCH v12 7/7] power: supply: Add charger driver for Asus Transformers Svyatoslav Ryhel
2026-10-19 10:08 ` sashiko-bot
2026-10-20 0:57 ` [PATCH v12 0/7] mfd: Add support for Asus Transformer embedded controller Florian Krischer
2026-10-20 7:27 ` 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=sashiko-outbox-176977@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=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=mfd@lists.linux.dev \
--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 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.