summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Stockhausen <markus.stockhausen@gmx.de>2026-05-02 20:32:07 +0300
committerGuenter Roeck <linux@roeck-us.net>2026-05-08 02:30:12 +0300
commit05aaac8746c5786eaa779b163fae4ddcd5172707 (patch)
tree5c557a68cd36e6f9422cb39f8843640ff6b1c1e3
parent3607422cdeebd1f0c259964bf33aaa9792e21930 (diff)
downloadlinux-05aaac8746c5786eaa779b163fae4ddcd5172707.tar.xz
hwmon: (lm75) Fix configuration register writes.
Sensors configurations are defined by set and clear masks. These do not follow a consistent "clear mask is a superset of set mask" rule. This relaxed definition breaks lm75_write_config() static inline int lm75_write_config(struct lm75_data *data, u16 set_mask, u16 clr_mask) { return regmap_update_bits(data->regmap, LM75_REG_CONF, clr_mask | LM75_SHUTDOWN, set_mask); } Basically all bits from set_mask that are not defined in clr_mask are dropped. Fix that by enhancing the helper to always combine clr_mask and set_mask into the mask bits of regmap_update_bits(). Fixes: 6da24a25f766 ("hwmon: (lm75) Hide register size differences in regmap access functions") Suggested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: https://lore.kernel.org/r/20260502173207.3567876-3-markus.stockhausen@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/lm75.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index a1bf4e9813ed..c283443e363b 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -353,7 +353,7 @@ static inline int lm75_write_config(struct lm75_data *data, u16 set_mask,
u16 clr_mask)
{
return regmap_update_bits(data->regmap, LM75_REG_CONF,
- clr_mask | LM75_SHUTDOWN, set_mask);
+ clr_mask | set_mask | LM75_SHUTDOWN, set_mask);
}
static irqreturn_t lm75_alarm_handler(int irq, void *private)