From: Jean Delvare <jdelvare@suse.de>
To: stable@vger.kernel.org
Cc: Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH linux-6.18.y] hwmon: (lm90) Consistently use our own mutex
Date: Fri, 30 Oct 2026 09:24:10 +0100 [thread overview]
Message-ID: <20261030092410.0e585c82@endymion> (raw)
The backport of commits b09a45601094 ("hwmon: (lm90) Stop work before
releasing hwmon device") and 873e919e3101 ("hwmon: (lm90) Add lock
protection to lm90_alert") to stable branch 6.18 makes use of the
hwmon_lock()/hwmon_unlock() API. While this API is available in
kernel v6.18, the lm90 driver was not ported to it until v6.19.
Mixing the use of different locking models within the same driver is
unsafe and should be avoided.
Update the backports to consistently use the driver's own mutex.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Fixes: bed1fc32e0eb ("hwmon: (lm90) Add lock protection to lm90_alert")
Fixes: c98107817b0f ("hwmon: (lm90) Stop work before releasing hwmon device")
---
This is needed for longterm kernel 6.18 only. The backports to older
branches are already correct.
drivers/hwmon/lm90.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- linux-6.18.orig/drivers/hwmon/lm90.c
+++ linux-6.18/drivers/hwmon/lm90.c
@@ -2614,9 +2614,9 @@ static void lm90_stop_work(void *_data)
{
struct lm90_data *data = _data;
- hwmon_lock(data->hwmon_dev);
+ mutex_lock(&data->update_lock);
data->shutdown = true;
- hwmon_unlock(data->hwmon_dev);
+ mutex_unlock(&data->update_lock);
cancel_delayed_work_sync(&data->alert_work);
cancel_work_sync(&data->report_work);
}
@@ -2963,7 +2963,7 @@ static void lm90_alert(struct i2c_client
*/
struct lm90_data *data = i2c_get_clientdata(client);
- hwmon_lock(data->hwmon_dev);
+ mutex_lock(&data->update_lock);
if (!data->shutdown && (data->flags & LM90_HAVE_BROKEN_ALERT) &&
(data->current_alarms & data->alert_alarms)) {
if (!(data->config & 0x80)) {
@@ -2973,7 +2973,7 @@ static void lm90_alert(struct i2c_client
schedule_delayed_work(&data->alert_work,
max_t(int, HZ, msecs_to_jiffies(data->update_interval)));
}
- hwmon_unlock(data->hwmon_dev);
+ mutex_unlock(&data->update_lock);
} else {
dev_dbg(&client->dev, "Everything OK\n");
}
--
Jean Delvare
SUSE L3 Support
next reply other threads:[~2026-10-30 8:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 8:24 Jean Delvare [this message]
2026-10-30 8:41 ` [PATCH linux-6.18.y] hwmon: (lm90) Consistently use our own mutex Greg KH
2026-10-30 18:21 ` Jean Delvare
2026-10-30 18:52 ` Guenter Roeck
2026-10-30 20:54 ` Sasha Levin
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=20261030092410.0e585c82@endymion \
--to=jdelvare@suse.de \
--cc=linux@roeck-us.net \
--cc=stable@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