Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "David Heidelberg" <david@ixit.cz>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v8 1/5] Input: stmfts - wait for controller ready after reset
Date: Fri, 25 Sep 2026 21:35:06 +0000	[thread overview]
Message-ID: <20260925213507.744941F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260925-stmfts5-v8-1-0fcf49e2c85f@ixit.cz>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] input: stmfts: premature command completion due to missing event flush
--

commit 980291fffea4f1302d4d35aa190de1039c220daa
Author: David Heidelberg <david@ixit.cz>

    Input: stmfts - wait for controller ready after reset
    
This commit removes fixed sleeps in favor of waiting for a controller ready
event after reset. It adds a wait_for_completion_timeout for the reset
GPIO path, while preserving a 70ms sleep for boards without a reset GPIO.

> diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
> index 972687797f826..1720202d6186b 100644
> --- a/drivers/input/touchscreen/stmfts.c
> +++ b/drivers/input/touchscreen/stmfts.c
[ ... ]
> @@ -587,27 +580,50 @@ static int stmfts_power_on(struct stmfts_data *sdata)
[ ... ]
> +	} else {
> +		/*
> +		 * We do not know the real controller state (was it powered
> +		 * off or reset). Let's hope that this is enough time to
> +		 * initialize.
> +		 */
> +		msleep(70);
> +
> +		enable_irq(sdata->client->irq);
> +	}
>  
> -	msleep(50);
> +	err = stmfts_read_system_info(sdata);
> +	if (err)
> +		goto err_disable_irq;
>  
>  	err = stmfts_configure(sdata);

[Severity: High]
Does removing the msleep(50) here introduce a race condition on boards
without a reset GPIO?

By enabling the IRQ and immediately proceeding without the 50ms flush window,
the threaded IRQ handler can process the pending STMFTS_EV_CONTROLLER_READY
boot event concurrently with stmfts_configure().

If stmfts_configure() calls stmfts_command() to send STMFTS_SYSTEM_RESET:

stmfts_command()
    reinit_completion(&sdata->cmd_done);
    err = i2c_smbus_write_byte(sdata->client, cmd);
    ...
    if (!wait_for_completion_timeout(&sdata->cmd_done, ...))

And the concurrent IRQ handler processes the boot event and completes the
same completion:

IRQ handler
    ...
    complete(&sdata->cmd_done);

Will this cause the wait_for_completion_timeout() in stmfts_command() to
falsely succeed before the hardware actually processes the reset command?

If so, the driver might send subsequent initialization commands while the
hardware is still physically executing the reset, potentially causing the
touchscreen to fail.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925-stmfts5-v8-0-0fcf49e2c85f@ixit.cz?part=1

  reply	other threads:[~2026-09-25 21:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 21:22 [PATCH v8 0/5] Input: support for STM FTS5 David Heidelberg via B4 Relay
2026-09-25 21:22 ` [PATCH v8 1/5] Input: stmfts - wait for controller ready after reset David Heidelberg via B4 Relay
2026-09-25 21:35   ` sashiko-bot [this message]
2026-09-25 22:18   ` Dmitry Torokhov
2026-09-25 21:22 ` [PATCH v8 2/5] dt-bindings: input: touchscreen: st,stmfts: Improve example David Heidelberg via B4 Relay
2026-09-29  8:28   ` Krzysztof Kozlowski
2026-09-25 21:22 ` [PATCH v8 3/5] dt-bindings: input: touchscreen: st,stmfts: Introduce STM FTS5 David Heidelberg via B4 Relay
2026-09-25 21:32   ` sashiko-bot
2026-09-29  8:40   ` Krzysztof Kozlowski
2026-09-25 21:22 ` [PATCH v8 4/5] Input: stmfts - support FTS5 David Heidelberg via B4 Relay
2026-09-25 21:33   ` sashiko-bot
2026-09-25 21:22 ` [PATCH v8 5/5] arm64: dts: qcom: sdm845-google: Add STM FTS touchscreen support David Heidelberg via B4 Relay

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=20260925213507.744941F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=david@ixit.cz \
    --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