hwmon: (max1619) Mask valid alarm bits
authorGuenter Roeck <linux@roeck-us.net>
Sun, 28 Jul 2024 14:09:54 +0000 (07:09 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 31 Jul 2024 17:43:53 +0000 (10:43 -0700)
Bit 0, 5, and 6 in the status register are reserved and, if set, do not
indicate an alarm. Bit 7 is the 'busy' bit and also does not indicate
an alarm. Mask the non-alarm bits to avoid reporting them to userspace.

Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/max1619.c

index 8eb7d04bd2f5ec45ae92d76360e4fadfc29827fc..5edc9bbbe299577031b4534256ccaabab83442f2 100644 (file)
@@ -112,6 +112,7 @@ static struct max1619_data *max1619_update_device(struct device *dev)
                config = i2c_smbus_read_byte_data(client, MAX1619_REG_R_CONFIG);
                if (!(config & 0x20))
                        data->alarms ^= 0x02;
+               data->alarms &= 0x1e;
 
                data->last_updated = jiffies;
                data->valid = true;