From: sashiko-bot@kernel.org
To: "Rong Zhang" <i@rong.moe>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v6 06/13] HID: haptic: Convert to a loadable plugin module
Date: Wed, 02 Dec 2026 19:07:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-246526@kernel.org> (raw)
In-Reply-To: <20261203-hid-haptic-kmod-v6-6-95a1273b9e40@rong.moe>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: input: drv->input_configured() runs before haptic FF
checks
--
commit 8be6fb5c6f2eedc7e241b2c32350b9e02e719950
Author: Rong Zhang <i@rong.moe>
HID: haptic: Convert to a loadable plugin module
This commit converts hid-haptic into a loadable hid-plugin module and
moves the haptic initialization hooks from hid-multitouch into hid-input.
Link: https://lore.kernel.org/linux-input/auypydfkhx2eg7vp764way4batdilzc35inqda3exwzs3tk3ff@oagat6g46zto/
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index 80cdd2f2beffe..847621d53a61b 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
[ ... ]
> @@ -2409,21 +2424,38 @@ int hidinput_connect(struct hid_device *hid, unsigned int connect_mask)
>
> hidinput_change_resolution_multipliers(hid);
>
> + haptic_ff = hid_haptic_input_configured(hid, NULL) >= 0;
> +
> list_for_each_entry_safe(hidinput, next, &hid->inputs, list) {
> + bool first = list_is_first(&hidinput->list, &hid->inputs);
> +
> if (drv->input_configured &&
> drv->input_configured(hid, hidinput))
> goto out_unwind;
>
> + if (first) {
> + driver_ff = hid_has_ff_input(hid) || !(connect_mask & HID_CONNECT_FF);
> + if (haptic_ff && driver_ff) {
> + hid_info(hid, "prefer driver's FF over haptic\n");
> + haptic_ff = false;
> + }
> + }
> +
> if (!hidinput_has_been_populated(hidinput)) {
> /* no need to register an input device not populated */
> hidinput_cleanup_hidinput(hid, hidinput);
> continue;
> }
>
> - if (list_is_first(&hidinput->list, &hid->inputs) &&
> - (connect_mask & HID_CONNECT_FF) && hid->ff_init &&
> - !hid_has_ff_input(hid))
> - hid->ff_init(hid);
> + if (first && !driver_ff && hid->ff_init)
> + driver_ff = !hid->ff_init(hid);
> +
> + if (haptic_ff && driver_ff) {
> + hid_info(hid, "prefer PIDFF over haptic\n");
> + haptic_ff = false;
> + } else if (haptic_ff) {
> + haptic_ff = hid_haptic_input_configured(hid, hidinput) >= 0;
> + }
>
> if (input_register_device(hidinput->input))
> goto out_unwind;
[Severity: Medium]
Can calling drv->input_configured() before hid_haptic_input_configured()
and the driver_ff checks leave the multitouch device configured with
INPUT_MT_TOTAL_FORCE and td->is_haptic_touchpad set when haptic FF is
skipped or fails to initialize?
Before this commit, mt_input_configured() ran
hid_haptic_input_configured() and updated td->is_haptic_touchpad before
calling mt_touch_input_configured(). Now, hid_haptic_input_configured()
with NULL only checks prerequisites, so haptic->input_dev is still equal
to hi->input when drv->input_configured() runs:
drivers/hid/hid-multitouch.c:mt_touch_input_configured() {
...
if (td->is_haptic_touchpad && hid_haptic_connected_to_input(hdev, input))
app->mt_flags |= INPUT_MT_TOTAL_FORCE;
...
ret = input_mt_init_slots(input, td->maxcontacts, app->mt_flags);
...
}
If haptic FF is then skipped because driver_ff is true, or if
hid_haptic_init() fails inside hid_haptic_input_configured(hid, hidinput),
the input device is registered with INPUT_MT_TOTAL_FORCE enabled (changing
ABS_PRESSURE pointer emulation) without FF_HAPTIC or
INPUT_PROP_PRESSUREPAD, and td->is_haptic_touchpad stays true for the life
of the device.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-hid-haptic-kmod-v6-0-95a1273b9e40@rong.moe?part=6
next prev parent reply other threads:[~2026-12-02 19:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 18:33 [PATCH v6 00/13] HID: Add hid-plugin framework & convert hid-haptic into a generic plugin Rong Zhang
2026-12-02 18:33 ` [PATCH v6 01/13] HID: haptic: Get rid of input_ff_destroy() in error paths Rong Zhang
2026-12-02 18:33 ` [PATCH v6 02/13] HID: haptic: Fix use-after-free when draining workqueue Rong Zhang
2026-12-02 18:33 ` [PATCH v6 03/13] HID: haptic, multitouch: Check haptic prerequisite properly Rong Zhang
2026-12-02 18:33 ` [PATCH v6 04/13] HID: haptic: Postpone GET_REPORT to init Rong Zhang
2026-12-02 18:33 ` [PATCH v6 05/13] HID: Add hid-plugin framework for loadable plugin modules Rong Zhang
2026-12-02 18:33 ` [PATCH v6 06/13] HID: haptic: Convert to a loadable plugin module Rong Zhang
2026-12-02 19:07 ` sashiko-bot [this message]
2026-12-02 18:33 ` [PATCH v6 07/13] HID: haptic: Adopt pr_fmt, dev_fmt and hid_*() printk helpers Rong Zhang
2026-12-02 18:33 ` [PATCH v6 08/13] HID: Add Ordinal page defines Rong Zhang
2026-12-02 18:33 ` [PATCH v6 09/13] HID: haptic: Handle list reports separately and make auto trigger optional Rong Zhang
2026-12-02 18:33 ` [PATCH v6 10/13] HID: haptic: Decouple from hid-multitouch and support other devices Rong Zhang
2026-12-02 19:08 ` sashiko-bot
2026-12-02 18:33 ` [PATCH v6 11/13] HID: haptic: Add quirk table Rong Zhang
2026-12-02 18:33 ` [PATCH v6 12/13] HID: haptic: Add HID_HAPTIC_QUIRK_NO_RETRIGGER to disable retriggering Rong Zhang
2026-12-02 18:33 ` [PATCH v6 13/13] HID: haptic: Add quirk flag for Logitech MX Master 4 Rong Zhang
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-246526@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=i@rong.moe \
--cc=linux-input@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 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.