mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 04:34:08 +08:00
mfd: Set adp5520 bits if new value is different from the old one
Current code checks if all the bit_mask bits are all zero is wrong. We need to write new value if the bit mask fields of new value is not equal to old value. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
9ad33ba51a
commit
890c98e374
@ -109,7 +109,7 @@ int adp5520_set_bits(struct device *dev, int reg, uint8_t bit_mask)
|
||||
|
||||
ret = __adp5520_read(chip->client, reg, ®_val);
|
||||
|
||||
if (!ret && ((reg_val & bit_mask) == 0)) {
|
||||
if (!ret && ((reg_val & bit_mask) != bit_mask)) {
|
||||
reg_val |= bit_mask;
|
||||
ret = __adp5520_write(chip->client, reg, reg_val);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user