Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chen-Yu Tsai" <wenst@chromium.org>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
	linux-input@vger.kernel.org, conor+dt@kernel.org,
	dmitry.torokhov@gmail.com
Subject: Re: [PATCH v3 6/9] i2c: of-prober: Defer regulator_disable() on successful probe in simple helper
Date: Tue, 21 Jul 2026 08:06:01 +0000	[thread overview]
Message-ID: <20260721080602.26A121F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260721075226.2347933-7-wenst@chromium.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Unconditional 100ms boot delay during cleanup when no I2C component is found.
--

--- Patch [6]: [PATCH v3 6/9] i2c: of-prober: Defer regulator_disable() on successful probe in simple helper ---
commit ea6b3a85720b084309159275d4c96f6a15c76ff3
Author: Chen-Yu Tsai <wenst@chromium.org>

i2c: of-prober: Defer regulator_disable() on successful probe in simple helper

This commit introduces a 100ms delay before disabling the regulator during
cleanup. This allows async drivers time to probe and increment the
regulator enable count, avoiding hardware re-initialization delays.

> diff --git a/drivers/i2c/i2c-core-of-prober.c b/drivers/i2c/i2c-core-of-prober.c
> --- a/drivers/i2c/i2c-core-of-prober.c
> +++ b/drivers/i2c/i2c-core-of-prober.c

[ ... ]

> @@ -235,11 +235,23 @@ static int i2c_of_probe_simple_enable_regulator(struct device *dev, struct i2c_o
>  	return 0;
>  }
>  
> -static void i2c_of_probe_simple_disable_regulator(struct device *dev, struct i2c_of_probe_simple_ctx *ctx)
> +static void i2c_of_probe_simple_disable_regulator(struct device *dev,
> +						  struct i2c_of_probe_simple_ctx *ctx,
> +						  bool defer_disable)
>  {
>  	if (!ctx->supply)
>  		return;
>  
> +	/*
> +	 * Wait a bit of time for async drivers to probe and increase the
> +	 * regulator enable count. This allows the drivers to check and
> +	 * skip waiting for re-initialization.
> +	 */
> +	if (defer_disable) {
> +		dev_dbg(dev, "Deferring regulator disable\n");
> +		msleep(100);
> +	}
> +
>  	dev_dbg(dev, "Disabling regulator supply \"%s\"\n", ctx->opts->supply_name);
>  
>  	regulator_disable(ctx->supply);

[ ... ]

> @@ -401,7 +413,7 @@ void i2c_of_probe_simple_cleanup(struct device *dev, void *data)
>  	i2c_of_probe_simple_disable_gpio(dev, ctx);
>  	i2c_of_probe_simple_put_gpiod(ctx);
>  
> -	i2c_of_probe_simple_disable_regulator(dev, ctx);
> +	i2c_of_probe_simple_disable_regulator(dev, ctx, true);

[Severity: Medium]
Will this cause an unconditional 100ms boot delay if no I2C component is
found?

When i2c_of_probe_component() finishes its scan without finding a
responding component, it still unconditionally calls ops->cleanup():

drivers/i2c/i2c-core-of-prober.c:i2c_of_probe_component() {
    ...
    if (ops->cleanup)
        ops->cleanup(dev, ctx);
    ...
}

This invokes i2c_of_probe_simple_cleanup(), which now passes
defer_disable = true, triggering the msleep(100) even when nothing was
probed.

Could this delay be skipped if no component was actually found?

>  	i2c_of_probe_simple_put_supply(ctx);
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721075226.2347933-1-wenst@chromium.org?part=6

  reply	other threads:[~2026-07-21  8:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  7:52 [PATCH v3 0/9] arm64: mediatek: Chromebook trackpad supply fixes Chen-Yu Tsai
2026-07-21  7:52 ` [PATCH v3 1/9] regulator: core: Add "enable and wait" functions Chen-Yu Tsai
2026-07-21  8:08   ` sashiko-bot
2026-07-21  8:22     ` Chen-Yu Tsai
2026-07-21  9:54   ` Andy Shevchenko
2026-07-21  7:52 ` [PATCH v3 2/9] Input: elan_i2c - sort include statements Chen-Yu Tsai
2026-07-21 10:20   ` Andy Shevchenko
2026-07-21  7:52 ` [PATCH v3 3/9] Input: elan_i2c - Wait for initialization after enabling regulator supply Chen-Yu Tsai
2026-07-21  8:07   ` sashiko-bot
2026-07-21  7:52 ` [PATCH v3 4/9] HID: i2c-hid-of: skip post-power-on delay if powered on sufficiently long Chen-Yu Tsai
2026-07-21  8:06   ` sashiko-bot
2026-07-21  7:52 ` [PATCH v3 5/9] i2c: of-prober: " Chen-Yu Tsai
2026-07-21  7:52 ` [PATCH v3 6/9] i2c: of-prober: Defer regulator_disable() on successful probe in simple helper Chen-Yu Tsai
2026-07-21  8:06   ` sashiko-bot [this message]
2026-07-21 10:24   ` Andy Shevchenko
2026-07-21  7:52 ` [PATCH v3 7/9] platform/chrome: of_hw_prober: Add delay for hana trackpads Chen-Yu Tsai
2026-07-21 10:27   ` Andy Shevchenko
2026-07-21  7:52 ` [PATCH v3 8/9] arm64: dts: mediatek: mt8173-elm-hana: Unmark trackpad supply as always-on Chen-Yu Tsai
2026-07-21  7:52 ` [PATCH v3 9/9] arm64: dts: mediatek: mt8192-asurada-spherion: Add Synaptics trackpad's supply Chen-Yu Tsai

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=20260721080602.26A121F000E9@smtp.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=wenst@chromium.org \
    /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