Skip to content

Commit

Permalink
drivers/video/backlight/adp88x0_bl.c: fix bit testing logic
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Michael Hennerich <[email protected]>
Cc: Richard Purdie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
AxelLin authored and torvalds committed Jan 23, 2012
1 parent d496aab commit 36c3e75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/video/backlight/adp8860_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static int adp8860_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask

ret = adp8860_read(client, reg, &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);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/adp8870_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static int adp8870_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask

ret = adp8870_read(client, reg, &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);
}
Expand Down

0 comments on commit 36c3e75

Please sign in to comment.