From: sashiko-bot@kernel.org
To: "Qianhui Xu" <xiaqinghuan@mail.ustc.edu.cn>
Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v3] Input: aw86927 - stop playback over suspend and on shutdown
Date: Tue, 24 Nov 2026 02:03:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-230375@kernel.org> (raw)
In-Reply-To: <20261124015028.1427420-7-xiaqinghuan@mail.ustc.edu.cn>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] Input: aw86927: missing Signed-off-by trailer in commit message
- [Medium] Input: aw86927: uninitialized work_struct in aw86927_reset()
on probe error
- [Medium] Input: aw86927: race in aw86927_close() allows timer to
restart playback
- [Low] Input: aw86927: inaccurate chip state claims in commit message
and comment
--
commit a797a001f2024a181e85b8bd947512d590b74fb5
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
> Input: aw86927 - stop playback over suspend and on shutdown
>
> Playback is not stopped across system sleep or shutdown: an effect
> that is
> being played when the system suspends keeps the chip driving the
> actuator,
> and nothing holds the chip in reset on shutdown or unbind.
>
> Park the chip in standby on suspend (resume leaves it in reset, as probe
> does), assert reset on shutdown, and drain the work item in a devres
> action
> so it runs on unbind as well: the memless effect timer can queue the
> work
> again when input_close_device() is skipped for an inhibited device, and
> the
> work must not reach the regmap after the device is gone.
> Changes since v2:
> - [sashiko, 2026-11-17, High] "race in aw86927_close() and unbind
> queues
> play_work after stop": the devres action now drains the work item
> before
> asserting reset, so an effect timer that re-queued the work
> (inhibited
> device, or a flush interrupted by a signal) cannot reach the regmap
> after
> the device is gone. aw86927_shutdown() calls the same helper.
> - [sashiko, same report, Low] "commit message and comment mismatch on
> suspend/shutdown": the message now states that suspend parks the
> chip in
> standby without asserting reset and shutdown asserts reset without a
> separate stop, which is what the code does.
[Severity: High]
The commit message is missing a Signed-off-by: trailer.
> diff --git a/drivers/input/misc/aw86927.c b/drivers/input/misc/aw86927.c
> index e1b811e183ea2..a94eb27a82b1b 100644
> --- a/drivers/input/misc/aw86927.c
> +++ b/drivers/input/misc/aw86927.c
[ ... ]
> @@ -335,22 +337,26 @@ static int aw86927_haptics_play(struct input_dev *dev, void *data, struct ff_eff
> struct aw86927_data *haptics = input_get_drvdata(dev);
> int level;
>
> + /* The chip is powered down; a queued event would only fail. */
> + if (haptics->suspended)
> + return 0;
[Severity: Low]
This isn't a bug, but is this comment accurate? aw86927_suspend() only
parks the chip in standby mode via aw86927_stop() rather than powering it
down, so events are ignored here to avoid restarting playback while
suspended.
Similarly, the commit message says "resume leaves it in reset, as probe
does", whereas both aw86927_probe() and aw86927_resume() leave the chip out
of reset in standby mode with SRAM initialized. The "Changes since v2:"
notes should also go below the "---" separator rather than in the permanent
changelog.
[ ... ]
> @@ -410,6 +417,7 @@ static void aw86927_close(struct input_dev *input)
> int err;
>
> cancel_work_sync(&haptics->play_work);
> + WRITE_ONCE(haptics->level, 0);
>
> err = aw86927_stop(haptics);
> if (err)
[Severity: Medium]
Can clearing haptics->level in aw86927_close() without blocking
aw86927_haptics_play() cause ml_effect_timer() to restart playback while or
after the device is closed?
When the input device is inhibited via input_inhibit_device(), or when
input_flush_device() is skipped for a revoked client or interrupted by a
signal in evdev_release(), active memless effects are not flushed before
dev->close() runs:
CPU0 CPU1 (<softirq>)
aw86927_close()
cancel_work_sync(&haptics->play_work)
WRITE_ONCE(haptics->level, 0)
ml_effect_timer()
aw86927_haptics_play()
/* haptics->level (0) != level */
WRITE_ONCE(haptics->level, level)
schedule_work(&haptics->play_work)
aw86927_stop(haptics)
aw86927_haptics_play_work()
aw86927_play_sine() <-- restarts
Because haptics->level is reset to 0, even a constant-magnitude effect that
previously matched haptics->level sees a level change on the next timer tick
and schedules play_work, leaving the actuator running while the device is
closed or inhibited.
[ ... ]
> @@ -762,6 +771,20 @@ static int aw86927_detect(struct aw86927_data *haptics)
> return 0;
> }
>
> +static void aw86927_reset(void *data)
> +{
> + struct aw86927_data *haptics = data;
> +
> + /*
> + * Drain the worker before the regmap can go away: this action also runs
> + * from devres on unbind, where input_close_device() may have been skipped
> + * (inhibited device) and the memless effect timer can have queued the
> + * work again.
> + */
> + disable_work_sync(&haptics->play_work);
> + gpiod_set_value_cansleep(haptics->reset_gpio, 1);
> +}
> +
> static int aw86927_probe(struct i2c_client *client)
> {
> struct aw86927_data *haptics;
> @@ -790,6 +813,10 @@ static int aw86927_probe(struct i2c_client *client)
> return dev_err_probe(haptics->dev, PTR_ERR(haptics->reset_gpio),
> "Failed to get reset gpio\n");
>
> + err = devm_add_action_or_reset(haptics->dev, aw86927_reset, haptics);
> + if (err)
> + return err;
[Severity: Medium]
Does aw86927_reset() call disable_work_sync(&haptics->play_work) before
haptics->play_work is initialized if probe fails early?
aw86927_probe() does not call INIT_WORK(&haptics->play_work, ...) until
after the software reset, aw86927_detect(), interrupt register setup, and
devm_request_threaded_irq(). If any of those steps fails, devres runs
aw86927_reset() with play_work.func still NULL, triggering
WARN_ON(!work->func) in __flush_work(). Initializing haptics->play_work
before devm_add_action_or_reset() avoids this regression.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124015028.1427420-7-xiaqinghuan@mail.ustc.edu.cn?part=1
prev parent reply other threads:[~2026-11-24 2:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 1:50 [PATCH v3 0/6] Input: aw86927 - add AW86937 support and fix the AW8693X layout Qianhui Xu
2026-11-24 1:50 ` [PATCH v3 1/6] Input: aw86927 - fix the 7 V boost reference for AW86938 Qianhui Xu
2026-11-24 1:50 ` [PATCH v3 2/6] Input: aw86927 - widen the AW86938 boost mode mask Qianhui Xu
2026-11-24 1:50 ` [PATCH v3 3/6] dt-bindings: input: awinic,aw86927: document the AW86937 variant Qianhui Xu
2026-11-24 1:50 ` [PATCH v3 4/6] Input: aw86927 - add support for Awinic AW86937 Qianhui Xu
2026-11-24 1:50 ` [PATCH v3 5/6] Input: aw86927 - handle the AW8693X play and boost register layout Qianhui Xu
2026-11-24 1:50 ` [PATCH v3] Input: aw86927 - stop playback over suspend and on shutdown Qianhui Xu
2026-11-24 2:03 ` sashiko-bot [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=sashiko-outbox-230375@kernel.org \
--to=sashiko-bot@kernel.org \
--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 \
--cc=xiaqinghuan@mail.ustc.edu.cn \
/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