Skip to contentSkip to conversation

mfd: Fix checking bit_mask for adp5520_set_bits

PATCH RESEND In review Axel Lin 2 participants 5 messages Dec 19, 2011

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH RESEND 1/3 mfd: Fix checking bit_mask for adp5520_set_bits

Current code checks if all the bit_mask bits are all zero is wrong. We need to write new value if old value is not equal to new value.

---
Hi Samuel,
I found this serial of patches are not merged yet.
( although you replied that you applied all 3 patches in the mail ) It was post on https://lkml.org/lkml/2011/10/30/137
So I resend it again.

Thanks,
Axel

 drivers/mfd/adp5520.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/adp5520.c +1 -1
index f1d8848..8d816cc 100644
@@ -109,7 +109,7 @@ int adp5520_set_bits(struct device *dev, int reg, uint8_t bit_mask)
 
 	ret = __adp5520_read(chip->client, reg, &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);
 	}
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH RESEND 2/3 mfd: da903x: Ensure setting bits if new value is different from the old value

It does not make sense to write new value only when all the bit_mask bits are zero.
We need to write new value if the bit mask fields of new value is not equal to old value.

---
 drivers/mfd/da903x.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/da903x.c +1 -1
index 62ce685..1924b85 100644
@@ -182,7 +182,7 @@ int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask)
 	if (ret)
 		goto out;
 
-	if ((reg_val & bit_mask) == 0) {
+	if ((reg_val & bit_mask) != bit_mask) {
 		reg_val |= bit_mask;
 		ret = __da903x_write(chip->client, reg, reg_val);
 	}
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH RESEND 3/3 mfd: tps6586x: Ensure setting bits if new value is different from the old value

In reply to Axel Lin

It does not make sense to write new value only when all the bit_mask bits are zero.
We need to write new value if the bit mask fields of new value is not equal to old value.

---
 drivers/mfd/tps6586x.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/tps6586x.c +1 -1
index bba26d9..a5ddf31 100644
@@ -197,7 +197,7 @@ int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask)
 	if (ret)
 		goto out;
 
-	if ((reg_val & bit_mask) == 0) {
+	if ((reg_val & bit_mask) != bit_mask) {
 		reg_val |= bit_mask;
 		ret = __tps6586x_write(to_i2c_client(dev), reg, reg_val);
 	}
Signature · 1 line
1.7.5.4
author
#3 lore raw
In reply to Axel Lin

2011/12/19 Axel Lin <[email protected]>:

Quoted 12 lines

Current code checks if all the bit_mask bits are all zero is wrong. We need to write new value if old value is not equal to new value.

---
Hi Samuel,
I found this serial of patches are not merged yet.
( although you replied that you applied all 3 patches in the mail ) It was post on https://lkml.org/lkml/2011/10/30/137
So I resend it again.

Hi Samuel,
I found these patches already in your for-linus branch.
But it is strange that these patches are not exist in linux-next tree.

Regards,
Axel

#4 lore raw

Hi Axel,

Quoted 13 lines · Axel Lin

2011/12/19 Axel Lin <[email protected]>:

Quoted 12 lines

Current code checks if all the bit_mask bits are all zero is wrong. We need to write new value if old value is not equal to new value.

---
Hi Samuel,
I found this serial of patches are not merged yet.
( although you replied that you applied all 3 patches in the mail ) It was post on https://lkml.org/lkml/2011/10/30/137
So I resend it again.

Quoted 3 lines

Hi Samuel,
I found these patches already in your for-linus branch.
But it is strange that these patches are not exist in linux-next tree.

Strange as in I forgot to cherry pick them. It should be fixed now, sorry.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/