mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
hwmon: (adt7475) Fix masking of hysteresis registers
[ Upstream commit48e8186870] 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:1c301fc539("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0d3095e958
commit
13efd488d3
@@ -484,10 +484,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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user