[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220525135758.2944744-37-linux@roeck-us.net>
Date: Wed, 25 May 2022 06:57:54 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: linux-hwmon@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Jean Delvare <jdelvare@...e.com>,
Slawomir Stepien <sst@...zta.fm>,
Guenter Roeck <linux@...ck-us.net>
Subject: [PATCH 36/40] hwmon: (lm90) Only disable alerts if not already disabled
It was observed that the alert handler may be called from the i2c core
even after alerts have already been disabled. Only disable alerts if
they have not already been disabled.
Signed-off-by: Guenter Roeck <linux@...ck-us.net>
---
drivers/hwmon/lm90.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index d1435f55e31d..6d1e7052e3ed 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -2658,8 +2658,10 @@ static void lm90_alert(struct i2c_client *client, enum i2c_alert_protocol type,
if ((data->flags & LM90_HAVE_BROKEN_ALERT) &&
(data->current_alarms & data->alert_alarms)) {
- dev_dbg(&client->dev, "Disabling ALERT#\n");
- lm90_update_confreg(data, data->config | 0x80);
+ if (!(data->config & 0x80)) {
+ dev_dbg(&client->dev, "Disabling ALERT#\n");
+ lm90_update_confreg(data, data->config | 0x80);
+ }
schedule_delayed_work(&data->alert_work,
max_t(int, HZ, msecs_to_jiffies(data->update_interval)));
}
--
2.35.1
Powered by blists - more mailing lists