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(-)
--
2.43.0