diff mbox series

[v2,3/7] hwmon: (max1619) Mask valid alarm bits

Message ID 20240728143715.1585816-4-linux@roeck-us.net (mailing list archive)
State Accepted
Headers show
Series hwmon: (max1619) Modernize driver | expand

Commit Message

Guenter Roeck July 28, 2024, 2:37 p.m. UTC
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>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Added patch

 drivers/hwmon/max1619.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Tzung-Bi Shih July 29, 2024, 2:18 a.m. UTC | #1
On Sun, Jul 28, 2024 at 07:37:11AM -0700, Guenter Roeck wrote:
> 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>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
diff mbox series

Patch

diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
index 8eb7d04bd2f5..5edc9bbbe299 100644
--- a/drivers/hwmon/max1619.c
+++ b/drivers/hwmon/max1619.c
@@ -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;