hwmon: (lochnagar-hwmon) Rely on subsystem locking

Attribute access is now serialized in the hardware monitoring core,
so locking in the driver code is no longer necessary. Drop it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
pull/1354/merge
Guenter Roeck 2025-09-08 17:33:39 -07:00
parent 00148a0a23
commit bf9a27c86e
1 changed files with 3 additions and 15 deletions

View File

@ -10,7 +10,6 @@
#include <linux/delay.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/math64.h>
#include <linux/mfd/lochnagar.h>
#include <linux/mfd/lochnagar2_regs.h>
@ -42,9 +41,6 @@ struct lochnagar_hwmon {
struct regmap *regmap;
long power_nsamples[ARRAY_SIZE(lochnagar_chan_names)];
/* Lock to ensure only a single sensor is read at a time */
struct mutex sensor_lock;
};
enum lochnagar_measure_mode {
@ -178,26 +174,20 @@ static int read_sensor(struct device *dev, int chan,
u32 data;
int ret;
mutex_lock(&priv->sensor_lock);
ret = do_measurement(regmap, chan, mode, nsamples);
if (ret < 0) {
dev_err(dev, "Failed to perform measurement: %d\n", ret);
goto error;
return ret;
}
ret = request_data(regmap, chan, &data);
if (ret < 0) {
dev_err(dev, "Failed to read measurement: %d\n", ret);
goto error;
return ret;
}
*val = float_to_long(data, precision);
error:
mutex_unlock(&priv->sensor_lock);
return ret;
return 0;
}
static int read_power(struct device *dev, int chan, long *val)
@ -378,8 +368,6 @@ static int lochnagar_hwmon_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
mutex_init(&priv->sensor_lock);
priv->regmap = dev_get_regmap(dev->parent, NULL);
if (!priv->regmap) {
dev_err(dev, "No register map found\n");