All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Abdur Rofik" <rofikcoga@gmail.com>
Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-input@vger.kernel.org, robh@kernel.org,
	conor+dt@kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 06/10] Input: touchscreen: add Silicon Works SW42902 support
Date: Wed, 18 Nov 2026 12:17:18 +0000	[thread overview]
Message-ID: <sashiko-outbox-220897@kernel.org> (raw)
In-Reply-To: <20261118120714.31505-7-rofikcoga@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] Input: sw42902: unbalanced regulator disable in
  sw42902_power_off()
--

commit 11bdb001b9ee56acee9761786c40a8731d5ef9cb
Author: Abdur Rofik <rofikcoga@gmail.com>

Input: touchscreen: add Silicon Works SW42902 support

This commit adds an I2C touchscreen driver for the Silicon Works SW42902
controller, handling regulator power sequencing, reset GPIO control, and
multitouch input reporting.

> diff --git a/drivers/input/touchscreen/sw42902.c b/drivers/input/touchscreen/sw42902.c
> new file mode 100644
> index 0000000000000..a68bd850bf2e2
> --- /dev/null
> +++ b/drivers/input/touchscreen/sw42902.c

[ ... ]

> +static void sw42902_power_off(void *data)
> +{
> +	struct sw42902 *ts = data;
> +
> +	gpiod_set_value_cansleep(ts->reset, 1);
> +	usleep_range(1000, 2000);
> +	regulator_bulk_disable(ARRAY_SIZE(ts->supplies), ts->supplies);
> +}
> +
> +static int sw42902_power_on(struct sw42902 *ts)
> +{
> +	int error;
> +
> +	error = regulator_bulk_enable(ARRAY_SIZE(ts->supplies), ts->supplies);
> +	if (error)
> +		return error;

[ ... ]

> +static int sw42902_probe(struct i2c_client *client)
> +{

[ ... ]

> +	error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->supplies), ts->supplies);
> +	if (error)
> +		return dev_err_probe(dev, error, "failed to get regulators\n");
> +
> +	error = devm_add_action_or_reset(dev, sw42902_power_off, ts);
> +	if (error)
> +		return error;
> +
> +	input = devm_input_allocate_device(dev);
> +	if (!input)
> +		return -ENOMEM;

[ ... ]

> +	error = devm_request_threaded_irq(dev, client->irq, NULL, sw42902_irq,
> +					  IRQF_ONESHOT | IRQF_NO_AUTOEN,
> +					  dev_name(dev), ts);
> +	if (error)
> +		return error;
> +
> +	error = sw42902_power_on(ts);
> +	if (error)
> +		return error;

[Severity: Medium]
Can sw42902_power_off() call regulator_bulk_disable() when ts->supplies
are not enabled?

devm_add_action_or_reset() registers sw42902_power_off() before
sw42902_power_on() enables the regulators, so a failure in
devm_input_allocate_device(), input_mt_init_slots(),
devm_request_threaded_irq(), or regulator_bulk_enable() itself runs
sw42902_power_off() on disabled regulators and triggers an unbalanced
regulator disable warning.  The same happens on driver unbind while
suspended or after a failed sw42902_resume(), because sw42902_suspend()
already called sw42902_power_off() and set ts->suspended = true.

Registering the devres action right after sw42902_power_on() succeeds
(and before devm_request_threaded_irq(), so the IRQ is freed before power
is cut on unbind) and skipping sw42902_power_off() when ts->suspended is
set would avoid the unbalanced disables.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118120714.31505-1-rofikcoga@gmail.com?part=6

  reply	other threads:[~2026-11-18 12:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 12:07 [PATCH v2 00/10] arm64: dts: qcom: add LG V60 ThinQ 5G (timelm) support Abdur Rofik
2026-11-18 12:07 ` [PATCH v2 01/10] dt-bindings: arm: qcom: add LG V60 ThinQ 5G (timelm) Abdur Rofik
2026-11-18 12:07 ` [PATCH v2 02/10] arm64: dts: qcom: add LG V60 ThinQ 5G (timelm) support Abdur Rofik
2026-11-18 12:36   ` sashiko-bot
2026-11-18 12:07 ` [PATCH v2 03/10] dt-bindings: display: panel: add LG SW43103 Abdur Rofik
2026-11-18 12:07 ` [PATCH v2 04/10] drm/panel: add LG SW43103 panel driver Abdur Rofik
2026-11-18 12:07 ` [PATCH v2 05/10] dt-bindings: input: touchscreen: add Silicon Works SW42902 Abdur Rofik
2026-11-18 12:07 ` [PATCH v2 06/10] Input: touchscreen: add Silicon Works SW42902 support Abdur Rofik
2026-11-18 12:17   ` sashiko-bot [this message]
2026-11-18 12:07 ` [PATCH v2 07/10] arm64: dts: qcom: sm8250-lg-timelm: enable SW43103 panel Abdur Rofik
2026-11-18 12:26   ` sashiko-bot
2026-11-18 12:07 ` [PATCH v2 08/10] arm64: dts: qcom: sm8250-lg-timelm: add SW42902 touchscreen Abdur Rofik
2026-11-18 12:27   ` sashiko-bot
2026-11-18 12:07 ` [PATCH v2 09/10] arm64: dts: qcom: sm8250-lg-timelm: enable USB Type-C Abdur Rofik
2026-11-18 12:07 ` [PATCH v2 10/10] arm64: dts: qcom: sm8250-lg-timelm: add QCA6390 Bluetooth Abdur Rofik

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-220897@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-input@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=rofikcoga@gmail.com \
    --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.