From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>
Cc: devicetree@vger.kernel.org, lee@kernel.org, robh@kernel.org,
linux-sunxi@lists.linux.dev, mfd@lists.linux.dev,
conor+dt@kernel.org
Subject: Re: [PATCH v9 2/4] mfd: ac200: Add X-Powers AC200 support
Date: Thu, 03 Sep 2026 20:21:28 +0000 [thread overview]
Message-ID: <20260903202129.4DD771F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260903-submit-ac200-mfd-v9-2-6b7ed278989c@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Regmap exposed to userspace and consumers before hardware initialization delay completes.
--
commit 35526ae046a1822af569d5228aa956640657303c
Author: James Hilliard <james.hilliard1@gmail.com>
mfd: ac200: Add X-Powers AC200 support
This commit adds MFD core driver support for the X-Powers AC200 mixed-signal
companion IC. It configures the shared regmap over I2C, handles clock
enabling, and manages the common reset state for the device.
> diff --git a/drivers/mfd/ac200.c b/drivers/mfd/ac200.c
> new file mode 100644
> index 0000000000000..94aa13deb0f8c
> --- /dev/null
> +++ b/drivers/mfd/ac200.c
[ ... ]
> +static int ac200_probe(struct i2c_client *client)
> +{
> + struct device *dev = &client->dev;
> + struct regmap *regmap;
> + struct clk *clk;
> + int ret;
> +
> + clk = devm_clk_get_enabled(dev, NULL);
> + if (IS_ERR(clk))
> + return dev_err_probe(dev, PTR_ERR(clk),
> + "failed to enable input clock\n");
> +
> + ret = devm_clk_rate_exclusive_get(dev, clk);
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to lock clock rate\n");
> +
> + regmap = devm_regmap_init_i2c(client, &ac200_regmap_config);
> + if (IS_ERR(regmap))
> + return dev_err_probe(dev, PTR_ERR(regmap),
> + "failed to initialize regmap\n");
> +
> + /*
> + * No minimum delay is documented. Match the vendor driver's 40 ms delay
> + * before its first AC200 register access after enabling the input clock.
> + */
> + msleep(40);
[Severity: Medium]
Could exposing the regmap before the 40 ms initialization delay completes lead
to I2C bus lockups or device malfunctions?
The devm_regmap_init_i2c() call exposes the regmap to userspace via debugfs
and to other consumers, such as an asynchronously probing Ethernet PHY. During
this 40 ms window, these concurrent access paths might attempt to access the
hardware before the stabilization delay is met.
Would it be safer to move the msleep(40) above the regmap initialization to
prevent this race condition?
> +
> + ret = regmap_set_bits(regmap, AC200_SYS_CONTROL_REG,
> + AC200_SYS_CONTROL_CHIP_RESET_DEASSERT);
> + if (ret)
> + return ret;
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-submit-ac200-mfd-v9-0-6b7ed278989c@gmail.com?part=2
next prev parent reply other threads:[~2026-09-03 20:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 20:09 [PATCH v9 0/4] mfd: add X-Powers AC200 support James Hilliard
2026-09-03 20:09 ` [PATCH v9 1/4] dt-bindings: mfd: x-powers: Add AC200 James Hilliard
2026-09-03 20:17 ` sashiko-bot
2026-09-03 20:09 ` [PATCH v9 2/4] mfd: ac200: Add X-Powers AC200 support James Hilliard
2026-09-03 20:21 ` sashiko-bot [this message]
2026-09-03 20:09 ` [PATCH v9 3/4] dt-bindings: mfd: x-powers: Describe AC200 functions James Hilliard
2026-09-03 20:14 ` sashiko-bot
2026-09-04 15:50 ` Conor Dooley
2026-09-04 17:06 ` James Hilliard
2026-09-03 20:09 ` [PATCH v9 4/4] mfd: ac200: Add codec and TV encoder cells James Hilliard
2026-09-03 20:20 ` 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=20260903202129.4DD771F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=james.hilliard1@gmail.com \
--cc=lee@kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mfd@lists.linux.dev \
--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