summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony O'Brien <tony.obrien@alliedtelesis.co.nz>2023-02-22 03:52:28 +0300
committerGuenter Roeck <linux@roeck-us.net>2023-03-06 02:08:06 +0300
commit48e8186870d9d0902e712d601ccb7098cb220688 (patch)
tree783244833c55aaa8224102b70a98b741213a650c
parent5f8d1e3b6f9b5971f9c06d5846ce00c49e3a8d94 (diff)
downloadlinux-48e8186870d9d0902e712d601ccb7098cb220688.tar.xz
hwmon: (adt7475) Fix masking of hysteresis registers
The wrong bits are masked in the hysteresis register; indices 0 and 2 should zero bits [7:4] and preserve bits [3:0], and index 1 should zero bits [3:0] and preserve bits [7:4]. Fixes: 1c301fc5394f ("hwmon: Add a driver for the ADT7475 hardware monitoring chip") Signed-off-by: Tony O'Brien <tony.obrien@alliedtelesis.co.nz> Link: https://lore.kernel.org/r/20230222005228.158661-3-tony.obrien@alliedtelesis.co.nz Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/adt7475.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
index 77222c35a38e..6e4c92b500b8 100644
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -488,10 +488,10 @@ static ssize_t temp_store(struct device *dev, struct device_attribute *attr,
val = (temp - val) / 1000;
if (sattr->index != 1) {
- data->temp[HYSTERSIS][sattr->index] &= 0xF0;
+ data->temp[HYSTERSIS][sattr->index] &= 0x0F;
data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4;
} else {
- data->temp[HYSTERSIS][sattr->index] &= 0x0F;
+ data->temp[HYSTERSIS][sattr->index] &= 0xF0;
data->temp[HYSTERSIS][sattr->index] |= (val & 0xF);
}