diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2025-09-09 03:33:39 +0300 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2025-10-17 17:18:10 +0300 |
| commit | bf9a27c86e4b982ed9fe462d86608894aa7cb9b9 (patch) | |
| tree | f2806b5515d87d2e08895fa3f1e3765542dc1257 | |
| parent | 00148a0a234e1c5b1266f3d81e27a15e68fb60f2 (diff) | |
| download | linux-bf9a27c86e4b982ed9fe462d86608894aa7cb9b9.tar.xz | |
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>
| -rw-r--r-- | drivers/hwmon/lochnagar-hwmon.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/hwmon/lochnagar-hwmon.c b/drivers/hwmon/lochnagar-hwmon.c index 5202dddfd61e..c1ba72f6132e 100644 --- a/drivers/hwmon/lochnagar-hwmon.c +++ b/drivers/hwmon/lochnagar-hwmon.c @@ -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"); |
