Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Denis Benato" <denis.benato@linux.dev>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v6 10/13] HID: asus: add support to force feedback
Date: Tue, 08 Sep 2026 18:01:38 +0000	[thread overview]
Message-ID: <20260908180138.C20601F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260908174433.74260-11-denis.benato@linux.dev>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Initialization race: Force-feedback is explicitly disabled after the input device is registered, which can overwrite initial userspace effects.
- [Medium] The patch modifies `ally_config_remove` to check `cfg->resp_curve_support`, which is an unrelated silent fix.
--

commit c8ce80cc859079772aca255e9aa0ce6f78c88d5a
Author: Denis Benato <denis.benato@linux.dev>

HID: asus: add support to force feedback

Unlike ROG ally the X version and following ones uses DInput protocol
and the force feedback needs to be implemented as its protocol is
vendor-specific, therefore add support for FF_RUMBLE with magnitude
scaling on a work-queue based approach to avoid using possibly
sleeping calls in atomic context.

> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index f338c0eed54b3..a75e6bd947907 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c

[ ... ]

> @@ -2544,7 +2580,8 @@ static void ally_config_remove(struct hid_device *hdev, struct ally_config *cfg)
>  	 * create them, so a device without those capabilities does not
>  	 * trigger a "not found" warning.
>  	 */
> -	if (cfg->user_cal_support || cfg->anti_deadzone_support) {
> +	if (cfg->user_cal_support || cfg->anti_deadzone_support ||
> +	    cfg->resp_curve_support) {

[Severity: Medium]
This modifies the sysfs group cleanup behavior for joystick response curves,
which appears unrelated to the stated goal of adding force-feedback support.

Should this change be split into a separate patch to keep changes focused and
match the commit message?

>  		for (i = 0; i < ARRAY_SIZE(ally_cal_attr_groups); i++)
>  			sysfs_remove_group(&hdev->dev.kobj,
>  						   ally_cal_attr_groups[i]);

[ ... ]

> @@ -3074,9 +3264,17 @@ static struct ally_handheld *hid_asus_ally_probe(struct hid_device *hdev)
>  			return ERR_PTR(ret);
>  		}
>  
> -		spin_lock_irqsave(&ally_data_lock, flags);
> -		ally_drvdata.ally_x_hdev = hdev;
> -		spin_unlock_irqrestore(&ally_data_lock, flags);
> +		/*
> +		 * Make sure rumble starts disabled: this is the interface that
> +		 * owns the force-feedback output report. Failure is non-critical.
> +		 */
> +		scoped_guard(mutex, &ally_drvdata.intf_mutex) {
> +			ret = ally_x_send_ff_off(hdev);

[Severity: Medium]
Because ally_x_setup_input() runs just before this block and registers the
input device, the device node is exposed to userspace before this hardware
initialization packet is sent.

Can this result in a race where a userspace daemon immediately opens the device
and sends an initial rumble effect, which then gets silently canceled by this
OFF packet?

> +			if (ret < 0)
> +				hid_warn(hdev, "Failed to disable force-feedback: %d\n",
> +					  ret);
> +		}
> +
>  		break;
>  	case HID_ALLY_INTF_KEYBOARD_IN:

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908174433.74260-1-denis.benato@linux.dev?part=10

  reply	other threads:[~2026-09-08 18:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 17:44 [PATCH v6 00/13] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-09-08 17:44 ` [PATCH v6 01/13] HID: asus: do not send keyboard init reports to touchpads Denis Benato
2026-09-08 17:44 ` [PATCH v6 02/13] HID: asus: reinitialize the device after exiting a sleep state Denis Benato
2026-09-08 18:00   ` sashiko-bot
2026-09-08 17:44 ` [PATCH v6 03/13] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-09-08 17:57   ` sashiko-bot
2026-09-08 17:44 ` [PATCH v6 04/13] HID: asus: add gamepad configuration Denis Benato
2026-09-08 18:01   ` sashiko-bot
2026-09-08 17:44 ` [PATCH v6 05/13] HID: asus: add vibration strength configuration Denis Benato
2026-09-08 17:44 ` [PATCH v6 06/13] HID: asus: add joysticks inner and outer range configuration Denis Benato
2026-09-08 17:44 ` [PATCH v6 07/13] HID: asus: add triggers " Denis Benato
2026-09-08 17:44 ` [PATCH v6 08/13] HID: asus: add joysticks anti-deadzone configuration Denis Benato
2026-09-08 17:44 ` [PATCH v6 09/13] HID: asus: add support for response curve Denis Benato
2026-09-08 18:13   ` sashiko-bot
2026-09-08 17:44 ` [PATCH v6 10/13] HID: asus: add support to force feedback Denis Benato
2026-09-08 18:01   ` sashiko-bot [this message]
2026-09-08 17:44 ` [PATCH v6 11/13] HID: asus: add support for gamepad mode Denis Benato
2026-09-08 17:44 ` [PATCH v6 12/13] HID: asus: add support for turbo buttons Denis Benato
2026-09-08 18:08   ` sashiko-bot
2026-09-08 17:44 ` [PATCH v6 13/13] HID: asus: add support for btn remapping Denis Benato
2026-09-08 18:07   ` sashiko-bot

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=20260908180138.C20601F00A3E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=denis.benato@linux.dev \
    --cc=dmitry.torokhov@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox