[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120113141019.1fc1439e.akpm@linux-foundation.org>
Date: Fri, 13 Jan 2012 14:10:19 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Axel Lin <axel.lin@...il.com>
Cc: linux-kernel@...r.kernel.org,
Michael Hennerich <michael.hennerich@...log.com>,
Richard Purdie <rpurdie@...ys.net>,
device-drivers-devel@...ckfin.uclinux.org
Subject: Re: [PATCH] backlight: Fix the logic to set bits in adp8860_bl and
adp8870_bl drivers
On Fri, 13 Jan 2012 16:15:21 +0800
Axel Lin <axel.lin@...il.com> wrote:
> 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.
When fixing bugs, please always describe the user-visible effects of
the bug.
> diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c
> index 66bc74d..378276c 100644
> --- a/drivers/video/backlight/adp8860_bl.c
> +++ b/drivers/video/backlight/adp8860_bl.c
> @@ -146,7 +146,7 @@ static int adp8860_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask
>
> ret = adp8860_read(client, 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);
> }
> diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c
> index 6c68a68..6735059 100644
> --- a/drivers/video/backlight/adp8870_bl.c
> +++ b/drivers/video/backlight/adp8870_bl.c
> @@ -160,7 +160,7 @@ static int adp8870_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask
>
> ret = adp8870_read(client, 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);
> }
This patch is applicable to 3.2.x, but I don't know whether to route it
to -stable becasue you didn't tell me what effect the patch has :(
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists