From: Ben Hutchings Date: Fri, 17 Oct 2008 15:51:11 +0000 (+0200) Subject: hwmon: (lm87) Fix masking of config register in lm87_init_client() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=49ae6cc8005f45edadf237089c31885834f2608e;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git hwmon: (lm87) Fix masking of config register in lm87_init_client() lm87_init_client() conditionally sets the Start bit and clears the INT#_Clear bit in the Config 1 register. The condition should be that either of these bits needs changing, but currently it checks the (self-clearing) Initialization bit instead of INT#_Clear. Fix the condition and also ensure we never set the Initialization bit. Signed-off-by: Ben Hutchings Signed-off-by: Jean Delvare --- diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c index 21970f0d53a1..0fecbfd2ba5b 100644 --- a/drivers/hwmon/lm87.c +++ b/drivers/hwmon/lm87.c @@ -867,11 +867,11 @@ static void lm87_init_client(struct i2c_client *client) lm87_write_value(client, LM87_REG_IN_MAX(0), 0xFF); } } - if ((config & 0x81) != 0x01) { - /* Start monitoring */ + + /* Make sure Start is set and INT#_Clear is clear */ + if ((config & 0x09) != 0x01) lm87_write_value(client, LM87_REG_CONFIG, - (config & 0xF7) | 0x01); - } + (config & 0x77) | 0x01); } static int lm87_remove(struct i2c_client *client)