mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Pradhan, Sanman" <sanman.pradhan@hpe.com>
Cc: "linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"Michael.Hennerich@analog.com" <Michael.Hennerich@analog.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sanman Pradhan <psanman@juniper.net>
Subject: Re: [PATCH v2] hwmon: (adm1177) fix sysfs ABI violation and current unit conversion
Date: Wed, 25 Mar 2026 06:50:30 -0700	[thread overview]
Message-ID: <17dd13aa-ad37-4c6f-bbf1-322202037031@roeck-us.net> (raw)
In-Reply-To: <20260325051246.28262-1-sanman.pradhan@hpe.com>

On Wed, Mar 25, 2026 at 05:13:06AM +0000, Pradhan, Sanman wrote:
> From: Sanman Pradhan <psanman@juniper.net>
> 
> The adm1177 driver exposes the current alert threshold through
> hwmon_curr_max_alarm. This violates the hwmon sysfs ABI, where
> *_alarm attributes are read-only status flags and writable thresholds
> must use currN_max.
> 
> The driver also stores the threshold internally in microamps, while
> currN_max is defined in milliamps. Convert the threshold accordingly
> on both the read and write paths.
> 
> Widen the cached threshold and related calculations to 64 bits so
> that small shunt resistor values do not cause truncation or overflow.
> Also use 64-bit arithmetic for the mA/uA conversions, clamp writes
> to the range the hardware can represent, and propagate failures from
> adm1177_write_alert_thr() instead of silently ignoring them.
> 
> Update the hwmon documentation to reflect the attribute rename and
> the correct units returned by the driver.
> 
> Fixes: 09b08ac9e8d5 ("hwmon: (adm1177) Add ADM1177 Hot Swap Controller and Digital Power Monitor driver")
> Signed-off-by: Sanman Pradhan <psanman@juniper.net>
> Acked-by: Nuno Sá <nuno.sa@analog.com>

Applied.

Thanks,
Guenter

      parent reply	other threads:[~2026-03-25 13:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25  5:13 Pradhan, Sanman
2026-03-25 13:20 ` Nuno Sá
2026-03-25 13:48   ` Guenter Roeck
2026-03-25 13:50 ` Guenter Roeck [this message]

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=17dd13aa-ad37-4c6f-bbf1-322202037031@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Michael.Hennerich@analog.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=psanman@juniper.net \
    --cc=sanman.pradhan@hpe.com \
    /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

all inboxes | Powered by JetHome®