From: Guenter Roeck <linux@roeck-us.net>
To: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 02/20] hwmon: (lm90) Rely on subsystem locking
Date: Tue, 14 Oct 2025 08:24:57 -0700 [thread overview]
Message-ID: <20251014152515.785203-3-linux@roeck-us.net> (raw)
In-Reply-To: <20251014152515.785203-1-linux@roeck-us.net>
Attribute access is now serialized in the hardware monitoring core,
so locking n the driver code is no longer necessary. Drop it.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/lm90.c | 25 ++++---------------------
1 file changed, 4 insertions(+), 21 deletions(-)
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index c1f528e292f3..3c10a5066b53 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -108,7 +108,6 @@
#include <linux/hwmon.h>
#include <linux/kstrtox.h>
#include <linux/module.h>
-#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
@@ -735,7 +734,6 @@ struct lm90_data {
struct hwmon_channel_info temp_info;
const struct hwmon_channel_info *info[3];
struct hwmon_chip_info chip;
- struct mutex update_lock;
struct delayed_work alert_work;
struct work_struct report_work;
bool valid; /* true if register values are valid */
@@ -1226,9 +1224,9 @@ static int lm90_update_alarms(struct lm90_data *data, bool force)
{
int err;
- mutex_lock(&data->update_lock);
+ hwmon_lock(data->hwmon_dev);
err = lm90_update_alarms_locked(data, force);
- mutex_unlock(&data->update_lock);
+ hwmon_unlock(data->hwmon_dev);
return err;
}
@@ -1519,9 +1517,7 @@ static int lm90_temp_read(struct device *dev, u32 attr, int channel, long *val)
int err;
u16 bit;
- mutex_lock(&data->update_lock);
err = lm90_update_device(dev);
- mutex_unlock(&data->update_lock);
if (err)
return err;
@@ -1590,11 +1586,9 @@ static int lm90_temp_write(struct device *dev, u32 attr, int channel, long val)
struct lm90_data *data = dev_get_drvdata(dev);
int err;
- mutex_lock(&data->update_lock);
-
err = lm90_update_device(dev);
if (err)
- goto error;
+ return err;
switch (attr) {
case hwmon_temp_min:
@@ -1624,9 +1618,6 @@ static int lm90_temp_write(struct device *dev, u32 attr, int channel, long val)
err = -EOPNOTSUPP;
break;
}
-error:
- mutex_unlock(&data->update_lock);
-
return err;
}
@@ -1662,9 +1653,7 @@ static int lm90_chip_read(struct device *dev, u32 attr, int channel, long *val)
struct lm90_data *data = dev_get_drvdata(dev);
int err;
- mutex_lock(&data->update_lock);
err = lm90_update_device(dev);
- mutex_unlock(&data->update_lock);
if (err)
return err;
@@ -1710,11 +1699,9 @@ static int lm90_chip_write(struct device *dev, u32 attr, int channel, long val)
struct i2c_client *client = data->client;
int err;
- mutex_lock(&data->update_lock);
-
err = lm90_update_device(dev);
if (err)
- goto error;
+ return err;
switch (attr) {
case hwmon_chip_update_interval:
@@ -1728,9 +1715,6 @@ static int lm90_chip_write(struct device *dev, u32 attr, int channel, long val)
err = -EOPNOTSUPP;
break;
}
-error:
- mutex_unlock(&data->update_lock);
-
return err;
}
@@ -2793,7 +2777,6 @@ static int lm90_probe(struct i2c_client *client)
data->client = client;
i2c_set_clientdata(client, data);
- mutex_init(&data->update_lock);
INIT_DELAYED_WORK(&data->alert_work, lm90_alert_work);
INIT_WORK(&data->report_work, lm90_report_alarms);
--
2.45.2
next prev parent reply other threads:[~2025-10-14 15:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 15:24 [PATCH 00/20] hwmon: Rely on subsystem locking [set 1] Guenter Roeck
2025-10-14 15:24 ` [PATCH 01/20] hwmon: (jc42) Rely on subsystem locking Guenter Roeck
2025-10-14 15:24 ` Guenter Roeck [this message]
2025-10-14 15:24 ` [PATCH 03/20] hwmon: (adm9240) " Guenter Roeck
2025-10-14 15:24 ` [PATCH 04/20] hwmon: (emc1403) " Guenter Roeck
2025-10-14 15:25 ` [PATCH 05/20] hwmon: (tmp464) " Guenter Roeck
2025-10-14 15:25 ` [PATCH 06/20] hwmon: (tmp421) " Guenter Roeck
2025-10-14 15:25 ` [PATCH 07/20] hwmon: (tmp401) " Guenter Roeck
2025-10-14 15:25 ` [PATCH 08/20] hwmon: (tmp108) Drop mutex.h include Guenter Roeck
2025-10-14 15:25 ` [PATCH 09/20] hwmon: (drivetemp) Rely on subsystem locking Guenter Roeck
2025-10-14 15:25 ` [PATCH 10/20] hwmon: (max6697) " Guenter Roeck
2025-10-14 15:25 ` [PATCH 11/20] hwmon: (ltc4245) " Guenter Roeck
2025-10-14 15:25 ` [PATCH 12/20] hwmon: (lm95245) " Guenter Roeck
2025-10-14 15:25 ` [PATCH 13/20] hwmon: (tmp103) Drop unnecessary include files Guenter Roeck
2025-10-14 15:25 ` [PATCH 14/20] hwmon: (tmp102) " Guenter Roeck
2025-10-14 15:25 ` [PATCH 15/20] hwmon: (max6639) Rely on subsystem locking Guenter Roeck
2025-10-14 15:25 ` [PATCH 16/20] hwmon: (max31827) " Guenter Roeck
2025-10-14 15:25 ` [PATCH 17/20] hwmon: (nct7904) " Guenter Roeck
2025-10-14 15:25 ` [PATCH 18/20] hwmon: (nct7363) Drop unnecessary include files Guenter Roeck
2025-10-14 15:25 ` [PATCH 19/20] hwmon: (max6620) Rely on subsystem locking Guenter Roeck
2025-10-14 15:25 ` [PATCH 20/20] hwmon: (max31790) " Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251014152515.785203-3-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linux-hwmon@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox