All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jared Kangas" <jkangas@redhat.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 1/4] hwmon: (ina2xx) Replace regmap in ina226_alert_read() with ina2xx_data
Date: Wed, 29 Jul 2026 15:52:53 +0000	[thread overview]
Message-ID: <20260729155254.2C9261F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260729-upstream-ina2xx-in0-curr1-alarms-v1-1-349f7b2f1df8@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Reading an inactive alarm attribute clears the hardware alert flag, causing the active alarm to falsely report as inactive (0).
--

--- Patch [1]: [PATCH 1/4] hwmon: (ina2xx) Replace regmap in ina226_alert_read() with ina2xx_data ---
commit 966375fc88632d14769d99061017ac107e2c8899
Author: Jared Kangas <jkangas@redhat.com>

hwmon: (ina2xx) Replace regmap in ina226_alert_read() with ina2xx_data

This commit updates ina226_alert_read() to accept a struct ina2xx_data
pointer instead of a struct regmap. This mirrors the signatures used by
the alert limit read and write functions.

> diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
> --- a/drivers/hwmon/ina2xx.c
> +++ b/drivers/hwmon/ina2xx.c
> @@ -476,12 +476,12 @@ static int ina2xx_chip_read(struct device *dev, u32 attr, long *val)

[ ... ]

> -static int ina226_alert_read(struct regmap *regmap, u32 mask, long *val)
> +static int ina226_alert_read(struct ina2xx_data *data, u32 mask, long *val)
>  {
>  	unsigned int regval;
>  	int ret;
>  
> -	ret = regmap_read_bypassed(regmap, INA226_MASK_ENABLE, &regval);
> +	ret = regmap_read_bypassed(data->regmap, INA226_MASK_ENABLE, &regval);

[Severity: High]
This is a pre-existing issue, but I have a question about how the hardware
alert state is managed here in ina226_alert_read().

Since the INA226_MASK_ENABLE register clears the Alert Function Flag when
read, does this bypassed hardware read clear the alert flag unintentionally
if an inactive alarm attribute is polled?

For example, if userspace utilities sequentially read sysfs alarm attributes,
could checking an inactive alarm trigger this clear-on-read behavior before
the actually active alarm is polled? It seems this sequence would cause the
active alarm to falsely report as inactive (0).

>  	if (ret)
>  		return ret;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-upstream-ina2xx-in0-curr1-alarms-v1-0-349f7b2f1df8@redhat.com?part=1

  reply	other threads:[~2026-07-29 15:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 15:42 [PATCH 0/4] hwmon: (ina2xx) Decouple in0 and curr1 alarms Jared Kangas
2026-07-29 15:42 ` [PATCH 1/4] hwmon: (ina2xx) Replace regmap in ina226_alert_read() with ina2xx_data Jared Kangas
2026-07-29 15:52   ` sashiko-bot [this message]
2026-07-29 15:42 ` [PATCH 2/4] hwmon: (ina2xx) Replace masks with enum in alert functions Jared Kangas
2026-07-29 16:02   ` sashiko-bot
2026-07-29 15:42 ` [PATCH 3/4] hwmon: (ina2xx) Track active alarm in ina2xx_data Jared Kangas
2026-07-29 16:18   ` sashiko-bot
2026-07-29 15:42 ` [PATCH 4/4] hwmon: (ina2xx) Return 0 on inactive alarm/limit reads Jared Kangas
2026-07-29 16:28   ` 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=20260729155254.2C9261F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jkangas@redhat.com \
    --cc=linux-hwmon@vger.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 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.