linux-kernel.vger.kernel.org archive mirror
 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

* Re: [PATCH] mfd: adp5520: Ensure setting bits if new value is different from the old value
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Hennerich @ 2011-10-31  9:43 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel@vger.kernel.org, Michael Hennerich, Samuel Ortiz,
	device-drivers-devel@blackfin.uclinux.org

On 10/31/2011 04:00 AM, Axel Lin wrote:
> 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>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>

Right - the da903x suffers the same problem.

> ---
>   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);
>   	}


-- 
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif



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

* Re: [PATCH] mfd: adp5520: Ensure setting bits if new value is different from the old value
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Samuel Ortiz @ 2011-11-14  0:02 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Michael Hennerich, device-drivers-devel

Hi Axel,

On Mon, Oct 31, 2011 at 11:00:06AM +0800, Axel Lin wrote:
> 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.
I applied all 3 patches, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[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;
as well as URLs for NNTP newsgroup(s).