public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/3] hwmon: (ads7871) Fix endianness and modernize driver
@ 2026-05-02  2:08 Tabrez Ahmed
  2026-05-02  2:08 ` [PATCH v6 1/3] hwmon: (ads7871) Fix endianness bug in 16-bit register reads Tabrez Ahmed
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tabrez Ahmed @ 2026-05-02  2:08 UTC (permalink / raw)
  To: linux-hwmon, linux-kernel
  Cc: linux, david.laight.linux, me, shuah, Tabrez Ahmed

This patch series addresses a critical endianness issue in the ads7871
hardware monitoring driver and updates the driver to use the modern
hwmon API.

The series is broken down as follows:
- Patch 1: Fixes corrupted voltage readings on Big-Endian architectures
by safely converting the 16-bit sensor output using le16_to_cpu().
- Patch 2: Modernizes the driver by migrating it from the deprecated
hwmon API to hwmon_device_register_with_info().
- Patch 3: Ensures all SPI write operations use a properly allocated, 
DMA-safe buffer.

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

Changes in v6:
- patch 1:
  - Switched back to using spi_w8r16() combined with le16_to_cpu()
    for the endian conversion, removing the manual byte array.
  - Added an early return for negative error codes from the SPI core
    to prevent mangling the error status before conversion.
  - Dropped the now-unused <linux/unaligned.h> header.
- patches 2 & 3:
  - Unchanged from v5.

Changes in v5:
- Fixed a bisectability issue where the <linux/unaligned.h> include
modernization was accidentally squashed into Patch 3 instead of Patch 1.

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.

Changes in v2:
- Dropped custom mutex in favor of native hwmon core serialization.
- Split API migration and DMA fix into separate, logical patches.
- Corrected output scaling and sign extension to meet hwmon ABI.

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 | 115 +++++++++++++++++++++++-----------------
 1 file changed, 65 insertions(+), 50 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-02 18:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-02  2:08 [PATCH v6 0/3] hwmon: (ads7871) Fix endianness and modernize driver Tabrez Ahmed
2026-05-02  2:08 ` [PATCH v6 1/3] hwmon: (ads7871) Fix endianness bug in 16-bit register reads Tabrez Ahmed
2026-05-02 18:18   ` Guenter Roeck
2026-05-02  2:08 ` [PATCH v6 2/3] hwmon: (ads7871) Convert to hwmon_device_register_with_info Tabrez Ahmed
2026-05-02 18:18   ` Guenter Roeck
2026-05-02  2:08 ` [PATCH v6 3/3] hwmon: (ads7871) Use DMA-safe buffer for SPI writes Tabrez Ahmed
2026-05-02 18:23   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox