Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH linux-6.18.y] hwmon: (lm90) Consistently use our own mutex
@ 2026-10-30  8:24 Jean Delvare
  2026-10-30  8:41 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2026-10-30  8:24 UTC (permalink / raw)
  To: stable; +Cc: Guenter Roeck

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-30 20:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30  8:24 [PATCH linux-6.18.y] hwmon: (lm90) Consistently use our own mutex Jean Delvare
2026-10-30  8:41 ` Greg KH
2026-10-30 18:21   ` Jean Delvare
2026-10-30 18:52     ` Guenter Roeck
2026-10-30 20:54   ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox