Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: hehuan1@eswincomputing.com
Cc: linux-hwmon@vger.kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 2/2] hwmon: Add Eswin EIC7700 PVT sensor driver
Date: Thu, 04 Jun 2026 08:17:19 +0000	[thread overview]
Message-ID: <20260604081720.5D5251F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260604080552.169-1-hehuan1@eswincomputing.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Clearing the interrupt status before disabling sensor conversions in init_iface() creates a race condition that can lead to an unhandled interrupt storm.
- [Medium] Missing pm_runtime_disable() in the device cleanup path causes an unbalanced PM runtime state.
--

commit 5842ad32271f7d967e9f1e10c13474a5b57da8ad
Author: Huan He <hehuan1@eswincomputing.com>

hwmon: Add Eswin EIC7700 PVT sensor driver

Add support for ESWIN EIC7700 Voltage and Temperature sensor. The driver
supports temperature and voltage monitoring with polynomial conversion,
and provides sysfs interface for sensor data access.

> diff --git a/drivers/hwmon/eic7700-pvt.c b/drivers/hwmon/eic7700-pvt.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/hwmon/eic7700-pvt.c
[ ... ]
> +static int eic7700_pvt_init_iface(struct pvt_hwmon *pvt)
> +{
> +	/*
> +	 * Make sure controller are disabled so not to accidentally have ISR
> +	 * executed before the driver data is fully initialized. Clear the IRQ
> +	 * status as well.
> +	 */
> +	eic7700_pvt_update(pvt->regs + PVT_INT, PVT_INT_CLR, PVT_INT_CLR);
> +	eic7700_pvt_update(pvt->regs + PVT_ENA, PVT_ENA_EN, 0);

[Severity: High]
Could this clear-then-disable sequence cause an unhandled interrupt storm?

If a bootloader left the sensor active, a conversion might complete in the
small window between clearing PVT_INT_CLR and disabling PVT_ENA_EN. This
would assert the IRQ line.

When the IRQ is later requested in probe(), the ISR eic7700_pvt_hard_isr()
will fire immediately. However, since the device is suspended,
pm_runtime_get_if_active() returns <= 0, causing the ISR to return IRQ_NONE
without clearing the interrupt.

Because the interrupt is level-triggered (IRQF_TRIGGER_HIGH), would this
result in a continuous interrupt storm that ultimately forces the kernel
to permanently disable the IRQ line?

Should the conversion engine be disabled before the interrupt is cleared?

[ ... ]
> +static void eic7700_pvt_disable_pm_runtime(void *data)
> +{
> +	struct pvt_hwmon *pvt = data;
> +
> +	pm_runtime_dont_use_autosuspend(pvt->dev);
> +	pm_runtime_force_suspend(pvt->dev);
> +
> +	if (!IS_ENABLED(CONFIG_PM))
> +		clk_disable_unprepare(pvt->clk);
> +}

[Severity: Medium]
Does this device cleanup path need a call to pm_runtime_disable()?

In eic7700_pvt_probe(), pm_runtime_enable() is called, which alters the
PM core's disable_depth count. Since pm_runtime_disable() is missing here,
if the driver is unbound and later rebound, the next pm_runtime_enable()
will encounter an unbalanced depth.

Could this trigger an "Unbalanced pm_runtime_enable!" warning and cause
inconsistent PM state tracking?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260604080430.126-1-hehuan1@eswincomputing.com?part=2

  reply	other threads:[~2026-06-04  8:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04  8:04 [PATCH v6 0/2] Add driver support for ESWIN EIC7700 PVT controller hehuan1
2026-06-04  8:05 ` [PATCH v6 1/2] dt-bindings: hwmon: Add Eswin EIC7700 PVT sensor hehuan1
2026-06-04  8:10   ` sashiko-bot
2026-06-04  8:05 ` [PATCH v6 2/2] hwmon: Add Eswin EIC7700 PVT sensor driver hehuan1
2026-06-04  8:17   ` sashiko-bot [this message]
2026-06-04  9:12   ` Philipp Zabel

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=20260604081720.5D5251F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hehuan1@eswincomputing.com \
    --cc=linux-hwmon@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