From: sashiko-bot@kernel.org
To: "Alexis Czezar Torreno" <alexisczezar.torreno@analog.com>
Cc: linux-gpio@vger.kernel.org, linux-hwmon@vger.kernel.org,
devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/3] hwmon: ltc4283: Add support for the LTC4284 swap controller
Date: Mon, 09 Nov 2026 01:06:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-204280@kernel.org> (raw)
In-Reply-To: <20261109-staging-ltc4284-v2-2-14a270a38f7b@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] hwmon: ltc4283: missing default radc fallback in ltc4283_setup()
--
commit c323a5fb63d971c9df83e57980902ef0c39f7d96
Author: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
hwmon: ltc4283: Add support for the LTC4284 swap controller
This commit adds support for the LTC4284 hot swap controller to the ltc4283
hwmon driver, handling its dual current sense channels and dedicated ADC
power sense resistor.
> diff --git a/drivers/hwmon/ltc4283.c b/drivers/hwmon/ltc4283.c
> index 9ec409bc26482..a8587beed853a 100644
> --- a/drivers/hwmon/ltc4283.c
> +++ b/drivers/hwmon/ltc4283.c
[ ... ]
> @@ -1240,6 +1335,27 @@ static const u32 ltc4283_fet_bad_delay[] = {
> 256, 512, 1002, 2005
> };
>
> +static int ltc4283_read_resistor(struct device *dev, const char *prop,
> + u32 *val, bool optional)
> +{
> + int ret;
> +
> + ret = device_property_read_u32(dev, prop, val);
> + if (ret) {
> + if (optional)
> + return 0;
> + return dev_err_probe(dev, ret, "Failed to read %s\n", prop);
> + }
> +
> + if (*val < LTC4283_MIN_RSENSE || *val > LTC4283_MAX_RSENSE)
> + return dev_err_probe(dev, -EINVAL,
> + "%s(%u) too small or too large [%u %u]\n",
> + prop, *val, LTC4283_MIN_RSENSE,
> + LTC4283_MAX_RSENSE);
> + *val /= CENTI;
> + return 0;
> +}
> +
> static int ltc4283_setup(struct ltc4283_hwmon *st, struct device *dev)
> {
> u32 val;
> @@ -1252,24 +1368,38 @@ static int ltc4283_setup(struct ltc4283_hwmon *st, struct device *dev)
>
> /*
> * Default to LTC4283_MIN_RSENSE so we can probe without FW properties.
> - */
> - st->rsense = LTC4283_MIN_RSENSE;
> - ret = device_property_read_u32(dev, "adi,rsense-nano-ohms",
> - &st->rsense);
> - if (!ret) {
> - if (st->rsense < LTC4283_MIN_RSENSE || st->rsense > LTC4283_MAX_RSENSE)
> - return dev_err_probe(dev, -EINVAL,
> - "adi,rsense-nano-ohms(%u) too small or too large [%u %u]\n",
> - st->rsense, LTC4283_MIN_RSENSE, LTC4283_MAX_RSENSE);
> - }
> -
> - /*
> * The resolution for rsense is tenths of micro (eg: 62.5 uOhm) which
> * means we need nano in the bindings. However, to make things easier to
> * handle (with respect to overflows) we divide it by 100 as we don't
> * really need the last two digits.
> */
> - st->rsense /= CENTI;
> + st->rsense = LTC4283_MIN_RSENSE / CENTI;
> + ret = ltc4283_read_resistor(dev, "adi,rsense-nano-ohms", &st->rsense, true);
> + if (ret)
> + return ret;
> +
> + /*
> + * For LTC4284, rsense is for SENSE1, rsense2 for SENSE2, and radc is
> + * the effective sense resistance for ADC+- pin.
> + */
> + if (st->info->id == ID_LTC4284) {
> + ret = ltc4283_read_resistor(dev, "adi,rsense2-nano-ohms",
> + &st->rsense2, true);
> + if (ret)
> + return ret;
> +
> + ret = ltc4283_read_resistor(dev, "adi,radc-nano-ohms",
> + &st->radc, false);
> + if (ret)
> + return ret;
[Severity: Low]
Should st->radc also default to LTC4283_MIN_RSENSE / CENTI and treat
"adi,radc-nano-ohms" as optional?
Unlike st->rsense, passing optional = false here causes an LTC4284 device
instantiated via ltc4283_i2c_id without firmware properties to fail probe
in ltc4283_setup(). Defaulting st->radc to LTC4283_MIN_RSENSE / CENTI
would allow LTC4284 to probe without firmware properties just like LTC4283
and would also make the optional parameter to ltc4283_read_resistor()
unnecessary.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109-staging-ltc4284-v2-0-14a270a38f7b@analog.com?part=2
next prev parent reply other threads:[~2026-11-09 1:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 0:56 [PATCH v2 0/3] Supporting LTC4284 which is a negative voltage hotswap controller Alexis Czezar Torreno
2026-11-09 0:56 ` [PATCH v2 1/3] dt-bindings: hwmon: ltc4283: add ltc4284 Alexis Czezar Torreno
2026-11-09 1:04 ` sashiko-bot
2026-11-09 0:56 ` [PATCH v2 2/3] hwmon: ltc4283: Add support for the LTC4284 swap controller Alexis Czezar Torreno
2026-11-09 1:06 ` sashiko-bot [this message]
2026-11-09 2:56 ` Torreno, Alexis Czezar
2026-11-09 0:56 ` [PATCH v2 3/3] gpio: gpio-ltc4283: Add support for the LTC4284 Swap Controller Alexis Czezar Torreno
2026-11-09 0:59 ` sashiko-bot
2026-11-09 9:12 ` Bartosz Golaszewski
2026-11-10 1:00 ` Torreno, Alexis Czezar
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=sashiko-outbox-204280@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexisczezar.torreno@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--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