All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Mike Rapoport <mike@compulab.co.il>,
	Eric Miao <eric.y.miao@gmail.com>,
	Samuel Ortiz <sameo@linux.intel.com>
Subject: [PATCH RESEND 3/3] mfd: tps6586x: Ensure setting bits if new value is different from the old value
Date: Mon, 19 Dec 2011 19:59:31 +0800	[thread overview]
Message-ID: <1324295971.3350.6.camel@phoenix> (raw)
In-Reply-To: <1324295757.3350.3.camel@phoenix>

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.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/mfd/tps6586x.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index bba26d9..a5ddf31 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -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);
 	}
-- 
1.7.5.4




  parent reply	other threads:[~2011-12-19 11:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-19 11:55 [PATCH RESEND 1/3] mfd: Fix checking bit_mask for adp5520_set_bits Axel Lin
2011-12-19 11:57 ` [PATCH RESEND 2/3] mfd: da903x: Ensure setting bits if new value is different from the old value Axel Lin
2011-12-19 11:59 ` Axel Lin [this message]
2011-12-19 12:25 ` [PATCH RESEND 1/3] mfd: Fix checking bit_mask for adp5520_set_bits Axel Lin
2011-12-19 17:54   ` Samuel Ortiz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324295971.3350.6.camel@phoenix \
    --to=axel.lin@gmail.com \
    --cc=eric.y.miao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike@compulab.co.il \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.