summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony O'Brien <tony.obrien@alliedtelesis.co.nz>2023-02-22 13:52:28 +1300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-22 13:26:15 +0100
commit0ea29dded0c3e33b5da69f3612f5d93983f57779 (patch)
tree9f47cb14a6d6cc08de401c0346e771d86dcddf01
parent12d0c43edfa06aa206ae14d7bfc125bdd5263627 (diff)
downloadlinux-0ea29dded0c3e33b5da69f3612f5d93983f57779.tar.gz
linux-0ea29dded0c3e33b5da69f3612f5d93983f57779.tar.bz2
linux-0ea29dded0c3e33b5da69f3612f5d93983f57779.zip
hwmon: (adt7475) Fix masking of hysteresis registers
[ Upstream commit 48e8186870d9d0902e712d601ccb7098cb220688 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-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 0b964b40d322..51bc70e6ec3f 100644
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -480,10 +480,10 @@ static ssize_t set_temp(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);
}