Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Salih Erim" <salih.erim@amd.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 3/5] iio: adc: versal-sysmon: add I2C driver
Date: Thu, 11 Jun 2026 22:37:56 +0000	[thread overview]
Message-ID: <20260611223756.939FA1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260611222738.2035062-4-salih.erim@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The driver unconditionally registers an interrupt handler based on the Device Tree, which causes a panic on I2C systems because the I2C regmap backend cannot sleep in atomic context.
--

commit adf35a1c0d89c3413cd1a863d9f01cfad15d4e03
Author: Salih Erim <salih.erim@amd.com>

iio: adc: versal-sysmon: add I2C driver

This commit adds an I2C transport driver for the Versal SysMon block. It
enables external masters to read voltage and temperature measurements through
the same register map used by the MMIO path, though events are not supported.

> diff --git a/drivers/iio/adc/versal-sysmon-i2c.c b/drivers/iio/adc/versal-sysmon-i2c.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/iio/adc/versal-sysmon-i2c.c

[ ... ]

> +static int sysmon_i2c_probe(struct i2c_client *client)
> +{
> +	struct device *dev = &client->dev;
> +	struct regmap *regmap;
> +
> +	regmap = devm_regmap_init(dev, NULL, client, &sysmon_i2c_regmap_config);
> +	if (IS_ERR(regmap))
> +		return PTR_ERR(regmap);
> +
> +	/* I2C has no IRQ connection; events are not supported */
> +	return sysmon_core_probe(dev, regmap);

[Severity: High]
If a misconfigured Device Tree provides an interrupts property for the I2C
node, will this unconditionally register a hardirq handler?

Looking at sysmon_core_probe() in versal-sysmon-core.c, it parses the IRQ
directly from the fwnode and sets up the interrupt if found:

    irq = fwnode_irq_get(dev_fwnode(dev), 0);
    ...
    if (irq > 0) {
        ...
        ret = sysmon_init_interrupt(sysmon, dev, indio_dev, irq);

If that interrupt fires, sysmon_iio_irq() attempts to take a spinlock and
perform a regmap_read():

    guard(spinlock)(&sysmon->irq_lock);

    if (regmap_read(sysmon->regmap, SYSMON_ISR, &isr) ||

Since the I2C regmap backend requires sleeping to perform I2C transfers,
won't executing this over I2C in a hardirq context cause a "scheduling while
atomic" panic?

Does the I2C transport need a mechanism to explicitly instruct the core probe
to bypass IRQ parsing?

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260611222738.2035062-1-salih.erim@amd.com?part=3

  reply	other threads:[~2026-06-11 22:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 22:27 [PATCH v6 0/5] iio: adc: add AMD/Xilinx Versal SysMon driver Salih Erim
2026-06-11 22:27 ` [PATCH v6 1/5] dt-bindings: iio: adc: add xlnx,versal-sysmon binding Salih Erim
2026-06-11 22:27 ` [PATCH v6 2/5] iio: adc: add Versal SysMon driver Salih Erim
2026-06-11 22:27 ` [PATCH v6 3/5] iio: adc: versal-sysmon: add I2C driver Salih Erim
2026-06-11 22:37   ` sashiko-bot [this message]
2026-06-11 22:27 ` [PATCH v6 4/5] iio: adc: versal-sysmon: add threshold event support Salih Erim
2026-06-11 22:40   ` sashiko-bot
2026-06-11 22:27 ` [PATCH v6 5/5] iio: adc: versal-sysmon: add oversampling support Salih Erim
2026-06-11 22:40   ` 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=20260611223756.939FA1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=salih.erim@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox