summaryrefslogtreecommitdiff
path: root/drivers/hwmon/lm90.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2021-12-28 18:59:26 +0300
committerGuenter Roeck <linux@roeck-us.net>2022-07-13 18:38:19 +0300
commitb1526b38e363bd87840c0e2c22a16e6fd42fea56 (patch)
tree3b6f62cbbf98ca4b1c6547c7636d6a22d124f9a3 /drivers/hwmon/lm90.c
parent41e6d7215d79f98758def6ef60161fd891bbac0d (diff)
downloadlinux-b1526b38e363bd87840c0e2c22a16e6fd42fea56.tar.xz
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@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/lm90.c')
-rw-r--r--drivers/hwmon/lm90.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index c7bf288c8401..3f49b2e5e9c4 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -2660,8 +2660,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)));
}