From: sashiko-bot@kernel.org
To: "Arthur Korn" <akorn@google.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v2] hwmon: (pmbus) Clear only CML invalid command fault during probe
Date: Thu, 19 Nov 2026 02:08:50 +0000 [thread overview]
Message-ID: <sashiko-outbox-222316@kernel.org> (raw)
In-Reply-To: <20261119013208.4089480-1-akorn@google.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] hwmon: (pmbus) pmbus_write_smbalert_mask() clears all faults
on probe
- [Medium] hwmon: (pmbus) pmbus_clear_cml_fault() leaves INVALID_DATA
fault latched
- [Medium] hwmon: (pmbus) pmbus_clear_cml_fault() bypasses driver
write_byte() hooks
--
commit 94d47b10140ba57df41cbee449647587f625d5f3
Author: Arthur Korn <akorn@google.com>
hwmon: (pmbus) Clear only CML invalid command fault during probe
This commit introduces pmbus_clear_cml_fault() and pmbus_clear_cml_faults()
to clear only PB_CML_FAULT_INVALID_COMMAND in PMBUS_STATUS_CML during probe
on PMBus 1.2+ devices instead of sending PMBUS_CLEAR_FAULTS.
> diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
> index 28889fb743b3e..e2e49fdd54841 100644
> --- a/drivers/hwmon/pmbus/pmbus.c
> +++ b/drivers/hwmon/pmbus/pmbus.c
> @@ -113,7 +113,7 @@ static int pmbus_identify(struct i2c_client *client,
> info->pages = 1;
> }
>
> - pmbus_clear_faults(client);
> + pmbus_clear_cml_faults(client);
> }
>
> if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
[Severity: Medium]
Does pmbus_clear_cml_faults() leave PB_CML_FAULT_INVALID_DATA latched
after page auto-detection?
When PMBUS_PAGE is supported, the loop right above probes page numbers
with pmbus_set_page() until writing an out-of-range page index to the
valid PMBUS_PAGE command fails, which latches PB_CML_FAULT_INVALID_DATA
in PMBUS_STATUS_CML. Because pmbus_clear_cml_fault() only writes
PB_CML_FAULT_INVALID_COMMAND, PB_CML_FAULT_INVALID_DATA and PB_STATUS_CML
remain latched after probe.
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 82dac2c6c579f..74fc8d7481689 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -713,6 +713,26 @@ void pmbus_clear_faults(struct i2c_client *client)
> }
> EXPORT_SYMBOL_NS_GPL(pmbus_clear_faults, "PMBUS");
>
> +static void pmbus_clear_cml_fault(struct i2c_client *client, int page)
> +{
> + struct pmbus_data *data = i2c_get_clientdata(client);
> +
> + if (data->revision < PMBUS_REV_12 ||
> + _pmbus_write_byte_data(client, page, PMBUS_STATUS_CML,
> + PB_CML_FAULT_INVALID_COMMAND) < 0)
> + pmbus_clear_fault_page(client, page);
> +}
[Severity: Medium]
Does calling _pmbus_write_byte_data() here bypass driver info->write_byte
callbacks that intercept or block fault clearing?
Previously, probe-time fault clearing always went through
pmbus_clear_fault_page() -> _pmbus_write_byte(client, page,
PMBUS_CLEAR_FAULTS). Several drivers hook write_byte without
implementing write_byte_data: for example, max16601_write_byte() routes
page 2 (PMBUS_PAGE_VIRTUAL) PMBUS_CLEAR_FAULTS to a separate I2C client
(data->vsa), so _pmbus_write_byte_data() writes PMBUS_STATUS_CML to
client (page 0) instead and leaves CML faults on data->vsa uncleared.
Similarly, delta-ahe50dc-fan and max31785 block fault-clearing writes in
write_byte(), and mpq8646 blocks unsupported PMBUS_STATUS_CML reads in
read_byte_data(), none of which implement write_byte_data().
> +
> +void pmbus_clear_cml_faults(struct i2c_client *client)
> +{
> + struct pmbus_data *data = i2c_get_clientdata(client);
> + int i;
> +
> + for (i = 0; i < data->info->pages; i++)
> + pmbus_clear_cml_fault(client, i);
> +}
> +EXPORT_SYMBOL_NS_GPL(pmbus_clear_cml_faults, "PMBUS");
> +
> static int pmbus_check_status_cml(struct i2c_client *client)
> {
> struct pmbus_data *data = i2c_get_clientdata(client);
[ ... ]
> @@ -2978,9 +2998,9 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
> }
>
> if (data->info->pages)
> - pmbus_clear_faults(client);
> + pmbus_clear_cml_faults(client);
> else
> - pmbus_clear_fault_page(client, -1);
> + pmbus_clear_cml_fault(client, -1);
[Severity: Medium]
Should pmbus_write_smbalert_mask() also use pmbus_clear_cml_fault()
instead of pmbus_clear_fault_page()?
When client->irq is set, pmbus_do_probe() -> pmbus_irq_setup() calls
pmbus_write_smbalert_mask() across every page:
drivers/hwmon/pmbus/pmbus_core.c:pmbus_write_smbalert_mask() {
...
ret = _pmbus_write_word_data(client, page, PMBUS_SMBALERT_MASK,
reg | (val << 8));
/*
* Clear fault systematically in case writing PMBUS_SMBALERT_MASK
* is not supported by the chip.
*/
pmbus_clear_fault_page(client, page);
return ret;
}
On any IRQ-enabled PMBus device, this still sends PMBUS_CLEAR_FAULTS on
all pages during probe and erases the latched fault registers that this
patch aims to preserve.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119013208.4089480-1-akorn@google.com?part=1
next prev parent reply other threads:[~2026-11-19 2:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 1:32 [PATCH v2] hwmon: (pmbus) Clear only CML invalid command fault during probe Arthur Korn
2026-11-19 2:08 ` sashiko-bot [this message]
2026-11-19 2:29 ` Guenter Roeck
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-222316@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akorn@google.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.