public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: adp5520: Ensure setting bits if new value is different from the old value
@ 2011-10-31  3:00 Axel Lin
  2011-10-31  9:43 ` Michael Hennerich
  2011-11-14  0:02 ` Samuel Ortiz
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2011-10-31  3:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Michael Hennerich, Samuel Ortiz, device-drivers-devel

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>
---
 drivers/mfd/adp5520.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
index f1d8848..8d816cc 100644
--- a/drivers/mfd/adp5520.c
+++ b/drivers/mfd/adp5520.c
@@ -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);
 	}
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-13 23:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-31  3:00 [PATCH] mfd: adp5520: Ensure setting bits if new value is different from the old value Axel Lin
2011-10-31  9:43 ` Michael Hennerich
2011-11-14  0:02 ` Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox