]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (lm95241) Rely on subsystem locking
authorGuenter Roeck <linux@roeck-us.net>
Mon, 8 Sep 2025 04:36:47 +0000 (21:36 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 17 Oct 2025 12:59:13 +0000 (05:59 -0700)
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>
drivers/hwmon/lm95241.c

index cad0a0ff8416bcd274639efe8a016b24dcc244f7..456381b0938e75b0eb02995c277628693c2e7381 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/jiffies.h>
 #include <linux/hwmon.h>
 #include <linux/module.h>
-#include <linux/mutex.h>
 #include <linux/slab.h>
 
 #define DEVNAME "lm95241"
@@ -75,7 +74,6 @@ static const u8 lm95241_reg_address[] = {
 /* Client data (each client gets its own) */
 struct lm95241_data {
        struct i2c_client *client;
-       struct mutex update_lock;
        unsigned long last_updated;     /* in jiffies */
        unsigned long interval;         /* in milli-seconds */
        bool valid;             /* false until following fields are valid */
@@ -102,8 +100,6 @@ static struct lm95241_data *lm95241_update_device(struct device *dev)
        struct lm95241_data *data = dev_get_drvdata(dev);
        struct i2c_client *client = data->client;
 
-       mutex_lock(&data->update_lock);
-
        if (time_after(jiffies, data->last_updated
                       + msecs_to_jiffies(data->interval)) ||
            !data->valid) {
@@ -120,9 +116,6 @@ static struct lm95241_data *lm95241_update_device(struct device *dev)
                data->last_updated = jiffies;
                data->valid = true;
        }
-
-       mutex_unlock(&data->update_lock);
-
        return data;
 }
 
@@ -204,8 +197,6 @@ static int lm95241_write_chip(struct device *dev, u32 attr, int channel,
        u8 config;
        int ret;
 
-       mutex_lock(&data->update_lock);
-
        switch (attr) {
        case hwmon_chip_update_interval:
                config = data->config & ~CFG_CRMASK;
@@ -231,7 +222,6 @@ static int lm95241_write_chip(struct device *dev, u32 attr, int channel,
                ret = -EOPNOTSUPP;
                break;
        }
-       mutex_unlock(&data->update_lock);
        return ret;
 }
 
@@ -242,8 +232,6 @@ static int lm95241_write_temp(struct device *dev, u32 attr, int channel,
        struct i2c_client *client = data->client;
        int ret;
 
-       mutex_lock(&data->update_lock);
-
        switch (attr) {
        case hwmon_temp_min:
                if (channel == 1) {
@@ -313,9 +301,6 @@ static int lm95241_write_temp(struct device *dev, u32 attr, int channel,
                ret = -EOPNOTSUPP;
                break;
        }
-
-       mutex_unlock(&data->update_lock);
-
        return ret;
 }
 
@@ -443,7 +428,6 @@ static int lm95241_probe(struct i2c_client *client)
                return -ENOMEM;
 
        data->client = client;
-       mutex_init(&data->update_lock);
 
        /* Initialize the LM95241 chip */
        lm95241_init_client(client, data);