Skip to content

hwmon: (ads7871) Fix concurrency and modernize API

Tabrez Ahmed linux-hwmon lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2hwmon: (ads7871) Add mutex to serialize SPI transactionsdrivers/hwmon/ads7871.c+18 -82 replies
2/2hwmon: (ads7871) Convert to hwmon_device_register_with_infodrivers/hwmon/ads7871.c+37 -340 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] hwmon: (ads7871) Fix concurrency and modernize API

This patch series addresses a concurrency issue in the ads7871 driver and modernizes it to use the current hwmon API.

Patch 1: Adds a mutex to the driver's private data to serialize SPI transactions. Previously, if userspace read multiple channels concurrently, the driver could overwrite ongoing REG_GAIN_MUX writes before the conversion completed.

Patch 2: Converts the driver to use hwmon_device_register_with_info(). This architectural shift removes boilerplate code and delegates sysfs management to the hwmon core:
- Removes manual file creators (SENSOR_DEVICE_ATTR_RO and ads7871_attrs).
- Implements ads7871_is_visible() for dynamic permission control.
- Replaces the sysfs-specific voltage_show() with a
standard ads7871_read() callback.
- Defines supported channels via hwmon_channel_info.

Tabrez Ahmed (2):
hwmon: (ads7871) Add mutex to serialize SPI transactions
hwmon: (ads7871) Convert to hwmon_device_register_with_info

 drivers/hwmon/ads7871.c | 91 +++++++++++++++++++++++------------------
 1 file changed, 52 insertions(+), 39 deletions(-)
Signature · 1 line
2.43.0