[PATCH v5 0/3] hwmon: (ads7871) Fix endianness and modernize driver

From: Tabrez Ahmed

Date: Thu Apr 30 2026 - 22:35:54 EST


This series addresses several issues in the ads7871 driver. It fixes an
architecture-dependent endianness bug in the 16-bit register read logic,
migrates the driver to the modern hwmon_device_register_with_info() API,
and moves the SPI transfer buffer into the driver's private data structure
to ensure DMA safety.

Note: I do not have access to the physical ADS7871 hardware. This
series has been compile-tested only.

Changes in v5:
- Fixed a bisectability issue where the <linux/unaligned.h> include
modernization was accidentally squashed into Patch 3 instead of Patch 1.
- Ensured the 1-byte SPI command write in ads7871_read_reg16() uses a
strictly typed 'u8' variable to prevent a Big-Endian pointer hazard.

Changes in v4:
- Patch 1: Refactored 16-bit register reads to use a dedicated 'u8'
transmit variable, eliminating a 32-bit pointer endianness hazard.

Changes in v3:
- Added Patch 1 to fix the pre-existing endianness bug in 16-bit reads.
- Fixed multiple formatting and alignment issues caught by checkpatch
--strict, as requested by Guenter Roeck.
- Added "While at it, fix checkpatch violations" to Patch 2 commit message.

Tabrez Ahmed (3):
hwmon: (ads7871) Fix endianness bug in 16-bit register reads
hwmon: (ads7871) Convert to hwmon_device_register_with_info
hwmon: (ads7871) Use DMA-safe buffer for SPI writes

drivers/hwmon/ads7871.c | 122 +++++++++++++++++++++++-----------------
1 file changed, 71 insertions(+), 51 deletions(-)

--
2.43.0