Everything seems to function fine after the regmap conversion. Thank you for taking the time to work on this. Tested-by: Cosmin Tanislav <cosmin.tanislav@xxxxxxxxxx> Reviewed-by: Cosmin Tanislav <cosmin.tanislav@xxxxxxxxxx> On 12/23/21 22:52, Guenter Roeck wrote:
V1 -> V2: * add device managed action for restoring config * merge multiple small related patches into a single patch that converts the driver to use devm_hwmon_device_register_with_info * switch to devm_request_threaded_irq after switching to devm_hwmon_device_register_with_info to make sure that it is impossible for the interrupt handler to access the freed hwmon device * drop core driver remove callback V2 -> V3: * merge patch that passes name from i2c driver into the devm_hwmon_device_register_with_info patch v3 -> v4: * Use regmap to hide chip specifics and to cache register values * Various minor changes and fixes * With the use of regmap, the bus device (bus_dev) is no longer needed, and the patch introducing it was dropped * Hysteresis value calculations depend on two values: The associated register value and the hysteresis itself. All calculations must be protected to ensure that one value isn't changed during calculations. Add the missing locks to both the hysteresis read and write functions. * Restoring the original configuration is only necessary if it was actually changed. Only call devm_add_action_or_reset() if that is the case. This also lets us drop the associated check in the action function. * Use enum to index ADT7X10_REG_TEMP[] * Check all attributes in is_visible function explicitly. While this is strictly speaking not necessary (the mode for unsupported attributes should not be requested), I find the explicit checks easier to understand and less error prone. * Drop linux/hwmon-sysfs.h include and add missing linux/device.h include * Squash patches 6/7 (pass hwinfo dev to irq handler) and patch 7/7 (use hwmon_notify_event) into a single patch; otherwise bus_dev would still be needed temporarily. Note: This version of the series was module tested for ADT7410, but not on real hardware, and not for ADT7310/7320/7420.