mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-15 13:22:55 +00:00
drivers/video/backlight/adp88x0_bl.c: fix bit testing logic
We need to write new value if the bit mask fields of new value is not equal to old value. It does not make sense to write new value only when all the bit_mask bits are zero. Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Michael Hennerich <michael.hennerich@analog.com> Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
d496aab567
commit
36c3e75907
@ -146,7 +146,7 @@ static int adp8860_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask
|
||||
|
||||
ret = adp8860_read(client, reg, ®_val);
|
||||
|
||||
if (!ret && ((reg_val & bit_mask) == 0)) {
|
||||
if (!ret && ((reg_val & bit_mask) != bit_mask)) {
|
||||
reg_val |= bit_mask;
|
||||
ret = adp8860_write(client, reg, reg_val);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ static int adp8870_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask
|
||||
|
||||
ret = adp8870_read(client, reg, ®_val);
|
||||
|
||||
if (!ret && ((reg_val & bit_mask) == 0)) {
|
||||
if (!ret && ((reg_val & bit_mask) != bit_mask)) {
|
||||
reg_val |= bit_mask;
|
||||
ret = adp8870_write(client, reg, reg_val);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user