[PATCH v6 0/3] hwmon: (pmbus/max31785) refactor inter-access delay handling

From: Pradhan, Sanman

Date: Sat Mar 21 2026 - 14:11:57 EST


From: Sanman Pradhan <psanman@xxxxxxxxxxx>

This series refactors the MAX31785 fan controller driver to use the
PMBus core access_delay mechanism instead of driver-local timing
wrappers, and fixes a pre-existing bug in the raw I2C long-read path.

Patch 1 exports pmbus_wait() and pmbus_update_ts() so PMBus device
drivers performing raw I2C transfers outside the core helpers can keep
the PMBus delay bookkeeping in sync. PMBUS_OP_WRITE and
PMBUS_OP_PAGE_CHANGE are moved to pmbus.h for use by device drivers.

Patch 2 refactors the max31785 fan controller driver to use the PMBus
core access_delay mechanism instead of driver-local PMBus timing
wrappers. The raw i2c_transfer() in max31785_read_long_data() is
bracketed with pmbus_wait() and pmbus_update_ts() so the PMBus core
timing state remains consistent.

Patch 3 fixes a pre-existing bug in max31785_read_long_data() where
partial i2c_transfer() completion was treated as success. If only the
write message completes, the read buffer is left uninitialized and may
be interpreted as valid data.

v6:
- Dropped the regulator mutex_lock patch (was v5 1/4) due to a
deadlock through the regulator notifier callback path. The remaining
three patches are otherwise unchanged from v5.

v5:
- Dropped the spinlock patch entirely.
- Added a new patch to serialize the missing regulator voltage paths
with update_lock (dropped again in v6).
- Updated the export patch to remove the spinlock-based timestamp
handling.
- Kept the max31785 access_delay refactor unchanged from v4.
- Added a new patch to treat partial i2c_transfer() completion in
max31785_read_long_data() as an error.

v4:
- Introduced a spinlock to protect 64-bit next_access_backoff accesses
on 32-bit architectures (dropped in v5).
- Standardized all commits and signatures on psanman@xxxxxxxxxxx.

v3:
- Dropped the u16 -> u8 wrapper type fix (already applied upstream).
- Fixed a comment style nit in max31785_read_long_data().

v2:
- Export pmbus_wait() and pmbus_update_ts() from the core.
- Use core timing helpers in max31785 to replace local boilerplate.

Sanman Pradhan (3):
hwmon: (pmbus) export pmbus_wait and pmbus_update_ts
hwmon: (pmbus/max31785) use access_delay for PMBus-mediated accesses
hwmon: (pmbus/max31785) check for partial i2c_transfer in
read_long_data

drivers/hwmon/pmbus/max31785.c | 197 ++++++++++---------------------
drivers/hwmon/pmbus/pmbus.h | 6 +
drivers/hwmon/pmbus/pmbus_core.c | 9 +-
3 files changed, 74 insertions(+), 138 deletions(-)

--
2.34.1